feat(chat): Update trace ID handling in chat stream API
- Modified `chat_stream_api` to use `new_trace()` instead of an empty string for `trace_id`, enhancing traceability. - Added tests to verify the correct generation and propagation of `trace_id` in responses, ensuring no empty trace IDs are sent to clients. This update improves the tracking of chat sessions and ensures compliance with traceability standards.
This commit is contained in:
+1
-1
@@ -394,7 +394,7 @@ def chat_stream_api(
|
||||
"""流式对话(方案 C):与 POST "" 同守卫,逐块推送 LLM 文本。"""
|
||||
agent_type, message = _guard_request(req, request, auth)
|
||||
sid, customer_id = _prepare_turn(req, auth, agent_type)
|
||||
trace_id = current_trace() or ""
|
||||
trace_id = current_trace() or new_trace()
|
||||
has_disclaimer = agent_service.needs_disclaimer(agent_type)
|
||||
history = memory_service.get_recent(agent_type, sid)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user