Une seule feature livree en une seule PR, en 5 phases : - Phase 1 : enrichit le corpus NLP (tech-step-training-data.ts) et ajoute un harness d'evaluation (precision/rappel/F1) avec un jeu de test etiquete - la premiere metrique objective de qualite pour ce classifieur. - Phase 2 : schema Prisma (StepTechStepCorrection, TechStepTrainingSuggestion) + endpoints utilisateur (POST/GET corrections, ouverts a tout viewer, pas seulement l'auteur) + endpoints internes /internal/tech-steps/* proteges par secret partage (requireInternalWorker). - Phase 3 : UI de highlight/correction cote web (selection de texte -> association a une technique, ou clic sur un highlight existant pour le corriger/supprimer) - verifiee via Cypress (component + e2e, en Chrome reel). - Phase 4 : worker LLM autonome (services/tech-step-llm-worker, hors du monorepo pnpm comme experiments/llm-tech-step-poc) qui audite les clauses a faible confiance et transforme les corrections utilisateur en suggestions d'entrainement, sans jamais toucher le chemin interactif. - Phase 5 : script retrain-tech-steps.ts (gate de regression F1 + backfill) et list-pending-training-suggestions.ts pour la revue humaine avant application au corpus. Verification effectuee cette session : tsc/biome sur l'ensemble du repo, build complet (pnpm build), suite Cypress complete (component 39/39, e2e 75/76 - le seul echec est preexistant et sans rapport, cote recipe-form.feature/ingredient-picker), tests unitaires du worker (6/6) et son install/typecheck reels contre node-llama-cpp. Les tests Mocha d'apps/api (Phases 1 et 2) n'ont pas pu etre executes dans cette session (pas de Postgres local disponible) - a lancer avant merge. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
38 lines
1.9 KiB
Docker
38 lines
1.9 KiB
Docker
# Standalone image for services/tech-step-llm-worker — deliberately *not*
|
|
# built as part of apps/api's own Dockerfile/image (see this package's own
|
|
# package.json doc comment): node-llama-cpp's native binding must never be
|
|
# compiled into the API's image, and this worker shares no dependencies or
|
|
# code with it (see api-client.ts's own doc comment on why its types are
|
|
# duplicated rather than imported from @batch-cooking/shared).
|
|
FROM node:22-slim AS base
|
|
# node-llama-cpp's postinstall builds/downloads a native binding — basic
|
|
# build tooling covers the (rare) case a prebuilt binary isn't available
|
|
# for this platform; ca-certificates is needed for the HTTPS download of
|
|
# both that binary and the GGUF model weights (resolveModelFile,
|
|
# llm-verdict.ts).
|
|
RUN apt-get update && apt-get install -y --no-install-recommends python3 make g++ ca-certificates && rm -rf /var/lib/apt/lists/*
|
|
RUN corepack enable
|
|
WORKDIR /worker
|
|
|
|
FROM base AS build
|
|
# `pnpm-lock.yaml` is committed for this package (unlike
|
|
# experiments/llm-tech-step-poc, which has none) — `--frozen-lockfile`
|
|
# means a build fails loudly on any drift instead of silently resolving
|
|
# different versions than what's on disk/CI.
|
|
COPY services/tech-step-llm-worker/package.json services/tech-step-llm-worker/pnpm-lock.yaml ./
|
|
RUN pnpm install --ignore-workspace --frozen-lockfile
|
|
COPY services/tech-step-llm-worker/tsconfig.json ./tsconfig.json
|
|
COPY services/tech-step-llm-worker/src ./src
|
|
RUN pnpm exec tsc -p tsconfig.json
|
|
|
|
FROM base AS runtime
|
|
ENV NODE_ENV=production
|
|
COPY --from=build /worker/node_modules ./node_modules
|
|
COPY --from=build /worker/package.json ./package.json
|
|
COPY --from=build /worker/dist ./dist
|
|
# GGUF weights download on first run into ./models (see llm-verdict.ts's
|
|
# MODELS_DIRECTORY) — mounted as a named volume in docker-compose.yml so a
|
|
# container restart doesn't re-download several hundred MB to a GB every
|
|
# time.
|
|
VOLUME ["/worker/models"]
|
|
CMD ["node", "dist/index.js"]
|