### Bugfixes — Agent Chat 'Думаю' State Leak - fix(agent-chat): loadHistory() now resets streamingState/idle + cancels stale submission — prevents 'Думаю' state leak across conversation switches - fix(agent-chat): onDisconnected/onDisconnectedPermanent cascade to streamingState — prevents permanent hang on connection loss during stream - fix(agent-chat): guard on isLoadingHistory — prevents false commit of 'agent unavailable' fallback when switching conversations - fix(agent-chat): remove race in _sendNow empty-response check vs Svelte microtask (duplicate logic removed, handles correctly) - fix(stream-processor): confirm_resolved now appends msg.text to partialText instead of dropping it ### Bugfixes — Backend PDF Upload - fix(document-parser): _detect_format_by_magic() — reads file header magic bytes as fallback when Gradio loses filename - fix(document-parser): improved name extraction — tries orig_name, path stem - fix(document-parser): @RELATION AgentChatTypes -> AgentChat.Types ### HITL Flow & Agent Chat Improvements - feat(agent): HITL resume confirm/deny with userId/userJwt/envId propagation - feat(agent): confirm_required metadata fallback via aget_state() after 'Event loop is closed' error during interrupt - feat(agent): interrupt_before re-enabled via AGENT_CONFIRM_TOOLS env var - feat(frontend): debug panel with connection/stream state monitoring - feat(frontend): AgentChatModel constructor options + onBeforeSend callback - feat(frontend): crypto.randomUUID() for local conversation ID on first send ### Backend Agent Refactoring - refactor(agent): langgraph_setup — monkey-patch for PydanticSerializationError - refactor(agent): tools.py — dual identity headers, expanded tool set - refactor(agent): run.py — _find_free_port, Gradio server port fallback - refactor(agent): app.py — file size validation, message truncation, HITL path ### Frontend - feat(dashboard-hub): DashboardHubModel with filters, pagination, git actions - feat(ui): DateRangeFilter component - feat(i18n): new dashboard keys; cache tooltips fix - fix(i18n): full run tooltips — cache is NOT ignored ### Semantic Protocol - chore(agents): update all agents with canonical format - chore(skills): sync semantics-core, semantics-contracts, molecular-cot-logging ### Housekeeping - chore: remove stale semantic reports (10 files, Jan 2026) - chore: update 033-gradio-agent-chat specs, contracts, UX, tasks, tests - chore: add .agents/ directory (mirrors .opencode/ agent layouts) - chore: update run.sh with DEV_MODE, port management
1.8 KiB
#region AgentChat.UxReference [C:3] [TYPE ADR] [SEMANTICS ux,reference,agent-chat,final]
@BRIEF Final UX reference — Gradio submit(), LangChain v1 HITL, structured metadata, Archive UX.
1. Persona
Platform operator in superset-tools Svelte interface. Opens chat (drawer or /agent page). Streams responses, confirms dangerous ops via inline card, uploads files for analysis.
2. Happy Path
submit("/chat", {message}, conversation_id). Tokens stream in real time. Tool cards appear from structured metadata. Confirmation card for dangerous ops — Confirm via second submit(). Archive conversations via delete (soft-delete).
3. Key Elements
- Input: Textarea + paperclip (PDF/XLSX/JSON/CSV/PNG/JPEG)
- Streaming: Text character-by-character. Tool cards from
metadata.type. - Stop:
submission.cancel()— native. - Confirmation: Warning card from
metadata.type="confirm_required". Confirm → secondsubmit(). - Debug reference:
/agentheader toggle showsconv_id, pendingthread_id, connection/streaming state, env/user, message count, last message id, active tool calls, and current error. Copy exports JSON. - Conversation Switcher: Search, date-grouped, infinite scroll.
- Connection: Green/red dot.
4. Error Scenarios
- Gradio down: Dot red, retry 5×5s.
- LLM error: Stream
metadata.type="error"→ card + retry. - Tool failure:
metadata.type="tool_error"→ cross + detail. - File parse: Error chip: "Не удалось прочитать".
- Multi-tab: REST gate rejects second tab.
5. Gradual Transition
Phase 1: Gradio + Svelte submit(). Phase 2: Agent tools moved to native LangChain @tool; old registry → @DEPRECATED. Phase 3: REST preserved (FR-022).
#endregion AgentChat.UxReference