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>
This commit is contained in:
@@ -0,0 +1,47 @@
|
||||
## ADDED Requirements
|
||||
|
||||
### Requirement: Extraction mode tracking
|
||||
|
||||
The chat page SHALL track whether the current conversation is in extraction mode. Extraction mode is entered when an email is uploaded and exited when the user starts a new chat.
|
||||
|
||||
#### Scenario: Enter extraction mode on upload
|
||||
|
||||
- **WHEN** the user uploads an email file
|
||||
- **THEN** the conversation enters extraction mode and subsequent messages are routed to the extraction endpoint
|
||||
|
||||
#### Scenario: Exit extraction mode on New Chat
|
||||
|
||||
- **WHEN** the user clicks "New Chat" while in extraction mode
|
||||
- **THEN** the conversation exits extraction mode and returns to general chat routing
|
||||
|
||||
### Requirement: Extraction mode visual indicator
|
||||
|
||||
The chat page SHALL display a visual indicator when in extraction mode so the user knows their messages are part of an extraction conversation.
|
||||
|
||||
#### Scenario: Indicator shown in extraction mode
|
||||
|
||||
- **WHEN** the conversation is in extraction mode
|
||||
- **THEN** a visual indicator (e.g., chip, banner, or subtitle) is visible showing the extraction context
|
||||
|
||||
#### Scenario: Indicator hidden in general mode
|
||||
|
||||
- **WHEN** the conversation is in general chat mode
|
||||
- **THEN** no extraction indicator is shown
|
||||
|
||||
### Requirement: Follow-up messages route to extraction endpoint
|
||||
|
||||
In extraction mode, text messages typed by the user SHALL be sent to the extraction endpoint with the original email HTML and full conversation history, not to the general chat endpoint.
|
||||
|
||||
#### Scenario: User replies to disambiguation question
|
||||
|
||||
- **WHEN** the agent asks "Which legal entity?" and the user types "1"
|
||||
- **THEN** the client sends an ExtractionRequest with the original email HTML plus all messages (assistant question + user reply) to `POST /api/chat/extract`
|
||||
|
||||
### Requirement: Email upload message in chat
|
||||
|
||||
When an email is uploaded, the chat SHALL display a user message indicating the upload (e.g., showing the filename) before the extraction response streams in.
|
||||
|
||||
#### Scenario: Upload message displayed
|
||||
|
||||
- **WHEN** the user drops "trade_request.html"
|
||||
- **THEN** a user message appears in the chat like "[Uploaded: trade_request.html]" followed by the streaming extraction response
|
||||
Reference in New Issue
Block a user