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>
2.7 KiB
2.7 KiB
1. Drag-and-Drop Infrastructure
- 1.1 Add JS interop function for drag-and-drop file reading — a small JS function that listens for
dragover/dropevents on a given element, reads the dropped file as text, and invokes a .NET callback with the filename and content - 1.2 Add the JS interop script to
wwwroot/index.htmlor a separate.jsfile referenced there - 1.3 Wire the drag-and-drop JS interop to the
.message-listelement in Chat.razor — register onOnAfterRenderAsync, dispose on component disposal
2. File Upload Button
- 2.1 Add
MudIconButtonwith attachment icon next to the send button in the input area - 2.2 Add hidden
InputFilecomponent accepting.htmlfiles, triggered by the icon button click - 2.3 Handle
InputFile.OnChange— read the selected file content as string, trigger extraction
3. Drop Zone Visual Feedback
- 3.1 Add
_isDragOverboolean state to Chat.razor, toggled by dragenter/dragleave events from JS interop - 3.2 Add CSS class
.drag-overto.message-listwhen_isDragOveris true — highlighted border, subtle overlay with "Drop email here" text - 3.3 Add
.drag-overstyles to Chat.razor.css
4. Extraction Mode and Routing
- 4.1 Add
_isExtractionModeboolean and_emailHtmlstring fields to Chat.razor - 4.2 When an email file is read (via drop or file picker): set
_isExtractionMode = true, store email HTML in_emailHtml, add a user message showing "[Uploaded: filename.html]" - 4.3 Create
SendExtractionMessage()method — buildsExtractionRequestwith_emailHtmland conversation messages, callsChatApiClient.SendExtractionStreamingAsync(), streams response into assistant message (same pattern asSendMessage()) - 4.4 Modify
SendMessage()— if_isExtractionMode, buildExtractionRequestwith_emailHtml+ all messages and call the extraction endpoint instead of the chat endpoint - 4.5 On file drop/upload: call
SendExtractionMessage()for the initial extraction - 4.6 Modify
NewChat()to reset_isExtractionMode = falseand_emailHtml = ""
5. Extraction Mode Indicator
- 5.1 Add a
MudChipor small banner below the tab header showing "Extraction Mode" when_isExtractionModeis true - 5.2 Style the indicator in Chat.razor.css
6. Guard Rails
- 6.1 Reject non-.html files in both drop handler and InputFile handler — show a snackbar or inline message
- 6.2 Disable drop zone and file picker during streaming (
_isStreamingflag)
7. Build and Verify
- 7.1 Build the solution (
dotnet build) and confirm no compilation errors - 7.2 Run all tests (
dotnet test) and confirm they pass