From 7b8752fe2492cee4147306320e8bc0c8207f8bbf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=A4=A9=E6=B5=B7=E8=92=BC=E7=81=86?= Date: Mon, 25 Aug 2025 14:09:28 +0800 Subject: [PATCH] fix: Create conversation sessions will lost prologue (#9666) ### What problem does this PR solve? When create conversation,the prologue hasn't save in conversation. ### Type of change - [x] Bug Fix (non-breaking change which fixes an issue) --- api/apps/sdk/session.py | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/api/apps/sdk/session.py b/api/apps/sdk/session.py index cdf07b7ed..8fd26f199 100644 --- a/api/apps/sdk/session.py +++ b/api/apps/sdk/session.py @@ -84,18 +84,10 @@ def create_agent_session(tenant_id, agent_id): session_id=get_uuid() canvas = Canvas(cvs.dsl, tenant_id, agent_id) canvas.reset() - conv = { - "id": session_id, - "dialog_id": cvs.id, - "user_id": user_id, - "message": [], - "source": "agent", - "dsl": cvs.dsl - } - API4ConversationService.save(**conv) - + cvs.dsl = json.loads(str(canvas)) conv = {"id": session_id, "dialog_id": cvs.id, "user_id": user_id, "message": [{"role": "assistant", "content": canvas.get_prologue()}], "source": "agent", "dsl": cvs.dsl} + API4ConversationService.save(**conv) conv["agent_id"] = conv.pop("dialog_id") return get_result(data=conv)