修复第三方报告追问事务和上下文
This commit is contained in:
parent
aa1f85bc63
commit
9d675d2a46
@ -308,6 +308,11 @@ class ConversationService:
|
|||||||
yield {"type": "error", "message": "LLM 未返回有效内容"}
|
yield {"type": "error", "message": "LLM 未返回有效内容"}
|
||||||
return
|
return
|
||||||
|
|
||||||
|
if persist_reply is not None:
|
||||||
|
assistant_message = await persist_reply(reply, semantics)
|
||||||
|
yield {"type": "done", "data": {"assistantMessageId": assistant_message.id}}
|
||||||
|
return
|
||||||
|
|
||||||
# Persist the complete assistant text before optional card enrichment.
|
# Persist the complete assistant text before optional card enrichment.
|
||||||
# A slow or failed RAG/score lookup must not lose the conversation turn.
|
# A slow or failed RAG/score lookup must not lose the conversation turn.
|
||||||
assistant_message = ConversationMessage(
|
assistant_message = ConversationMessage(
|
||||||
@ -378,6 +383,8 @@ class ConversationService:
|
|||||||
conversation: Conversation,
|
conversation: Conversation,
|
||||||
current_text: str,
|
current_text: str,
|
||||||
semantics: dict[str, Any],
|
semantics: dict[str, Any],
|
||||||
|
*,
|
||||||
|
external_context: str | None = None,
|
||||||
) -> Sequence[dict[str, str]]:
|
) -> Sequence[dict[str, str]]:
|
||||||
messages = reply_system_messages(semantics)
|
messages = reply_system_messages(semantics)
|
||||||
messages.append(
|
messages.append(
|
||||||
@ -390,6 +397,8 @@ class ConversationService:
|
|||||||
structured_context = ConversationService._structured_context(conversation, summary=is_summary)
|
structured_context = ConversationService._structured_context(conversation, summary=is_summary)
|
||||||
if structured_context:
|
if structured_context:
|
||||||
messages.append({"role": "system", "content": structured_context})
|
messages.append({"role": "system", "content": structured_context})
|
||||||
|
if external_context:
|
||||||
|
messages.append({"role": "system", "content": external_context})
|
||||||
if is_summary:
|
if is_summary:
|
||||||
messages.append(
|
messages.append(
|
||||||
{
|
{
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user