# Conflicts:
#	docs/视频快处智能信息采集机器人交互接口文档V1.0.10.docx
#	src/api/endpoints.py
#	src/core/fastgpt_client.py
This commit is contained in:
Eric Wang
2026-10-11 21:39:49 +08:00
31 changed files with 4005 additions and 40 deletions
+1
View File
@@ -12,6 +12,7 @@ class ChatInput:
session_id: str
text: str
need_form_update: bool = False
client_mode: str = ""
@dataclass(frozen=True)
+24 -7
View File
@@ -18,7 +18,7 @@ from .chat import (
)
FORM_EXTRACT_MODULE_NAME = "文本内容提取事故信息"
FORM_EXTRACT_MODULE_NAME = "更新表单"
def _parse_json_value(value: Any) -> Any:
@@ -46,12 +46,23 @@ def _extract_form_update(nodes: Any) -> Any:
if node.get("moduleName") != FORM_EXTRACT_MODULE_NAME:
continue
extract_result = node.get("extractResult", {})
if not isinstance(extract_result, dict):
# 代码节点返回值在 customOutputs;兼容旧版/其他形态
outputs = node.get("customOutputs")
if not isinstance(outputs, dict):
outputs = node.get("nodeOutputs")
if not isinstance(outputs, dict):
outputs = node.get("extractResult")
if not isinstance(outputs, dict):
return {}
form_update = extract_result.get("formUpdate", "")
return _parse_json_value(form_update) if form_update else {}
form_update = outputs.get("formUpdate", "")
if form_update in ("", None):
return {}
parsed = _parse_json_value(form_update)
# 无变更时代码节点常返回 {},直接透传空对象
if not isinstance(parsed, dict):
return {}
return parsed
return {}
@@ -88,7 +99,10 @@ class FastGPTBackend:
chatId=chat_input.session_id,
stream=True,
detail=True,
variables={"needFormUpdate": chat_input.need_form_update},
variables={
"needFormUpdate": chat_input.need_form_update,
"clientMode": chat_input.client_mode,
},
)
async for event in aiter_stream_events(response):
@@ -123,7 +137,10 @@ class FastGPTBackend:
chatId=chat_input.session_id,
stream=False,
detail=True,
variables={"needFormUpdate": chat_input.need_form_update},
variables={
"needFormUpdate": chat_input.need_form_update,
"clientMode": chat_input.client_mode,
},
)
response.raise_for_status()
data = response.json()