Skip to content

Commit 7e1db7b

Browse files
committed
Replace legacy QMD integration with shared model catalog
1 parent d3637c3 commit 7e1db7b

82 files changed

Lines changed: 9094 additions & 23609 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎.dockerignore‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,3 +9,7 @@ node_modules
99
**/node_modules
1010
**/dist
1111
**/.next
12+
13+
opencode-auth.json
14+
data
15+
.conductor

‎.env.example‎

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ LATTICE_DATA_ROOT=../../data/runtime
55
WEB_PORT=3000
66
WEB_INTERNAL_PORT=3000
77
WEB_SYNC_WORKER_URL=http://sync-worker:4000
8-
WEB_QMD_SERVICE_URL=http://qmd:8181
98
WEB_OPENCODE_SERVICE_URL=http://opencode-query:8282
109
WEB_DEFAULT_QUERY_LIMIT=6
1110
CHAT_DB_PATH=/var/lib/lattice/chat/chat.sqlite
@@ -15,10 +14,6 @@ CHAT_DB_PATH=/var/lib/lattice/chat/chat.sqlite
1514
WEB_AUTH_MODE=dev
1615
WEB_DEV_USER_EMAIL=you@example.com
1716

18-
QMD_PORT=8181
19-
QMD_DB_PATH=/var/lib/qmd/index.sqlite
20-
QMD_COLLECTION=vault
21-
QMD_RESULT_LIMIT=6
2217
OPENCODE_QUERY_PORT=8282
2318
OPENCODE_QUERY_TIMEOUT_MS=120000
2419
OPENCODE_PROMPT_HEARTBEAT_MS=15000
@@ -34,12 +29,12 @@ SYNC_DELETE=false
3429
VAULT_MIRROR_DIR=/srv/vault-mirror
3530
STATUS_DIR=/var/lib/lattice
3631
LOG_DIR=/var/log/lattice
37-
QMD_EMBED_STRATEGY=on-change
3832

3933
AWS_ACCESS_KEY_ID=
4034
AWS_SECRET_ACCESS_KEY=
4135
AWS_SESSION_TOKEN=
4236
OPENROUTER_API_KEY=
37+
# Optional: used only with docker-compose.subscription.yml.
4338
OPENCODE_OPENAI_AUTH_HOST_FILE=../../opencode-auth.json
4439

4540
CLOUDFLARE_TUNNEL_TOKEN=

‎.github/workflows/ci.yml‎

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
name: CI
2+
on:
3+
push:
4+
pull_request:
5+
permissions:
6+
contents: read
7+
jobs:
8+
checks:
9+
runs-on: ubuntu-latest
10+
steps:
11+
- uses: actions/checkout@v5
12+
- uses: actions/setup-node@v5
13+
with:
14+
node-version-file: .nvmrc
15+
- run: corepack enable && corepack prepare pnpm@11.1.2 --activate
16+
- run: pnpm install --frozen-lockfile
17+
- run: pnpm check
18+
- run: pnpm build
19+
- run: make lint-shell
20+
- run: docker compose --env-file .env.example -f infra/docker/docker-compose.yml config --quiet
21+
containers:
22+
runs-on: ubuntu-latest
23+
strategy:
24+
fail-fast: false
25+
matrix:
26+
dockerfile:
27+
- apps/web/Dockerfile
28+
- services/opencode-query/Dockerfile
29+
- services/sync-worker/Dockerfile
30+
- services/scheduler/Dockerfile
31+
steps:
32+
- uses: actions/checkout@v5
33+
- run: docker build -f "${{ matrix.dockerfile }}" .

‎.gitignore‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,3 +14,5 @@ data/runtime/
1414

1515
*.sqlite
1616
*.gguf
17+
18+
*.tsbuildinfo

‎.nvmrc‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
24

‎Makefile‎

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,33 @@
11
SHELL := /bin/bash
22

33
COMPOSE_FILE := infra/docker/docker-compose.yml
4+
COMPOSE_FLAGS := --env-file .env -f $(COMPOSE_FILE)
5+
ifeq ($(SUBSCRIPTION),1)
6+
COMPOSE_FLAGS += -f infra/docker/docker-compose.subscription.yml
7+
endif
48

59
-include .env
610
export
711

812
.PHONY: up down logs ps web sync status lint-shell
913

1014
up:
11-
docker compose --env-file .env -f $(COMPOSE_FILE) up --build -d
15+
docker compose $(COMPOSE_FLAGS) up --build -d
1216

1317
up-attached:
14-
docker compose --env-file .env -f $(COMPOSE_FILE) up --build
18+
docker compose $(COMPOSE_FLAGS) up --build
1519

1620
down:
17-
docker compose --env-file .env -f $(COMPOSE_FILE) down
21+
docker compose $(COMPOSE_FLAGS) down
1822

1923
logs:
20-
docker compose --env-file .env -f $(COMPOSE_FILE) logs -f
24+
docker compose $(COMPOSE_FLAGS) logs -f
2125

2226
ps:
23-
docker compose --env-file .env -f $(COMPOSE_FILE) ps
27+
docker compose $(COMPOSE_FLAGS) ps
2428

2529
web:
26-
cd apps/web && npm run dev
30+
sfw pnpm --filter lattice-web dev
2731

2832
sync:
2933
curl -fsS -X POST http://localhost:$${SYNC_WORKER_PORT:-4000}/run -H 'content-type: application/json' -d '{"trigger":"manual"}'
@@ -32,4 +36,4 @@ status:
3236
curl -fsS http://localhost:$${SYNC_WORKER_PORT:-4000}/status
3337

3438
lint-shell:
35-
bash -n scripts/sync-vault.sh scripts/run-qmd-update.sh scripts/run-qmd-embed.sh scripts/healthcheck.sh services/scheduler/entrypoint.sh
39+
bash -n scripts/sync-vault.sh scripts/healthcheck.sh services/scheduler/entrypoint.sh

‎README.md‎

Lines changed: 91 additions & 184 deletions
Large diffs are not rendered by default.

‎apps/web/Dockerfile‎

Lines changed: 19 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,30 @@
1-
FROM node:20-bookworm-slim AS deps
2-
3-
WORKDIR /app
4-
1+
FROM node:24-bookworm-slim AS builder
2+
ENV PNPM_HOME=/pnpm
3+
ENV PATH=$PNPM_HOME:$PATH
4+
RUN corepack enable && corepack prepare pnpm@11.1.2 --activate
55
RUN apt-get update \
66
&& apt-get install -y --no-install-recommends python3 make g++ \
77
&& rm -rf /var/lib/apt/lists/*
8-
9-
COPY apps/web/package.json apps/web/package.json
10-
COPY apps/web/package-lock.json apps/web/package-lock.json
11-
RUN cd apps/web && npm install
12-
13-
FROM node:20-bookworm-slim AS builder
14-
158
WORKDIR /app
16-
17-
COPY --from=deps /app/apps/web/node_modules ./apps/web/node_modules
9+
COPY package.json pnpm-lock.yaml pnpm-workspace.yaml ./
10+
COPY apps/web/package.json ./apps/web/package.json
11+
COPY services/opencode-query/package.json ./services/opencode-query/package.json
12+
COPY services/sync-worker/package.json ./services/sync-worker/package.json
13+
COPY showcase-website/package.json ./showcase-website/package.json
14+
COPY packages ./packages
15+
RUN pnpm --filter lattice-web... install --frozen-lockfile
1816
COPY apps/web ./apps/web
17+
RUN pnpm --filter lattice-web build
1918

20-
RUN cd apps/web && npm run build
21-
22-
FROM node:20-bookworm-slim AS runner
23-
24-
WORKDIR /app
25-
19+
FROM node:24-bookworm-slim AS runner
2620
ENV NODE_ENV=production
2721
ENV PORT=3000
28-
22+
ENV HOSTNAME=0.0.0.0
23+
WORKDIR /app
2924
COPY --from=builder /app/apps/web/.next/standalone ./
30-
COPY --from=builder /app/apps/web/.next/static ./.next/static
31-
COPY --from=builder /app/apps/web/public ./public
32-
COPY --from=builder /app/apps/web/drizzle ./drizzle
33-
25+
COPY --from=builder /app/apps/web/.next/static ./apps/web/.next/static
26+
COPY --from=builder /app/apps/web/public ./apps/web/public
27+
COPY --from=builder /app/apps/web/drizzle ./apps/web/drizzle
28+
WORKDIR /app/apps/web
3429
EXPOSE 3000
35-
3630
CMD ["node", "server.js"]

‎apps/web/app/api/ask/route.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ export async function POST(request: Request) {
99
const result = await executeQueryEngineRequest({
1010
question: parsed.question,
1111
folder: parsed.folder,
12-
engine: parsed.engine ?? "qmd",
12+
engine: parsed.engine ?? "opencode",
1313
model: parsed.model,
1414
openAiRoute: parsed.openAiRoute,
1515
limit: parsed.limit

‎apps/web/app/api/chat/threads/[threadId]/route.ts‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,8 @@ export async function PATCH(request: Request, context: RouteContext) {
5252
threadId,
5353
userEmail: identity.userEmail,
5454
...parsed,
55-
model: parsed.engine === "qmd" ? null : parsed.model,
56-
openAiRoute: parsed.engine === "qmd" ? null : parsed.openAiRoute
55+
model: parsed.model,
56+
openAiRoute: parsed.openAiRoute
5757
});
5858

5959
if (!thread) {

0 commit comments

Comments
 (0)