v2 restructure: Go client, Docker engine, release tooling

- Remove v1 Python CLI (src/kb_search/, tests/, root pyproject.toml, uv.lock, .venv)
- Add Go client with cross-platform build (client/)
- Add FastAPI engine with NVIDIA and multi-stage ROCm Dockerfiles (engine/)
- Add VERSION files for client and engine, wired into builds
- Add release.sh for automated build, tag, release, and Docker push
- Update README with build/release docs and ROCm migration note
- Clean up .gitignore for v2 project structure

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-03-26 21:52:25 +00:00
parent 2030976b85
commit 9aab79d49b
98 changed files with 4526 additions and 7776 deletions
+55
View File
@@ -0,0 +1,55 @@
"""Reindex endpoint — re-embed all chunks with the current model."""
import logging
import struct
from main import app
from kb.config import cfg
from kb.database import get_connection, recreate_vec_table
from kb.embeddings import embed_texts, get_model_dim
logger = logging.getLogger("kb.routes.reindex")
BATCH_SIZE = 256
@app.post("/api/v1/reindex")
async def reindex():
dim = get_model_dim()
conn = get_connection(cfg.db_path)
try:
# Fetch all chunks
rows = conn.execute("SELECT id, text FROM chunks ORDER BY id").fetchall()
chunk_ids = [row["id"] for row in rows]
chunk_texts = [row["text"] for row in rows]
logger.info("Reindexing %d chunks with model '%s'", len(chunk_ids), cfg.model)
# Recreate the vec table
recreate_vec_table(conn, dim)
# Embed and insert in batches
for i in range(0, len(chunk_ids), BATCH_SIZE):
batch_ids = chunk_ids[i : i + BATCH_SIZE]
batch_texts = chunk_texts[i : i + BATCH_SIZE]
embeddings = embed_texts(batch_texts)
for chunk_id, embedding in zip(batch_ids, embeddings):
blob = struct.pack(f"{len(embedding)}f", *embedding)
conn.execute(
"INSERT INTO chunks_vec(embedding, chunk_id) VALUES (?, ?)",
(blob, chunk_id),
)
conn.commit()
logger.info("Reindex complete: %d chunks", len(chunk_ids))
return {
"chunks_reindexed": len(chunk_ids),
"model": cfg.model,
}
finally:
conn.close()