Feat/LLM chat #29
Conversation
|
@1amKhush is attempting to deploy a commit to the ContextVM's projects Team on Vercel. A member of the Team first needs to authorize it. |
There was a problem hiding this comment.
Pull request overview
Implements Phase 1 of an in-browser LLM chat workspace at /chat, including provider/model selection, OpenRouter "Auto free models" rotation, streaming responses via the OpenAI SDK in the browser, IndexedDB-backed conversation persistence, and a new Shadcn-style sidebar primitive set.
Changes:
- Adds chat UI (
Chat,ChatInput,ChatBubble, sidebar with conversation list, settings sheet with provider/model/key comboboxes) and a top-nav entry. - Adds client-side services:
LLMService(OpenAI SDK withdangerouslyAllowBrowser),FreeModelRotatorfor OpenRouter:freerotation on 429s, and an IndexedDB conversation store with reactive$state. - Adds new generic UI primitives (sidebar, popover, command, scroll-area) and the
openaidependency; ships a hardcoded "default" OpenRouter API key for zero-config use.
Reviewed changes
Copilot reviewed 51 out of 52 changed files in this pull request and generated 7 comments.
Show a summary per file
| File | Description |
|---|---|
| src/routes/chat/+page.svelte, +page.ts | New chat route, wires sidebar/header/config/Chat. |
| src/lib/types/chat-types.ts | Shared chat types, provider presets, and the hardcoded default OpenRouter key. |
| src/lib/services/llm.ts | OpenAI SDK wrapper with streaming, base URL normalization, and free-model fallback. |
| src/lib/services/auto-mode.ts | Free-model fetching, caching, rate-limit detection, and round-robin rotation. |
| src/lib/services/conversation-store.svelte.ts | IndexedDB-backed conversation CRUD and reactive store. |
| src/lib/components/chat/* | Chat UI: Chat, ChatBubble, ChatInput, ChatSidebar, ConversationList, LLMConfig, ProviderCombobox, ModelCombobox, AutoModeBanner. |
| src/lib/components/ui/sidebar/* | New sidebar primitive set (provider/context/root/header/footer/menu/etc.). |
| src/lib/components/ui/popover/, command/, scroll-area/* | New UI primitives consumed by the chat settings and conversation list. |
| src/lib/components/header.svelte | Adds Chat link to desktop and mobile navs. |
| package.json, bun.lock | Adds openai@^4.0.0 and its transitive deps. |
| .changeset/chat-phase-one.md | Minor changeset entry. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
115bd28 to
1ab7bfa
Compare
|
Great, the error are gone, but I'm not able to receive a response when writing a message, tested with the auto mode, with another model, and with my own key. Nothing happens |
I'll have a look (did test before and it seemed to work) |
|
I cannot get it to work. Tested in the vercel deployment and in my own dev enviroment. But nothing happens, I send a message to the chat an there is no loading or nothing, also nothing in the console |
…t OpenAI SDK crashes
Honestly was a very small issue, Svelte’s The fix was simple, i stored those objects as normal |
…e to prevent infinite hydration loops
|
@ContextVM-org Up for review |
|
I reviewed the PR in detail, and overall I think it is in a good state. The feature works, the UX is strong, and the implementation shows good attention to streaming behavior, persistence, and cancellation. I do think there are a few places where I’d ask for cleanup before giving it a full green light, mostly around simplification and reducing future maintenance cost. SummaryI’m generally positive on this PR. The main chat flow, auto-mode behavior, IndexedDB persistence, and UI composition all look solid. My concern is not that the code is broken, but that some parts are more complex than they need to be, and that complexity will make Phase 2 harder to extend. What I like
Main concerns1.
|
…anup) - Simplify handleSend with Svelte 5 in-place array mutation - Remove fragile skipLoadId pattern - Centralize auto-mode boolean helpers - Standardize conversation-store using waitForTransaction - Extract ModelCombobox fetching from LLMService instantiation - Add robust try/catch blocks for missing async operations

Description
Resolves #26 - LLM chat integration
This PR implements Phase 1 of the ContextVM web chat interface. It provides a robust, zero-friction LLM experience for users out of the box, alongside full Bring-Your-Own-Token (BYOT) support and IndexedDB conversation persistence.
Key Features
:freesuffix, and automatically rotates through free models if a429Rate Limit is encountered./v1/modelsendpoint. Features an "Auto (free models)" mode pinned to the top for OpenRouter.mcpClientServicesingleton.Technical Notes
src/lib/types/chat-types.ts,src/lib/services/llm.ts,src/lib/services/auto-mode.ts, andsrc/lib/components/chat/.openaiSDK is used under the hood configured withdangerouslyAllowBrowser: trueas this is entirely a client-side execution.Testing