Feature (canvas): Add mind tagging support (#11359)
### What problem does this PR solve? Resolve the issue of missing thinking labels when viewing pre-existing conversations ### Type of change - [x] New Feature (non-breaking change which adds functionality)
This commit is contained in:
parent
48de3b26ba
commit
9f715d6bc2
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