Merge branch 'dev' into validate-rag-urls

This commit is contained in:
Rory
2025-02-03 20:44:59 -06:00
3 changed files with 40 additions and 37 deletions

View File

@@ -901,7 +901,7 @@ async def process_chat_response(
if message:
messages = get_message_list(message_map, message.get("id"))
if tasks:
if tasks and messages:
if TASKS.TITLE_GENERATION in tasks:
if tasks[TASKS.TITLE_GENERATION]:
res = await generate_title(
@@ -1090,6 +1090,14 @@ async def process_chat_response(
task_id = str(uuid4()) # Create a unique task ID.
model_id = form_data.get("model", "")
Chats.upsert_message_to_chat_by_id_and_message_id(
metadata["chat_id"],
metadata["message_id"],
{
"model": model_id,
},
)
# Handle as a background task
async def post_response_handler(response, events):
def serialize_content_blocks(content_blocks, raw=False):
@@ -1388,6 +1396,7 @@ async def process_chat_response(
retries += 1
log.debug(f"Attempt count: {retries}")
output = ""
try:
if content_blocks[-1]["attributes"].get("type") == "code":
output = await event_caller(

View File

@@ -20,7 +20,7 @@ def get_message_list(messages, message_id):
current_message = messages.get(message_id)
if not current_message:
return f"Message ID {message_id} not found in the history."
return None
# Reconstruct the chain by following the parentId links
message_list = []