Files
AgenticCode/openspec/changes/archive/2026-04-04-multi-turn-conversations/specs/chat-ui/spec.md
local 471e9ce935 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>
2026-04-04 23:59:13 +01:00

1.1 KiB

MODIFIED Requirements

Requirement: Streaming AI response

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

ADDED Requirements

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