Skip to content

feature :: Update chat UI to use Vercel AI SDK + OpenAI support#137

Closed
jjjorgenson wants to merge 2 commits intoreplicatedhq:mainfrom
jjjorgenson:main
Closed

feature :: Update chat UI to use Vercel AI SDK + OpenAI support#137
jjjorgenson wants to merge 2 commits intoreplicatedhq:mainfrom
jjjorgenson:main

Conversation

@jjjorgenson
Copy link
Copy Markdown

  • Replace custom chat implementation with Vercel AI SDK for improved streaming and provider flexibility
  • Add /api/chat streaming endpoint using AI SDK Core's streamText
  • Add AIChatContainer component using useChat hook from @ai-sdk/react
  • Support easy switching between Anthropic and OpenAI via environment variables

Changes

  • New API Route: /api/chat with streaming and tool support
  • New Components: AIChatContainer, useChartsmithChat hook
  • Provider Abstraction: lib/llm/provider.ts for LLM switching
  • System Prompts: TypeScript port matching Go pkg/llm/system.go
  • Message Adapter: Convert between DB messages and AI SDK format
  • Middleware Fix: Return 401 for unauthenticated API requests
  • Feature Flag: USE_AI_SDK_CHAT=true enables new chat

jjjorgenson and others added 2 commits December 12, 2025 11:41
Replace custom chat implementation with Vercel AI SDK for improved
streaming and provider flexibility.

Changes:
- Add /api/chat streaming endpoint using AI SDK Core streamText
- Add AIChatContainer component using useChat hook
- Add provider abstraction for easy Anthropic/OpenAI switching
- Port system prompts from Go to TypeScript
- Add message adapter for DB to AI SDK format conversion
- Add tool support (getLatestSubchartVersion, getLatestKubernetesVersion)
- Fix middleware to return 401 for unauthenticated API requests
- Add USE_AI_SDK_CHAT feature flag for gradual rollout
- Add unit tests for message adapter
- Add Playwright API tests for /api/chat

The existing Centrifugo-based chat for plans/renders is preserved.
Set USE_AI_SDK_CHAT=true to enable the new streaming chat.
@marccampbell
Copy link
Copy Markdown
Member

Closing duplicate AI SDK migration attempt - consolidated elsewhere

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants