You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: references/ai-chat/README.md
+31-15Lines changed: 31 additions & 15 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -41,22 +41,38 @@ Persistence is handled server-side in the Trigger.dev task via three hooks:
41
41
42
42
## Setup
43
43
44
+
This reference assumes you already have the local webapp running per the repo's [`CONTRIBUTING.md`](../../CONTRIBUTING.md) (Docker services, `pnpm run db:migrate`, `pnpm run db:seed`, webapp on `:3030`).
45
+
46
+
Unlike `hello-world`, the ai-chat project is **not** in the webapp seed. You'll need to create it manually:
47
+
48
+
1. Open http://localhost:3030, log in, switch to the `References` org, and create a new project called `ai-chat`.
49
+
2. Grab the project ref (`proj_...`) from the URL and a Dev secret key from the project's API keys page.
50
+
3. Set up this app's env and database:
51
+
52
+
```bash
53
+
cd references/ai-chat
54
+
cp .env.example .env
55
+
# Fill in TRIGGER_PROJECT_REF, TRIGGER_SECRET_KEY,
56
+
# NEXT_PUBLIC_TRIGGER_PROJECT_DASHBOARD_PATH, and at least one
57
+
# of OPENAI_API_KEY / ANTHROPIC_API_KEY.
58
+
npx prisma migrate deploy
59
+
```
60
+
61
+
The `DATABASE_URL` in `.env.example` points at the local Postgres started by `pnpm run docker` and uses a separate `ai_chat` database.
62
+
63
+
## Running
64
+
65
+
Three terminals from the repo root:
66
+
44
67
```bash
45
-
# From the repo root
46
-
pnpm run docker # Start PostgreSQL, Redis, Electric
47
-
pnpm run db:migrate # Run webapp migrations
48
-
pnpm run db:seed # Seed the database
49
-
50
-
# Set up the reference app's database
51
-
cd references/ai-chat
52
-
cp .env.example .env # Edit DATABASE_URL if needed
53
-
npx prisma migrate deploy
54
-
55
-
# Build and run
56
-
pnpm run build --filter trigger.dev --filter @trigger.dev/sdk
57
-
pnpm run dev --filter webapp # In one terminal
58
-
cd references/ai-chat && pnpm exec trigger dev # In another
59
-
cd references/ai-chat && pnpm run dev # In another
68
+
# 1. Webapp (if not already running)
69
+
pnpm run dev --filter webapp
70
+
71
+
# 2. Trigger CLI dev (registers the chat tasks with the local webapp)
0 commit comments