Fix the issue where the agent interface cannot call the context (#3725)

### What problem does this PR solve?

Fix the context of the agent interface call to the context during web
testing, and change it to the context record of user chat
Remove duplicate messages and add them, which can be viewed in the
messages section of database api_4_comversation

### Type of change

- [x] Bug Fix (non-breaking change which fixes an issue)

---------

Co-authored-by: Kevin Hu <kevinhu.sh@gmail.com>
Co-authored-by: Jin Hai <haijin.chn@gmail.com>
This commit is contained in:
kunkeji 2024-11-29 10:36:48 +08:00 committed by GitHub
parent 834c4d81f3
commit fcdc6ad085
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -308,7 +308,6 @@ def agent_completion(tenant_id, agent_id):
if 'docnm_kwd' in chunk_i:
chunk_i['doc_name'] = chunk_i['docnm_kwd']
chunk_i.pop('docnm_kwd')
conv.message.append(msg[-1])
if not conv.reference:
conv.reference = []
@ -317,7 +316,6 @@ def agent_completion(tenant_id, agent_id):
final_ans = {"reference": [], "content": ""}
canvas.messages.append(msg[-1])
canvas.add_user_input(msg[-1]["content"])
if stream: