Files
AgenticCode/openspec/changes/archive/2026-04-06-email-upload-ux/proposal.md
local 5b027eb0db feat: add extraction schema, sidebar nav, few-shot prompting, and prompt settings
Overhaul extraction pipeline with new TradeItem model, conversation flow,
and dedicated extraction endpoint. Add sidebar navigation with NavMenu
component and landing page. Introduce few-shot prompting service and
tests. Add prompt settings and email upload specs. Update OpenSpec
tooling with improved export-spec and extract-feature commands. Archive
completed changes and export full specs.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-06 23:39:23 +01:00

2.1 KiB

Why

The extraction agent and few-shot prompting infrastructure exist on the backend, but the chat UI has no way to send emails to the extraction endpoint. Users need to drag-and-drop or upload email files (.html) to trigger extraction. The client must route email uploads to POST /api/chat/extract and handle the conversational extraction flow, including disambiguation questions from the agent and result presentation.

What Changes

  • Add drag-and-drop zone to Chat.razor that accepts email files (.html)
  • Add file picker button as an alternative upload method
  • Route uploaded emails to the extraction endpoint via ChatApiClient.SendExtractionStreamingAsync()
  • Handle extraction conversation flow — initial extraction streams in, user can reply to disambiguation questions, follow-ups continue via the extraction endpoint
  • Present extraction results — the agent's streamed response includes formatted output; optionally add a "Copy JSON" action
  • Track conversation mode — after an email upload, subsequent messages route to the extraction endpoint until "New Chat" resets to general mode

Capabilities

New Capabilities

  • email-upload: Defines the drag-and-drop upload zone, file handling, visual feedback, and supported formats
  • extraction-conversation-flow: Defines the client-side conversation mode tracking, routing between general chat and extraction, and result presentation

Modified Capabilities

  • chat-ui: Add the upload zone to the chat input area and track conversation mode (general vs extraction)

Impact

  • UI changes: New drop zone and upload button in Chat.razor, visual feedback during drag-over
  • Chat.razor.css: Styling for drop zone states (idle, drag-over, uploading)
  • ChatApiClient: Already has SendExtractionStreamingAsync from the previous change — this change wires it to the UI
  • Conversation state: New _isExtractionMode flag in Chat.razor to route messages correctly
  • Depends on: update-extraction-schema and few-shot-prompt-infrastructure (extraction endpoint must exist)