mirror of
https://github.com/jxxghp/MoviePilot.git
synced 2026-11-03 22:04:57 +08:00
fix(agent): expose stable web stream message ids
This commit is contained in:
@@ -290,7 +290,13 @@ def _build_web_agent_event_generator(
|
||||
disconnected = False
|
||||
terminal_sent = False
|
||||
try:
|
||||
yield {"type": "start", "session_id": session_id}
|
||||
yield {
|
||||
"type": "start",
|
||||
"session_id": session_id,
|
||||
# 让前端把本地占位助手段绑定到服务端展示段,后续 steering
|
||||
# 应用事件即可按稳定 ID 定位真实消息边界。
|
||||
"assistant_message_id": assistant_message_ref["message"].get("id"),
|
||||
}
|
||||
while not runtime_stop_state.is_system_stopped:
|
||||
if await is_disconnected():
|
||||
disconnected = True
|
||||
|
||||
@@ -1480,6 +1480,7 @@ def test_web_agent_stream_queues_mid_run_input_into_the_same_assistant_stream():
|
||||
|
||||
assert '"status": "queued"' in second_body
|
||||
assert '"status": "applied"' in first_body
|
||||
assert '"assistant_message_id":' in first_body
|
||||
assert first_body.count('data: {"type": "start"') == 1
|
||||
assert first_body.count('data: {"type": "done"') == 1
|
||||
assert len(instances) == 1
|
||||
|
||||
Reference in New Issue
Block a user