Codapult
ЦеныПлагиныБлогДокументацияДемо

SaaS-бойлерплейт для разработчиков

© 2026 Codapult. Все права защищены.

Сделано на Codapult

Проект

  • Цены
  • Плагины
  • Документация
  • Сравнение SaaS-шаблонов

О нас

  • Контакты

Правовая информация

  • Политика конфиденциальности
  • Условия использования
Все статьи

Getting Started

  • Introduction
  • Quick Start
  • Project Structure
  • License and Permitted Use

Configuration

  • Environment Variables
  • App Configuration

Authentication

  • Authentication
  • OAuth Providers
  • Two-Factor & Passwordless
  • Enterprise SSO (SAML)

Database

  • Database
  • Migrations

Teams

  • Teams & Organizations
  • Permissions & RBAC
  • SCIM Provisioning

Payments

  • Payments & Billing
  • Stripe Setup
  • LemonSqueezy Setup
  • Polar Setup
  • Payment Webhooks

Api

  • API Layer
  • tRPC
  • GraphQL

Ai

  • AI Features
  • Streaming Chat
  • RAG and Semantic Search
  • Quotas and Memory

Email

  • Email
  • Email Templates

Infrastructure

  • Infrastructure
  • Self-Hosting
  • File Storage
  • Docker
  • Background Jobs
  • Terraform & Pulumi
  • Kubernetes

Ui

  • UI & Theming

I18n

  • Internationalization

Content Management

  • Content Management

Admin

  • Admin Panel

Security

  • Security

Monitoring

  • Analytics & Monitoring

Modules

  • Module Architecture
  • Waitlist
  • Audit Log
  • White-Labeling
  • Workflow Automation
  • A/B Testing
  • Welcome Page
  • Referrals
  • GDPR Export and Deletion
  • Outgoing Webhooks

Plugins

  • Plugin System
  • AI Kit Plugin
  • CRM Plugin
  • Helpdesk Plugin
  • Email Marketing Plugin

Deployment

  • Deployment
  • Troubleshooting

Upgrading

  • Upgrading Codapult

Developer Tools

  • AI Agents & IDEs
  • MCP Server
  • Testing
Ai

Streaming Chat

How the built-in AI chat uses Vercel AI SDK, model adapters, streaming responses, and tools.

Codapult includes a working AI chat surface, not just provider configuration. The module combines a dashboard chat UI, persisted conversations, a streaming API route, provider adapters, model selection, organization quotas, and optional RAG context injection.

Runtime flow

  1. The user sends a message from src/components/ai/ChatUI.
  2. POST /api/chat authenticates the session and validates the request.
  3. The route checks rate limits and organization AI quota.
  4. The selected model is resolved through src/lib/ai/providers.ts.
  5. RAG context is retrieved when enabled and appended to the system prompt.
  6. The response streams back through the Vercel AI SDK.
  7. Conversation and message rows are persisted for history.

Key files

FilePurpose
src/app/api/chat/route.tsStreaming chat endpoint
src/components/ai/ChatUIDashboard chat experience
src/lib/ai/models.tsClient-safe model list
src/lib/ai/providers.tsProvider/model resolver
src/lib/ai/conversations.tsConversation and message persistence
src/lib/ai/rag.tsOptional retrieval context

Models

Models are declared in src/lib/ai/models.ts. Each entry has an ID, label, and provider. src/lib/ai/providers.ts maps that ID to a provider-backed language model.

To restrict the UI to a subset of models, set appConfig.ai.allowedModels in src/config/app.ts. An empty array means every model in models.ts is available.

Tool calls

The chat route supports Vercel AI SDK tool calls. Add product-specific tools in /api/chat/route.ts with a Zod parameter schema and an execute function. Keep tools small and domain-specific: lookup a record, update a workflow, fetch a report, or call an internal service.

Configuration

SettingLocation
Default modelappConfig.ai.defaultModel
System promptappConfig.ai.systemPrompt
Allowed modelsappConfig.ai.allowedModels
OpenAI keyOPENAI_API_KEY
Anthropic keyANTHROPIC_API_KEY

Related docs

  • RAG and Semantic Search
  • Quotas and Memory
  • Environment Variables
AI FeaturesRAG and Semantic Search