-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
feat: Add configurable memory system with short-term and long-term storage #636
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. Weβll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from 69 commits
a03049c
3c83593
ab5d779
2e8be01
0876fad
835df56
bb148ec
e882bd6
73ab790
aae39ee
bdca07f
f8b4ac2
f21f527
e273737
affec0e
c9b3231
12e3a7c
649cd56
ae5c4fb
fd460fc
dff1c29
15c44f2
62d491a
0c447cc
e192419
aebe5b2
f77fcd3
b4bfaed
2715450
8cff755
48718bf
8983047
3f5d3aa
9cb01cc
8eff377
431cdbc
e8c79f0
9da0a3c
6f05239
3b9423e
be71bd8
de1a6af
1ca1c19
56d48c0
a80bd5c
0d3cac6
1cc596e
4fe348c
a8a59a8
2db6e0c
a4f8b07
c98981f
c4f9caf
16238b5
314a32e
301aa58
edee944
e4f8159
87fa653
213c8c0
8afc61d
bd20788
5c492ca
1c908d3
c9a1a4f
73bb4f5
d64fd62
4817064
b80bf6d
92ae252
7b52e83
9b34358
5d6d144
af3e1a0
97a19e7
1556a2c
11c4175
4982f63
42df634
55780b7
8636a24
eec70b5
b20bc31
e5530f8
2a7051d
8cd811f
f78af0f
7c14e76
03f9d73
26c6c25
ad060c9
64e1c9a
ceae51a
5495b51
78867ae
f392a77
d2c1d1a
185955e
616a19a
6e1149d
e3468b3
1a9bd85
e8b1491
26d06d4
d3f173d
fb2182d
3dace27
83f62a6
d11590c
e15f19a
2a39daf
f6c3b96
f9cd7da
673b286
11b5c4a
7819768
853c84a
1a9d905
27289d3
fa39a37
effda04
9c2c12a
35f6b05
de1fe28
3bad8c0
7a0bc74
471dbb4
1ae65ed
e0ba938
a4d4e84
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,119 @@ | ||
| # ============================================ | ||
| # AIRI Stage Web - Environment Configuration | ||
| # ============================================ | ||
| # This file contains all environment variables needed for deploying | ||
| # AIRI Stage Web on Vercel or running it locally. | ||
| # Copy this file to .env and fill in your actual values. | ||
|
|
||
| # ============================================ | ||
| # Provider Health Checks | ||
| # ============================================ | ||
| # Skip provider health checks to avoid CORS errors in serverless deployments. | ||
| # Recommended: true for browser/Vercel environments | ||
| VITE_SKIP_PROVIDER_HEALTH_CHECK=true | ||
|
|
||
| # ============================================ | ||
| # Default Providers (REQUIRED) | ||
| # ============================================ | ||
| # These must match configured provider identifiers | ||
| DEFAULT_CHAT_PROVIDER=openai | ||
| DEFAULT_SPEECH_PROVIDER=openai-audio-speech | ||
| DEFAULT_TRANSCRIPTION_PROVIDER=openai-audio-transcription | ||
|
|
||
| # ============================================ | ||
| # OpenAI Configuration | ||
| # ============================================ | ||
| OPENAI_API_KEY=sk-... | ||
| OPENAI_BASE_URL=https://api.openai.com/v1/ | ||
| OPENAI_MODEL=gpt-4o-mini | ||
|
|
||
| # ============================================ | ||
| # OpenRouter Configuration | ||
| # ============================================ | ||
| OPENROUTER_API_KEY=sk-or-... | ||
|
|
||
| # ============================================ | ||
| # Anthropic Claude Configuration | ||
| # ============================================ | ||
| ANTHROPIC_API_KEY=sk-ant-... | ||
|
|
||
| # ============================================ | ||
| # Google Gemini Configuration | ||
| # ============================================ | ||
| GOOGLE_GENERATIVE_AI_API_KEY=AIza... | ||
|
|
||
| # ============================================ | ||
| # AIRI Backend WebSocket | ||
| # ============================================ | ||
| # WebSocket endpoint for live configurator feature | ||
| # Point to your AIRI backend for remote module configuration | ||
| # Set VITE_DISABLE_WEBSOCKET=true to disable WebSocket in serverless deployments | ||
| VITE_AIRI_WS_URL=wss://airi.yourdomain.com/ws | ||
| VITE_DISABLE_WEBSOCKET=true | ||
|
|
||
| # ============================================ | ||
| # Short-Term Memory Configuration (Vercel Serverless) | ||
| # ============================================ | ||
| # Short-term memory stores conversation history via /api/memory/* serverless functions | ||
| # Supports Vercel KV (recommended) or Upstash Redis | ||
|
|
||
| # Option 1: Vercel KV (automatically provided when you create a KV database in Vercel Storage tab) | ||
| KV_URL=https://*.kv.vercel-storage.com | ||
| KV_REST_API_URL=https://*.kv.vercel-storage.com | ||
| KV_REST_API_TOKEN=AX**** | ||
| KV_REST_API_READ_ONLY_TOKEN=AW**** | ||
|
Comment on lines
+97
to
+107
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should we have some form of provider abstraction for integrating different providers later? |
||
|
|
||
| # Option 2: Upstash Redis (automatically provided when you create Upstash integration in Vercel) | ||
| UPSTASH_KV_REST_API_URL=https://us1-bold-foo.upstash.io | ||
| UPSTASH_KV_URL=https://us1-bold-foo.upstash.io | ||
| UPSTASH_KV_REST_API_TOKEN=AX**** | ||
| UPSTASH_REDIS_URL=redis://default:****@us1-bold-foo.upstash.io:6379 | ||
|
Comment on lines
+109
to
+113
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This part can be seen as a better impl against https://github.com/moeru-ai/airi/pull/636/files#r2418559828 |
||
|
|
||
| # Short-term memory settings | ||
| SHORT_TERM_MEMORY_PROVIDER=vercel-kv | ||
| MEMORY_NAMESPACE=memory | ||
| SHORT_TERM_MEMORY_MAX_MESSAGES=20 | ||
| SHORT_TERM_MEMORY_TTL_SECONDS=1800 | ||
|
|
||
| # ============================================ | ||
| # Long-Term Memory Configuration (Optional) | ||
| # ============================================ | ||
| # Long-term memory enables semantic search via vector databases | ||
| # Supports Postgres+pgvector or Qdrant | ||
| # Set to 'none' to disable long-term memory | ||
| LONG_TERM_MEMORY_PROVIDER=postgres-pgvector | ||
| MEMORY_LONG_TERM_PROVIDER=postgres-pgvector | ||
|
|
||
| # ============================================ | ||
| # PostgreSQL + pgvector Configuration | ||
| # ============================================ | ||
| # Required when LONG_TERM_MEMORY_PROVIDER=postgres-pgvector | ||
| # Vercel Postgres URL is automatically provided when you create a Postgres database in Vercel Storage tab | ||
| POSTGRES_URL=postgresql://user:pass@host/db | ||
| DATABASE_URL=postgresql://user:pass@host/db | ||
| MEMORY_TABLE_NAME=memory_embeddings | ||
|
|
||
| # ============================================ | ||
| # Qdrant Configuration | ||
| # ============================================ | ||
| # Required when LONG_TERM_MEMORY_PROVIDER=qdrant | ||
| QDRANT_URL=https://xyz.cloud.qdrant.io | ||
| QDRANT_API_KEY=your-api-key | ||
| QDRANT_COLLECTION_NAME=memory | ||
|
|
||
| # ============================================ | ||
| # Embedding Provider Configuration (Required for Long-Term Memory) | ||
| # ============================================ | ||
| # Provider: openai or cloudflare | ||
| EMBEDDING_PROVIDER=openai | ||
| EMBEDDING_MODEL=text-embedding-3-small | ||
| EMBEDDING_DIMENSIONS=1536 | ||
|
|
||
| # OpenAI Embedding Configuration | ||
| OPENAI_API_KEY=sk-... | ||
| OPENAI_BASE_URL=https://api.openai.com/v1/ | ||
|
|
||
| # Cloudflare Workers AI Configuration (alternative to OpenAI) | ||
| CLOUDFLARE_ACCOUNT_ID=1234567890abcdef | ||
| CLOUDFLARE_API_TOKEN=your-cf-token | ||
| CLOUDFLARE_EMBEDDING_MODEL=@cf/baai/bge-base-en-v1.5 | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -101,3 +101,7 @@ twitter-session.json | |
| result* | ||
|
|
||
|
|
||
|
|
||
| # Coding helpers | ||
| AGENTS.md | ||
| CLAUDE.md | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why?