Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# AI Chat Feature - Get your free API keys:

# Upstash Vector (https://console.upstash.com/vector)
UPSTASH_VECTOR_REST_URL=
UPSTASH_VECTOR_REST_TOKEN=

# Google Gemini (https://aistudio.google.com/apikey)
GOOGLE_GENERATIVE_AI_API_KEY=
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
# build output
dist/
template/dist/

# generated types
.astro/

# dependencies
node_modules/
template/node_modules/

# logs
npm-debug.log*
Expand Down Expand Up @@ -54,6 +56,7 @@ coverage/
# Cache
.cache/
*.tsbuildinfo
.index-manifest.json

# Temporary files
tmp/
Expand Down
17 changes: 17 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,22 @@
# create-docubase

## 1.2.0

### Minor Changes

- 8cceec4: Add AI chat assistant with RAG-powered documentation search
- Add AskAnything component for homepage chat input
- Add ChatWidget floating chat button component
- Add dedicated chat page with conversation history
- Add chat API endpoint with Google Gemini integration
- Add Upstash Vector for semantic search
- Add index-content scripts for development and production
- Fix: XSS protection for AI-generated markdown links
- Fix: Proper SSE format for streaming responses
- Fix: Initialization guards for event listeners

- 8cceec4: AI chat assistant with RAG-powered documentation search

Comment on lines +7 to +19
Copy link

Copilot AI Apr 2, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The 1.2.0 changelog entry repeats the same bullet twice (both keyed to 8cceec4). This looks like an accidental duplicate and makes the changelog noisy; remove the redundant line or replace it with distinct information.

Copilot uses AI. Check for mistakes.
## 1.1.2

### Patch Changes
Expand Down
40 changes: 40 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ Your site will be available at `http://localhost:4321`.
- **Content-First**: Write documentation in MDX with full component support
- **Framework-Agnostic**: Works with any UI library or none at all
- **Multiple Content Types**: Documentation, blog posts, and tutorials out of the box
- **AI Chat Assistant**: Built-in RAG-powered chat that answers questions about your docs
- **Static Site Generation**: Fast, SEO-friendly pages that deploy anywhere
- **Type-Safe**: Full TypeScript support with Astro Content Collections
- **Dark Mode**: Automatic dark mode support via CSS media queries
Expand All @@ -31,6 +32,8 @@ Your site will be available at `http://localhost:4321`.
- [MDX](https://mdxjs.com/) - Markdown with components
- [TypeScript](https://www.typescriptlang.org/) - Type safety
- [Tailwind CSS](https://tailwindcss.com/) - Styling
- [Google Gemini](https://ai.google.dev/) - AI chat responses
- [Upstash Vector](https://upstash.com/vector) - Vector search for RAG
- [Storybook](https://storybook.js.org/) - Component playground (optional)

## Installation
Expand Down Expand Up @@ -271,6 +274,43 @@ import Example from '../../components/Example.astro';
</Example>
```

## AI Chat Assistant

DocuBase includes a built-in AI chat assistant that uses RAG (Retrieval-Augmented Generation) to answer questions about your documentation.

### Setup

1. Copy the environment file:

```bash
cp .env.example .env
```

2. Add your API keys to `.env`:

```env
# Upstash Vector (https://console.upstash.com/vector)
UPSTASH_VECTOR_REST_URL=your_url_here
UPSTASH_VECTOR_REST_TOKEN=your_token_here

# Google Gemini (https://aistudio.google.com/apikey)
GOOGLE_GENERATIVE_AI_API_KEY=your_key_here
```

3. That's it! Content is automatically indexed on every build.

### How It Works

- Content is automatically indexed when you run `pnpm run build`
- Users can ask questions via the chat widget or "Ask Anything" input
- The AI searches your docs and provides relevant answers with sources
- No manual indexing required - just write docs and deploy
Comment on lines +300 to +307
Copy link

Copilot AI Apr 2, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The README claims content is "automatically indexed on every build" and specifically when running pnpm run build, but build does not run index-content (only build:with-index does). Update this section to match the actual scripts (or change the build script to include indexing) to avoid users deploying without a populated vector index.

Copilot uses AI. Check for mistakes.

### Components

- **AskAnything**: Homepage input for starting a chat
- **ChatWidget**: Floating chat button (can be added to any layout)

## Storybook (Optional)

DocuBase includes an optional Storybook setup for developing and showcasing components:
Expand Down
2 changes: 2 additions & 0 deletions astro.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,14 @@ import { fileURLToPath } from 'node:url';

import tailwindcss from '@tailwindcss/vite';
import mdx from '@astrojs/mdx';
import vercel from '@astrojs/vercel';

const __dirname = path.dirname(fileURLToPath(import.meta.url));

export default defineConfig({
site: 'https://docubase-docs.vercel.app',
output: 'static',
Copy link

Copilot AI Apr 2, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

output: 'static' is incompatible with the newly added non-prerendered routes (/api/chat, /chat/[uid]). With a static build those endpoints won't be deployed/served, even with the Vercel adapter configured. Switch to output: 'hybrid' (or server) to enable SSR for these routes, or remove the adapter + dynamic routes if static-only is intended.

Suggested change
output: 'static',
output: 'hybrid',

Copilot uses AI. Check for mistakes.
adapter: vercel(),
srcDir: './template/src',
publicDir: './template/public',
vite: {
Expand Down
15 changes: 12 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "create-docubase",
"version": "1.1.2",
"version": "1.2.0",
"description": "Create a new DocuBase documentation site",
"type": "module",
"bin": {
Expand All @@ -13,6 +13,7 @@
"scripts": {
"dev": "astro dev",
"build": "astro build && pagefind --site dist",
"build:with-index": "pnpm run index-content && astro build && pagefind --site dist",
"preview": "astro preview",
"astro": "astro",
"test": "vitest run",
Expand All @@ -22,7 +23,9 @@
"version": "changeset version",
"release": "changeset publish",
"storybook": "storybook dev -p 6006",
"build-storybook": "storybook build"
"build-storybook": "storybook build",
"index-content": "npx tsx scripts/index-content.ts",
"index-content:watch": "npx tsx scripts/index-watch.ts"
},
"keywords": [
"documentation",
Expand All @@ -41,9 +44,14 @@
"dependencies": {
"@astrojs/check": "^0.9.6",
"@astrojs/mdx": "^4.3.13",
"@astrojs/vercel": "^8.0.0",
"@google/generative-ai": "^0.21.0",
"@tailwindcss/vite": "^4.1.18",
"@upstash/vector": "^1.1.0",
"astro": "^5.16.11",
"dotenv": "^16.4.0",
"fs-extra": "^11.2.0",
"gray-matter": "^4.0.3",
"iconify-icon": "^3.0.2",
"picocolors": "^1.1.1",
"prompts": "^2.4.2",
Expand All @@ -63,8 +71,9 @@
"@types/fs-extra": "^11.0.4",
"@types/node": "^25.0.10",
"@types/prompts": "^2.4.9",
"storybook": "^8.4.0",
"pagefind": "^1.4.0",
"storybook": "^8.4.0",
"tsx": "^4.19.0",
"vitest": "^3.0.0"
}
}
Loading
Loading