feat: Ollama Cloud chat interface with official SDK, DB-stored config, and AI settings dashboard#361
feat: Ollama Cloud chat interface with official SDK, DB-stored config, and AI settings dashboard#361
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
- Add ChatMessage model to Prisma schema with user scoping - Create database migration for chat_messages table - Add /chat to protected paths in middleware.ts - Add AI Chat link to sidebar navigation - Create /api/chat/ollama API route with streaming, auth, and input sanitization - Create /api/chat/history API route for loading/clearing chat history - Create /chat page with server-side auth and sidebar layout - Create ChatInterface and ChatMessage client components - Add chat types definitions - Add Ollama env vars to .env.example - Add CHAT_SETUP.md documentation - All type-check, lint, and build pass successfully Co-authored-by: syed-reza98 <71028588+syed-reza98@users.noreply.github.com>
…n (CodeQL fix) Co-authored-by: syed-reza98 <71028588+syed-reza98@users.noreply.github.com>
|
Review the whole repository codebase of https://github.com/ollama/ollama-js/tree/main and all the documentation from https://docs.ollama.com |
|
@copilot Review the whole repository codebase of https://github.com/ollama/ollama-js/tree/main and all the documentation from https://docs.ollama.com |
Add Vercel composition-patterns SKILL.md and a comprehensive vercel-react-best-practices AGENTS.md (large performance & best-practices guide). Propagate SKILL/AGENTS files across multiple agent/provider namespaces (e.g., .adal, .augment, .codebuddy, .cortex, etc.). Remove older per-agent rule files from .agents/.claude/.claude/... that are now consolidated. Also add marketing assets (marketing/ad-10-1taka HTML pages and video files) and a script (scripts/record-marketing-video.mjs).
…g mode - POST /api/settings/ai/test: test Ollama connectivity, returns models & latency - GET /api/chat/models/[name]: fetch model details via SDK show() - Chat interface: stop generation button with AbortController - Chat API: support think param for reasoning models - AI Settings: Test Connection button with success/error feedback - Updated docs with all new API endpoints and features Co-authored-by: syed-reza98 <71028588+syed-reza98@users.noreply.github.com>
Implemented the ollama-js SDK integration with full Ollama Cloud support in commit Official
DB-stored configuration (no .env required)
AI Settings page (
New API endpoints
Chat interface enhancements
Ollama Cloud features that can be integrated in future
All code is TypeScript, all routes are session-authenticated, build/lint/type-check pass with 0 errors.
Addressed in commit |
|
Automated review (GitHub Models): This pull request implements all major objectives, requirements, and acceptance criteria from the original issue for a fully authenticated Ollama Cloud chat interface, including a protected route, secure backend integration, data persistence, per-user configuration, and documentation. Multiple files directly match feature descriptions, indicating thorough resolution. Confidence: 0.95 Evidence:
|
|
@copilot Visit this 2 repo below: Navigate all the documentation files and go through all of them properly. List down all the Ollama Cloud API related documentation and implementation using Next.js 16 with App Router, Typescript, Shadcn for this multi tenant SaaS platform. Don’t skip any documentation. Save all of your research and findings in a .md file |
…ollama repos Co-authored-by: syed-reza98 <71028588+syed-reza98@users.noreply.github.com>
Created Sources reviewed:
Document covers:
|
Adds a protected
/chatroute with a streaming LLM chat interface backed by Ollama Cloud via the officialollamanpm SDK (v0.6.3). Messages are persisted per-user in PostgreSQL via a newChatMessagemodel. Ollama credentials and configuration are stored in the database (encrypted) and manageable from a dashboard settings page, with env-var fallback.Schema
ChatMessagemodel withChatMessageRoleenum (USER/ASSISTANT), indexed on(userId, createdAt), cascade-deletes withUserOllamaConfigmodel for per-user DB-stored configuration: host URL, API key (AES-256-CBC encrypted), model name, system prompt, temperature20260315000000_add_chat_messages,20260315001000_add_ollama_configOfficial Ollama SDK Integration (
src/lib/ollama.ts)ollamanpm package with full TypeScript typeshost=https://ollama.com, ****** auth) and local instancesclient.chat({ stream: true })), model listing (client.list()), model details (client.show()), connection testingAPI Routes
POST /api/chat/ollama— session-authenticated, streams Ollama responses via SDK +ReadableStream, persists both sides of the conversation. Supportsthinkparameter for reasoning models. Iterative HTML sanitization and 4K char input cap.GET /api/chat/history— returns last 100 messages for the authenticated userDELETE /api/chat/history— clears user's chat historyGET /api/chat/models— lists available models from configured Ollama instance viaclient.list()GET /api/chat/models/[name]— fetches detailed model info viaclient.show()GET /api/settings/ai— returns user's AI configuration (API key masked)PUT /api/settings/ai— updates AI configuration with encrypted API key storagePOST /api/settings/ai/test— tests Ollama connectivity, returns available models and latencyUI
/chatpage with server-side auth gate, sidebar layout matching existing dashboard pagesChatInterfaceclient component: optimistic message rendering, token-by-token streaming, model selector dropdown, stop generation button (AbortController), loading/error states, keyboard shortcuts (Enter to send, Shift+Enter for newline), link to AI SettingsChatMessagecomponent with triple-backtick code block rendering/settings/aipage with form for host URL, API key, model, system prompt, temperature, Cloud/Local toggle, and Test Connection button with success/error feedbackAuth & Security
/chatadded toprotectedPathsin middlewaresession.user.id; all DB queries scoped to userIdsrc/lib/encryption.ts<scr<script>ipt>)Navigation
app-sidebar.tsxwithIconMessageChatbotIconSettingsAutomationConfig
OLLAMA_API_URL,OLLAMA_MODEL, andOLLAMA_API_KEYadded to.env.exampledocs/CHAT_SETUP.mdcovering Cloud API setup, all endpoints, and SDK featuresExtensibility
ChatMessagemodel accepts an optionalorganizationIdfor future multi-tenant scopingOllamaConfigmodel is per-user, ready for org-level config sharingthinkparameter support for reasoning models (e.g., DeepSeek R1)Original prompt
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.