From 95da6de9e1010356d110ffc8c762935df29c819e Mon Sep 17 00:00:00 2001 From: liuhua <10215101452@stu.ecnu.edu.cn> Date: Tue, 3 Dec 2024 14:49:26 +0800 Subject: [PATCH] Fix the agent reference bug and the session prologue (#3823) ### What problem does this PR solve? Fix the agent reference bug and the session prologue #3285 #3819 ### Type of change - [x] Bug Fix (non-breaking change which fixes an issue) Co-authored-by: liuhua <10215101452@stu.ecun.edu.cn> --- api/apps/sdk/session.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/api/apps/sdk/session.py b/api/apps/sdk/session.py index 59606861d..117016bab 100644 --- a/api/apps/sdk/session.py +++ b/api/apps/sdk/session.py @@ -45,7 +45,7 @@ def create(tenant_id,chat_id): "id": get_uuid(), "dialog_id": req["dialog_id"], "name": req.get("name", "New session"), - "message": [{"role": "assistant", "content": "Hi! I am your assistant,can I help you?"}] + "message": [{"role": "assistant", "content": dia[0].prompt_config.get("prologue")}] } if not conv.get("name"): return get_error_data_result(message="`name` can not be empty.") @@ -274,7 +274,6 @@ def agent_completion(tenant_id, agent_id): def fillin_conv(ans): reference = ans["reference"] - print(reference,flush=True) temp_reference = deepcopy(ans["reference"]) nonlocal conv, message_id if not conv.reference: @@ -288,7 +287,7 @@ def agent_completion(tenant_id, agent_id): for chunk in chunks: new_chunk = { "id": chunk["chunk_id"], - "content": chunk["content_with_weight"], + "content": chunk["content"], "document_id": chunk["doc_id"], "document_name": chunk["docnm_kwd"], "dataset_id": chunk["kb_id"],