eve-chat-template:基于 Next.js 的持久化聊天模板项目

eve-chat-template

分支24Tags0

eve Chat Template

Important

This repository is archived and no longer maintained. The maintained eve templates now live in vercel/eve-examples.

A Next.js chat template for eve that starts with password access and browser-persisted chats, then upgrades to Sign in with Vercel, Neon, and Upstash when you need a production multi-user application.

Quick Start

Deploy the starter without provisioning a database or other Marketplace products:

  1. Open the maintained template from vercel/eve-examples.
  2. Enter a strong EVE_CHAT_PASSWORD (16+ characters recommended).
  3. Open the deployed app and enter that password.

Chats and eve session cursors are stored in that browser. They are not shared across browsers or users. Starter mode is intended for one trusted operator: anyone with the password shares the same agent identity.

Deployment Modes

Mode Selected when Authentication Chat persistence
Starter EVE_CHAT_PASSWORD is configured Shared password and secure session cookie Browser localStorage
Production Neon, Upstash, and all Sign in with Vercel variables are configured Sign in with Vercel Neon
Local development Neither mode is configured and next dev is running locally Local development identity Browser localStorage

Production mode takes precedence when its complete environment is present. The app fails closed in a production deployment when neither mode is configured. See Setup and Deployment for the upgrade path.

Getting Started

For the starter and production setup flows, see Setup and Deployment. For the runtime architecture, streaming model, persistence flow, and extension points, see How the Chatbot Works.

Install dependencies with pnpm:

pnpm install

Run locally without additional services:

pnpm dev

To require the same password locally, put this in .env.local:

EVE_CHAT_PASSWORD=<at-least-16-characters>

To upgrade the linked project to production mode, run the setup script. It provisions Neon and Upstash, registers Sign in with Vercel, pulls environment variables, and runs migrations:

./scripts/setup.sh
# Or: ./scripts/setup.sh --scope <team-slug>

Production mode requires:

DATABASE_URL=
BETTER_AUTH_SECRET=
NEXT_PUBLIC_VERCEL_APP_CLIENT_ID=
VERCEL_APP_CLIENT_SECRET=
UPSTASH_REDIS_REST_URL=
UPSTASH_REDIS_REST_TOKEN=
KV_REST_API_URL=
KV_REST_API_TOKEN=

Other optional environment variables:

# Override the app origin for custom production domains.
BETTER_AUTH_URL=

# Enable the hosted Slack channel.
SLACK_CONNECTOR=

Create the optional Slack channel integration:

vercel connect create slack --name eve-chat-template --triggers
vercel connect attach <slack-connector-uid> --triggers --trigger-path /eve/v1/slack --yes

The deploy button does not require Slack. For manual setup, put the returned connector UID in SLACK_CONNECTOR. Local development falls back to slack/eve-chat-template, so a connector created with the name above works without editing agent/.

If the connector is not attached to the linked project, run:

vercel connect attach <connector-uid> --yes
vercel env pull .env.local

Production mode only: create the database tables:

pnpm db:migrate

For production, run migrations with Vercel production env vars:

vercel env run -e production -- pnpm db:migrate

Start the development server:

pnpm dev

What Is Included

  • Text chat with an eve agent through same-origin /eve/v1/* routes
  • Password access with browser-backed chat history by default
  • Optional Better Auth sign-in with Vercel
  • Optional Neon-backed cross-device chat history
  • Optional Upstash Redis rate limiting in production mode
  • Drizzle schema and migrations for production mode under lib/db
  • Saved eve session cursors and event snapshots in either storage mode
  • Sidebar history with delete and new-chat actions
  • Vercel Connect-backed Slack channel route at /eve/v1/slack
  • First-message chat titles derived locally from the user's prompt
  • Streamdown markdown rendering for assistant text and reasoning
  • shadcn/Tailwind components for messages, tools, HITL prompts, and composer

This template intentionally does not include file uploads, Vercel Blob, guest mode, NextAuth/Auth.js, or AI Elements.

Agent Code

Edit the agent in agent/agent.ts. Its behavior is defined in agent/instructions.md, and tools live in agent/tools/.

The browser talks to eve with useEveAgent() from eve/react; the app stores eve stream events and session state so /chat/[id] can resume the same durable conversation after refresh.

项目介绍

eve-chat-template

定制我的领域