From 6ae19ce01dbdfdb1080802d854b13adda3982172 Mon Sep 17 00:00:00 2001
From: zhaoqingang <zhaoqg0118@163.com>
Date: 星期二, 26 十一月 2024 13:55:07 +0800
Subject: [PATCH] 绘图历史信息
---
app/api/chat.py | 3 ++-
app/api/agent.py | 2 ++
2 files changed, 4 insertions(+), 1 deletions(-)
diff --git a/app/api/agent.py b/app/api/agent.py
index b8c1b9d..8b8add1 100644
--- a/app/api/agent.py
+++ b/app/api/agent.py
@@ -181,6 +181,8 @@
if "file_name" in i.get("content", {}):
tmp_data["files"] = [{"file_name": i.get("content", {}).get("file_name"),
"file_url": i.get("content", {}).get("file_url")}]
+ if "images" in i.get("content", {}):
+ tmp_data["images"] = i.get("content", {}).get("images")
else:
tmp_data["answer"] = i.get("content")
data.append(tmp_data)
diff --git a/app/api/chat.py b/app/api/chat.py
index 97c3006..cd5c060 100644
--- a/app/api/chat.py
+++ b/app/api/chat.py
@@ -339,6 +339,7 @@
else: # 姝e父杈撳嚭
answer = data.get("answer", "")
if isinstance(answer, str):
+
answer_str += answer
elif isinstance(answer, dict):
@@ -356,7 +357,7 @@
result = {"message": answer_str, "type": "close", "message_files": message_files}
try:
SessionService(db).update_session(chat_id,
- message={"role": "assistant", "content": answer_str},conversation_id=data.get("conversation_id"))
+ message={"role": "assistant", "content": {"answer":answer_str, "images":[i.get("url") for i in message_files]}},conversation_id=data.get("conversation_id"))
except Exception as e:
logger.error("淇濆瓨dify鐨勪細璇濆紓甯革紒")
logger.error(e)
--
Gitblit v1.8.0