This project is based on the assistant-ui starter, created using:
npx assistant-ui@latest createIt extends the starter by adding:
- Chat threads/messages are persisted to Azure Cosmos DB (
threads,messagescontainers). - Azure OpenAI is used for chat responses and auto-title generation.
- Use UUIDv4 for thread IDs when persisting
- Use UUIDv4 for message IDs when persisting
- Fix thread deletion errors (deleting a thread currently triggers an exception).
Caution
Thread IDs are currently stored in a format like __LOCALID_3yHFd1l, and message IDs are stored in a format like f0GjiXG.
- Node.js 18+ (or the version specified in
.nvmrcif present). - Azure subscription with:
- Azure OpenAI resource and a
gpt-4odeployment- You’ll need the deployment name and API key.
- Azure Cosmos DB for NoSQL account with:
- A database (default:
assistant-ui-db) - Containers:
threads(partition key:/id)messages(partition key:/id)
- A database (default:
- Azure OpenAI resource and a
- Copy environment file:
cp .env.example .env.local(or.env)
- Set environment variables:
HTTPS_PROXY: URL of the proxy server for outbound HTTPS requests. (option)AZURE_RESOURCE_NAME: Azure OpenAI resource name (used to build the endpoint).AZURE_API_KEY: Azure OpenAI API key.AZURE_OPENAI_DEPLOYMENT_NAME: Deployment name for the model.AZURE_COSMOS_DB_ENDPOINT: Cosmos DB endpoint URL.AZURE_COSMOS_DB_KEY: Cosmos DB key.AZURE_COSMOS_DB_NAME: Cosmos DB database name (defaults toassistant-ui-db).
- Install dependencies:
pnpm install - Run locally:
pnpm devand open http://localhost:3000
- Threads/messages are stored in Cosmos DB; ensure the containers exist before running.
