kunkeji Kevin Hu jinhai-2012 commited on
Commit
f36505d
·
1 Parent(s): cd389b1

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

Browse files

### 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 <[email protected]>
Co-authored-by: Jin Hai <[email protected]>

Files changed (1) hide show
  1. api/apps/sdk/session.py +0 -2
api/apps/sdk/session.py CHANGED
@@ -308,7 +308,6 @@ def agent_completion(tenant_id, agent_id):
308
  if 'docnm_kwd' in chunk_i:
309
  chunk_i['doc_name'] = chunk_i['docnm_kwd']
310
  chunk_i.pop('docnm_kwd')
311
- conv.message.append(msg[-1])
312
 
313
  if not conv.reference:
314
  conv.reference = []
@@ -317,7 +316,6 @@ def agent_completion(tenant_id, agent_id):
317
 
318
  final_ans = {"reference": [], "content": ""}
319
 
320
- canvas.messages.append(msg[-1])
321
  canvas.add_user_input(msg[-1]["content"])
322
 
323
  if stream:
 
308
  if 'docnm_kwd' in chunk_i:
309
  chunk_i['doc_name'] = chunk_i['docnm_kwd']
310
  chunk_i.pop('docnm_kwd')
 
311
 
312
  if not conv.reference:
313
  conv.reference = []
 
316
 
317
  final_ans = {"reference": [], "content": ""}
318
 
 
319
  canvas.add_user_input(msg[-1]["content"])
320
 
321
  if stream: