6ede33ccdb
Build and Push Docker Images / create_manifest (web, surfsense-web, , cpu) (push) Has been cancelled
Build and Push Docker Images / finalize_release (push) Has been cancelled
Obsidian Plugin Lint / lint (push) Has been cancelled
Build and Push Docker Images / build (./surfsense_web, cpu, ./surfsense_web/Dockerfile, web, surfsense-web, ubuntu-24.04-arm, linux/arm64, arm64, , runner, false, cpu) (push) Has been cancelled
Build and Push Docker Images / build (./surfsense_web, cpu, ./surfsense_web/Dockerfile, web, surfsense-web, ubuntu-latest, linux/amd64, amd64, , runner, false, cpu) (push) Has been cancelled
Build and Push Docker Images / compute_version (push) Has been cancelled
Build and Push Docker Images / build (./surfsense_backend, cpu, ./surfsense_backend/Dockerfile, backend, surfsense-backend, ubuntu-24.04-arm, linux/arm64, arm64, , production, false, cpu) (push) Has been cancelled
Build and Push Docker Images / build (./surfsense_backend, cpu, ./surfsense_backend/Dockerfile, backend, surfsense-backend, ubuntu-latest, linux/amd64, amd64, , production, false, cpu) (push) Has been cancelled
Build and Push Docker Images / build (./surfsense_backend, cu126, ./surfsense_backend/Dockerfile, backend, surfsense-backend, ubuntu-24.04-arm, linux/arm64, arm64, -cuda126, production, true, cuda126) (push) Has been cancelled
Build and Push Docker Images / build (./surfsense_backend, cu126, ./surfsense_backend/Dockerfile, backend, surfsense-backend, ubuntu-latest, linux/amd64, amd64, -cuda126, production, true, cuda126) (push) Has been cancelled
Build and Push Docker Images / build (./surfsense_backend, cu128, ./surfsense_backend/Dockerfile, backend, surfsense-backend, ubuntu-24.04-arm, linux/arm64, arm64, -cuda, production, true, cuda) (push) Has been cancelled
Build and Push Docker Images / build (./surfsense_backend, cu128, ./surfsense_backend/Dockerfile, backend, surfsense-backend, ubuntu-latest, linux/amd64, amd64, -cuda, production, true, cuda) (push) Has been cancelled
Build and Push Docker Images / verify_digests (push) Has been cancelled
Build and Push Docker Images / create_manifest (backend, surfsense-backend, , cpu) (push) Has been cancelled
Build and Push Docker Images / create_manifest (backend, surfsense-backend, -cuda, cuda) (push) Has been cancelled
Build and Push Docker Images / create_manifest (backend, surfsense-backend, -cuda126, cuda126) (push) Has been cancelled
46 lines
2.1 KiB
Python
46 lines
2.1 KiB
Python
"""Per-turn streaming state shared between the orchestrator and event loop."""
|
|
|
|
from __future__ import annotations
|
|
|
|
from dataclasses import dataclass, field
|
|
from typing import Any
|
|
|
|
|
|
@dataclass
|
|
class StreamResult:
|
|
accumulated_text: str = ""
|
|
is_interrupted: bool = False
|
|
sandbox_files: list[str] = field(default_factory=list)
|
|
request_id: str | None = None
|
|
turn_id: str = ""
|
|
filesystem_mode: str = "cloud"
|
|
client_platform: str = "web"
|
|
intent_detected: str = "chat_only"
|
|
intent_confidence: float = 0.0
|
|
write_attempted: bool = False
|
|
write_succeeded: bool = False
|
|
verification_succeeded: bool = False
|
|
commit_gate_passed: bool = True
|
|
commit_gate_reason: str = ""
|
|
# Pre-allocated assistant ``new_chat_messages.id`` for this turn, captured by
|
|
# ``persist_assistant_shell`` right after the user row is persisted. ``None``
|
|
# for the legacy/anonymous code paths that don't opt in to server-side
|
|
# ``ContentPart[]`` projection.
|
|
assistant_message_id: int | None = None
|
|
# In-memory mirror of the FE's assistant-ui ``ContentPartsState``, populated
|
|
# by the lifecycle methods called from the streaming event loop at each
|
|
# ``streaming_service.format_*`` yield site. Snapshot in the streaming
|
|
# ``finally`` to produce the rich JSONB persisted by
|
|
# ``finalize_assistant_turn``. ``repr=False`` keeps the log-on-error path
|
|
# (``StreamResult`` is logged in some error branches) from dumping a
|
|
# potentially-large parts list.
|
|
content_builder: Any | None = field(default=None, repr=False)
|
|
# User-visible assistant message parts derived from the final LangGraph
|
|
# state. Used after streaming completes as a provider-agnostic persistence
|
|
# backfill when no text chunks reached the live stream.
|
|
final_message_parts: list[dict[str, Any]] = field(default_factory=list)
|
|
# Per-conversation citation registry captured from the final LangGraph state
|
|
# (a ``CitationRegistry`` or its serialized dict). Read at finalize to rewrite
|
|
# the model's ``[n]`` ordinals into ``[citation:<payload>]`` markers.
|
|
citation_registry: Any | None = field(default=None, repr=False)
|