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,20 @@
|
||||
## MODIFIED Requirements
|
||||
|
||||
### Requirement: Chat endpoint proxies to Responses API
|
||||
|
||||
The API backend SHALL expose `POST /api/chat` that accepts a `ChatRequest` containing messages, an optional system prompt, and optional model settings. The request is processed using a Semantic Kernel chat completion service. When a system prompt is provided, it SHALL be added as the first system message in the ChatHistory. When model settings are provided, non-null values SHALL be applied to the execution settings.
|
||||
|
||||
#### Scenario: Successful chat request with system prompt
|
||||
|
||||
- **WHEN** the client sends a POST to `/api/chat` with messages and a system prompt
|
||||
- **THEN** the API creates a ChatHistory with the system prompt as the first message, followed by the conversation messages, and processes them through Semantic Kernel
|
||||
|
||||
#### Scenario: Successful chat request with model settings
|
||||
|
||||
- **WHEN** the client sends a POST to `/api/chat` with messages and model settings (e.g., Temperature=0.3)
|
||||
- **THEN** the API applies the settings to OpenAIPromptExecutionSettings before calling the Semantic Kernel
|
||||
|
||||
#### Scenario: Successful chat request without optional fields
|
||||
|
||||
- **WHEN** the client sends a POST to `/api/chat` with only messages (no system prompt, no settings)
|
||||
- **THEN** the API processes the request with default behavior (no system message, default execution settings)
|
||||
@@ -0,0 +1,15 @@
|
||||
## MODIFIED Requirements
|
||||
|
||||
### Requirement: Chat page is default route
|
||||
|
||||
The chat page SHALL be routed at `/sales-assistant` (or `/` with redirect). The page content SHALL be wrapped in a MudTabs container with the conversation UI in the first tab panel.
|
||||
|
||||
#### Scenario: Page loads with chat tab active
|
||||
|
||||
- **WHEN** the user navigates to the chat page
|
||||
- **THEN** the Chat tab is active showing the message list and input area
|
||||
|
||||
#### Scenario: Chat functionality unchanged
|
||||
|
||||
- **WHEN** the user sends a message from the Chat tab
|
||||
- **THEN** the assistant response streams in exactly as before, with the same SSE contract and rendering behavior
|
||||
@@ -0,0 +1,43 @@
|
||||
## ADDED Requirements
|
||||
|
||||
### Requirement: ModelSettings shared model
|
||||
|
||||
The Shared project SHALL define a `ModelSettings` class with nullable properties: `Temperature` (double?), `TopP` (double?), `MaxTokens` (int?). Null values indicate "use server default".
|
||||
|
||||
#### Scenario: All fields null
|
||||
|
||||
- **WHEN** a ModelSettings instance has all null fields
|
||||
- **THEN** the backend uses Semantic Kernel default values for all parameters
|
||||
|
||||
#### Scenario: Partial override
|
||||
|
||||
- **WHEN** a ModelSettings instance has Temperature set but TopP and MaxTokens null
|
||||
- **THEN** only Temperature is overridden; other parameters use defaults
|
||||
|
||||
### Requirement: System prompt in chat request
|
||||
|
||||
The `ChatRequest` SHALL accept an optional `SystemPrompt` (string?) property. When present and non-empty, the backend SHALL insert it as the first system message in the ChatHistory before user/assistant messages.
|
||||
|
||||
#### Scenario: System prompt provided
|
||||
|
||||
- **WHEN** a ChatRequest includes a non-empty SystemPrompt
|
||||
- **THEN** the ChatHistory starts with a system message containing that text, followed by the conversation messages
|
||||
|
||||
#### Scenario: System prompt absent
|
||||
|
||||
- **WHEN** a ChatRequest has a null or empty SystemPrompt
|
||||
- **THEN** the ChatHistory contains only user and assistant messages (no system message)
|
||||
|
||||
### Requirement: Model settings in chat request
|
||||
|
||||
The `ChatRequest` SHALL accept an optional `Settings` (ModelSettings?) property. When present, the backend SHALL apply non-null values to `OpenAIPromptExecutionSettings` before calling the Semantic Kernel.
|
||||
|
||||
#### Scenario: Temperature override
|
||||
|
||||
- **WHEN** a ChatRequest includes Settings with Temperature = 0.5
|
||||
- **THEN** the OpenAIPromptExecutionSettings.Temperature is set to 0.5
|
||||
|
||||
#### Scenario: No settings provided
|
||||
|
||||
- **WHEN** a ChatRequest has null Settings
|
||||
- **THEN** the backend uses default OpenAIPromptExecutionSettings (only FunctionChoiceBehavior.Auto is set)
|
||||
@@ -0,0 +1,53 @@
|
||||
## ADDED Requirements
|
||||
|
||||
### Requirement: System prompt editor tab
|
||||
|
||||
The chat page SHALL include a "System Prompt" tab with a multi-line text area where the user can enter a system prompt. The system prompt value SHALL persist across tab switches within the same session.
|
||||
|
||||
#### Scenario: User enters a system prompt
|
||||
|
||||
- **WHEN** the user navigates to the System Prompt tab and types text
|
||||
- **THEN** the text is stored in the component state and included in the next chat request
|
||||
|
||||
#### Scenario: System prompt survives tab switch
|
||||
|
||||
- **WHEN** the user enters a system prompt, switches to the Chat tab, then switches back
|
||||
- **THEN** the system prompt text is unchanged
|
||||
|
||||
### Requirement: Model settings tab
|
||||
|
||||
The chat page SHALL include a "Model Settings" tab with controls for Temperature, TopP, and MaxTokens. Each control SHALL display its current value and allow adjustment within valid ranges.
|
||||
|
||||
#### Scenario: Temperature control
|
||||
|
||||
- **WHEN** the user adjusts the Temperature control
|
||||
- **THEN** the value is constrained to 0.0–2.0 and included in the next chat request's settings
|
||||
|
||||
#### Scenario: TopP control
|
||||
|
||||
- **WHEN** the user adjusts the TopP control
|
||||
- **THEN** the value is constrained to 0.0–1.0 and included in the next chat request's settings
|
||||
|
||||
#### Scenario: MaxTokens control
|
||||
|
||||
- **WHEN** the user sets the MaxTokens value
|
||||
- **THEN** the value is constrained to 1–4096 and included in the next chat request's settings
|
||||
|
||||
#### Scenario: Default values
|
||||
|
||||
- **WHEN** the user has not changed any model settings
|
||||
- **THEN** the controls show default values (Temperature: 1.0, TopP: 1.0, MaxTokens: empty/unset) and no overrides are sent to the API
|
||||
|
||||
### Requirement: Tabbed page layout
|
||||
|
||||
The chat page SHALL use MudTabs with three tab panels: "Chat" (the existing conversation UI), "System Prompt" (the prompt editor), and "Model Settings" (the parameter controls).
|
||||
|
||||
#### Scenario: Chat tab is default
|
||||
|
||||
- **WHEN** the page loads
|
||||
- **THEN** the Chat tab is active and the conversation UI is displayed
|
||||
|
||||
#### Scenario: Tab switching
|
||||
|
||||
- **WHEN** the user clicks a different tab
|
||||
- **THEN** the corresponding panel is displayed and the previous panel is hidden but retains its state
|
||||
Reference in New Issue
Block a user