feat: Replace JSON memory with pgvector semantic search (MAT-11)

Add memory-service (FastAPI + pgvector) for semantic memory storage.
Bot now queries relevant memories per conversation instead of dumping all 50.
Includes migration script for existing JSON files.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Christian Gick
2026-02-20 06:25:50 +02:00
parent 0c674f1467
commit 4cd7a0262e
6 changed files with 432 additions and 68 deletions

View File

@@ -17,8 +17,45 @@ services:
- DEFAULT_MODEL
- WILDFILES_BASE_URL
- WILDFILES_ORG
- MEMORY_SERVICE_URL=http://memory-service:8090
volumes:
- bot-data:/data
depends_on:
memory-service:
condition: service_healthy
memory-db:
image: pgvector/pgvector:pg17
restart: unless-stopped
environment:
POSTGRES_USER: memory
POSTGRES_PASSWORD: ${MEMORY_DB_PASSWORD:-memory}
POSTGRES_DB: memories
volumes:
- memory-pgdata:/var/lib/postgresql/data
healthcheck:
test: ["CMD-SHELL", "pg_isready -U memory -d memories"]
interval: 5s
timeout: 3s
retries: 5
memory-service:
build: ./memory-service
restart: unless-stopped
environment:
DATABASE_URL: postgresql://memory:${MEMORY_DB_PASSWORD:-memory}@memory-db:5432/memories
LITELLM_BASE_URL: ${LITELLM_BASE_URL}
LITELLM_API_KEY: ${LITELLM_API_KEY:-not-needed}
EMBED_MODEL: ${EMBED_MODEL:-text-embedding-3-small}
depends_on:
memory-db:
condition: service_healthy
healthcheck:
test: ["CMD", "python", "-c", "import urllib.request; urllib.request.urlopen('http://127.0.0.1:8090/health')"]
interval: 10s
timeout: 5s
retries: 3
volumes:
bot-data:
memory-pgdata: