Switch from fastembed to Python sentence-transformers for embedding

ort (ONNX Runtime) has no prebuilt binaries for aarch64-musl.
Use a Python subprocess with sentence-transformers instead:
- scripts/embed.py: reads JSON stdin, outputs embeddings
- kb.rs: calls Python script via tokio subprocess
- Dockerfile: install python3 + sentence-transformers

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-03-01 08:31:31 +00:00
parent 8483359cbc
commit fbf636868c
5 changed files with 86 additions and 766 deletions

View File

@@ -8,13 +8,15 @@ RUN npm run build
# Stage 2: Runtime
FROM alpine:3.21
RUN apk add --no-cache ca-certificates curl bash
RUN apk add --no-cache ca-certificates curl bash python3 py3-pip
RUN curl -LsSf https://astral.sh/uv/install.sh | sh
ENV PATH="/root/.local/bin:$PATH"
RUN pip3 install --break-system-packages sentence-transformers
RUN mkdir -p /app/data/workspaces
WORKDIR /app
COPY target/aarch64-unknown-linux-musl/release/tori .
COPY --from=frontend /app/web/dist ./web/dist/
COPY scripts/embed.py ./scripts/
COPY config.yaml .
EXPOSE 3000