feat: implement full pipeline (pgvector, embeddings, ingest, query, HTTP)

- Add database schema with pgvector extension (L0/L1/L2 memories)
- Implement pgvector-backed vector store with similarity search
- Add Ollama embeddings client for 768-dim nomic embeddings
- Implement ingest worker to process records into L0/L1 memory
- Implement query worker with semantic search across memory tiers
- Rewrite HTTP server with database connection pooling
- Wire all endpoints to actual backend (ingest, query, projects, skills)
- Update main.rs to use DATABASE_URL from environment
- All code compiles, ready for Docker build and deployment
This commit is contained in:
Story Crater Bot
2026-08-23 18:32:24 -07:00
parent b5f77cbc3f
commit 33eaf1b4f8
17 changed files with 2191 additions and 237 deletions
+13 -4
View File
@@ -90,13 +90,20 @@ enum Commands {
Serve {
#[arg(long, default_value = "8080")]
port: u16,
#[arg(long, default_value = "test-key")]
api_key: String,
#[arg(long)]
api_key: Option<String>,
#[arg(long)]
database_url: Option<String>,
},
}
#[tokio::main]
async fn main() -> anyhow::Result<()> {
// Initialize logging
tracing_subscriber::fmt()
.with_max_level(tracing::Level::INFO)
.init();
let cli = Cli::parse();
match cli.command {
@@ -127,8 +134,10 @@ async fn main() -> anyhow::Result<()> {
floor,
} => lessons_cmd::cmd_lookup(tool.as_deref(), cmd.as_deref(), file.as_deref(), floor)?,
Commands::Materialize => lessons_cmd::cmd_materialize()?,
Commands::Serve { port, api_key } => {
http_server::start_server(port, api_key).await?
Commands::Serve { port, api_key, database_url } => {
let api_key = api_key.unwrap_or_else(|| std::env::var("MEM_API_KEY").unwrap_or_else(|_| "test-key".to_string()));
let database_url = database_url.unwrap_or_else(|| std::env::var("DATABASE_URL").unwrap_or_else(|_| "postgresql://app:poimen@localhost:5432/memory".to_string()));
http_server::start_server(port, api_key, &database_url).await?
}
}