feat: migrate chat backend to Semantic Kernel with tool calling support
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>
This commit is contained in:
@@ -63,13 +63,32 @@ The chat page SHALL show a visual indicator while waiting for the first token fr
|
||||
|
||||
### Requirement: Streaming AI response
|
||||
|
||||
The assistant SHALL reply with a real AI response streamed from the backend API. Tokens appear incrementally as they arrive.
|
||||
The assistant SHALL reply with a real AI response streamed from the backend API, using the full conversation history as context. Tokens appear incrementally as they arrive.
|
||||
|
||||
#### Scenario: Bot replies with streamed AI response
|
||||
|
||||
- **WHEN** the user sends any message
|
||||
- **THEN** the assistant message appears and grows token by token as the stream delivers text
|
||||
|
||||
#### Scenario: Full history sent with each request
|
||||
|
||||
- **WHEN** the user sends a message after prior exchanges
|
||||
- **THEN** all previous user and assistant messages are included in the API request so the AI has conversational context
|
||||
|
||||
### Requirement: New chat button
|
||||
|
||||
The chat page SHALL provide a button to clear the current conversation and start a new one.
|
||||
|
||||
#### Scenario: User starts a new chat
|
||||
|
||||
- **WHEN** the user clicks the "New Chat" button
|
||||
- **THEN** all messages are cleared and the empty state is shown
|
||||
|
||||
#### Scenario: New chat button disabled during streaming
|
||||
|
||||
- **WHEN** the assistant is currently streaming a response
|
||||
- **THEN** the "New Chat" button is disabled
|
||||
|
||||
### Requirement: Auto-scroll
|
||||
|
||||
The message list SHALL automatically scroll to the newest message when a new message is added.
|
||||
|
||||
Reference in New Issue
Block a user