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>
3.1 KiB
3.1 KiB
Context
The chat page currently has a single-panel layout: message list + input. The system prompt is absent (no system message in ChatHistory), and model parameters like temperature use Semantic Kernel defaults. For prompt engineering and debugging, these need to be editable in the UI without restarting the server.
Goals / Non-Goals
Goals:
- Tabbed UI: Chat, System Prompt, Model Settings — all on the same page
- System prompt and model settings sent with each chat request
- Backend applies them to SK's ChatHistory and OpenAIPromptExecutionSettings
- Settings persist in the browser session (survive tab switches, not page reloads)
Non-Goals:
- Persisting settings to disk or server (future — save/load prompt profiles)
- Phase 2 prompt templates and few-shot examples (scoped in proposal, not implemented here)
- Changing the SSE streaming contract
Decisions
Tabbed layout using MudTabs
- Use
MudTabswithMudTabPanelfor each section: Chat, System Prompt, Model Settings - Alternative considered: MudDrawer panels or separate pages. Rejected because tabs keep everything on one page — switching between prompt and chat should be instant with no navigation.
- The Chat tab contains the existing message list and input (unchanged)
- System Prompt tab: a
MudTextFieldwithLines="10"for multi-line editing - Model Settings tab:
MudNumericFieldorMudSliderfor Temperature (0.0–2.0), TopP (0.0–1.0), MaxTokens (1–4096)
Settings sent per-request, not stored server-side
ChatRequestgains optionalSystemPrompt(string?) andSettings(ModelSettings?) properties- Backend treats them as nullable — if absent, defaults apply (no system prompt, SK default temperature)
- This keeps the API stateless and avoids server-side session management
- Alternative considered: Server-side settings endpoint. Rejected — adds complexity for a single-user debugging tool.
ModelSettings as a shared DTO
- New
ModelSettings.csin Shared/Models withTemperature(double?),TopP(double?),MaxTokens(int?) - All fields nullable — only set values override defaults
- Maps directly to
OpenAIPromptExecutionSettingsproperties on the backend
System prompt applied as ChatHistory system message
chatHistory.AddSystemMessage(request.SystemPrompt)as the first entry before user/assistant messages- SK and OpenAI APIs treat the system message as behavioral instructions for the model
Tab state persists in component fields
_systemPromptand_modelSettingsare component-level fields, not per-tab- Switching tabs doesn't reset values (MudTabs preserves panel content by default)
- Values are lost on page refresh — acceptable for a debugging tool
Risks / Trade-offs
- [Tab switch loses scroll position] → MudTabs renders all panels but hides inactive ones, so scroll position in the chat tab is preserved
- [Large system prompts inflate request size] → Acceptable for single-user debugging; no size limit enforced
- [Temperature/TopP interaction] → Standard OpenAI behavior: setting both is allowed but not recommended. Show a note in the UI, don't enforce.