Replace manual HTTP proxy in ChatController with Semantic Kernel's OpenAI chat completion service pointed at CLIProxyAPI. Add extraction plugin with validation function for structured field extraction from natural language, enabling an agentic loop with auto-retry and human-in-the-loop escalation. - Add Microsoft.SemanticKernel 1.74.0 with OpenAI connector - Create ExtractedFields schema and ValidationResult models - Create ExtractionPlugin with [KernelFunction] validation - Rewrite ChatController to use IChatCompletionService streaming - Configure FunctionChoiceBehavior.Auto() for tool calling - Preserve existing SSE contract (client unchanged) - Update tests to mock SK services, add plugin and integration tests - Archive multi-turn-conversations and migrate-to-semantic-kernel changes - Sync specs for agent-extraction, semantic-kernel-integration, chat-streaming Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
31 lines
1.4 KiB
Markdown
31 lines
1.4 KiB
Markdown
## Context
|
|
|
|
Chat.razor currently constructs a `ChatRequest` with only the latest user message (line 161-164). The backend and Responses API already support multi-message input — no server changes needed. This is purely a client-side change.
|
|
|
|
## Goals / Non-Goals
|
|
|
|
**Goals:**
|
|
- Send full conversation history with each request for multi-turn context
|
|
- Add a "New Chat" button to reset the session
|
|
|
|
**Non-Goals:**
|
|
- Persistent conversation storage (explicitly deferred)
|
|
- Multiple conversation tabs/sidebar
|
|
- Token limit management or history truncation (small conversations for now)
|
|
|
|
## Decisions
|
|
|
|
### Decision 1: Send full _messages list minus the empty placeholder
|
|
|
|
When building the `ChatRequest`, include all messages from `_messages` except the last one (which is the empty assistant placeholder waiting for streaming). This gives the AI the full conversation context.
|
|
|
|
### Decision 2: New Chat button in the AppBar
|
|
|
|
Place a "New Chat" icon button in the `MudAppBar` (in MainLayout.razor or Chat.razor). Clicking it clears `_messages` and resets to the empty state. Disabled during streaming.
|
|
|
|
Alternative considered: putting it in the input area. Rejected — the AppBar is more natural and matches ChatGPT/Gemini placement.
|
|
|
|
## Risks / Trade-offs
|
|
|
|
- [No token limit management] → For long conversations, the full history could exceed the model's context window. Acceptable for now; truncation can be added later.
|