liuhua
liuhua
commited on
Commit
·
53b1865
1
Parent(s):
e4a04a5
Fix the agent reference bug and the session prologue (#3823)
Browse files### What problem does this PR solve?
Fix the agent reference bug and the session prologue
#3285 #3819
### Type of change
- [x] Bug Fix (non-breaking change which fixes an issue)
Co-authored-by: liuhua <[email protected]>
- api/apps/sdk/session.py +2 -3
api/apps/sdk/session.py
CHANGED
@@ -45,7 +45,7 @@ def create(tenant_id,chat_id):
|
|
45 |
"id": get_uuid(),
|
46 |
"dialog_id": req["dialog_id"],
|
47 |
"name": req.get("name", "New session"),
|
48 |
-
"message": [{"role": "assistant", "content": "
|
49 |
}
|
50 |
if not conv.get("name"):
|
51 |
return get_error_data_result(message="`name` can not be empty.")
|
@@ -274,7 +274,6 @@ def agent_completion(tenant_id, agent_id):
|
|
274 |
|
275 |
def fillin_conv(ans):
|
276 |
reference = ans["reference"]
|
277 |
-
print(reference,flush=True)
|
278 |
temp_reference = deepcopy(ans["reference"])
|
279 |
nonlocal conv, message_id
|
280 |
if not conv.reference:
|
@@ -288,7 +287,7 @@ def agent_completion(tenant_id, agent_id):
|
|
288 |
for chunk in chunks:
|
289 |
new_chunk = {
|
290 |
"id": chunk["chunk_id"],
|
291 |
-
"content": chunk["
|
292 |
"document_id": chunk["doc_id"],
|
293 |
"document_name": chunk["docnm_kwd"],
|
294 |
"dataset_id": chunk["kb_id"],
|
|
|
45 |
"id": get_uuid(),
|
46 |
"dialog_id": req["dialog_id"],
|
47 |
"name": req.get("name", "New session"),
|
48 |
+
"message": [{"role": "assistant", "content": dia[0].prompt_config.get("prologue")}]
|
49 |
}
|
50 |
if not conv.get("name"):
|
51 |
return get_error_data_result(message="`name` can not be empty.")
|
|
|
274 |
|
275 |
def fillin_conv(ans):
|
276 |
reference = ans["reference"]
|
|
|
277 |
temp_reference = deepcopy(ans["reference"])
|
278 |
nonlocal conv, message_id
|
279 |
if not conv.reference:
|
|
|
287 |
for chunk in chunks:
|
288 |
new_chunk = {
|
289 |
"id": chunk["chunk_id"],
|
290 |
+
"content": chunk["content"],
|
291 |
"document_id": chunk["doc_id"],
|
292 |
"document_name": chunk["docnm_kwd"],
|
293 |
"dataset_id": chunk["kb_id"],
|