Feature (canvas): Add mind tagging support
-Insert the<think>tag in the message storage content to indicate the start of thinking -Insert the</hint>tag in the message storage content to indicate the end of thinking-
This commit is contained in:
parent
bd4bc57009
commit
08251f5732
1 changed files with 4 additions and 0 deletions
|
|
@ -223,6 +223,10 @@ def completion(tenant_id, agent_id, session_id=None, **kwargs):
|
|||
ans["session_id"] = session_id
|
||||
if ans["event"] == "message":
|
||||
txt += ans["data"]["content"]
|
||||
if ans["data"].get("start_to_think", False):
|
||||
txt += "<think>"
|
||||
elif ans["data"].get("end_to_think", False):
|
||||
txt += "</think>"
|
||||
yield "data:" + json.dumps(ans, ensure_ascii=False) + "\n\n"
|
||||
|
||||
conv.message.append({"role": "assistant", "content": txt, "created_at": time.time(), "id": message_id})
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue