bep40 commited on
Commit
5d14a4d
·
verified ·
1 Parent(s): c79d1e9

Use Python script to patch frontend safely instead of sed

Browse files
Files changed (1) hide show
  1. Dockerfile +6 -5
Dockerfile CHANGED
@@ -1,10 +1,11 @@
1
- # Restore from 4bac0e2 + patch frontend models dropdown
2
  FROM node:20-alpine AS frontend-builder
3
- RUN apk add --no-cache git
4
  RUN git clone --depth 1 https://huggingface.co/spaces/smolagents/ml-intern /source
5
 
6
- # PATCH FRONTEND: Add Gemini + Qwen3 to model dropdown
7
- RUN sed -i '/id: .deepseek-v4-pro.,/,/^ },$/a\ {\n id: "gemini-2.0-flash",\n name: "Gemini 2.0 Flash",\n description: "OpenRouter (Free)",\n modelPath: "openai/google/gemini-2.0-flash-001",\n avatarUrl: "https://huggingface.co/api/avatars/google",\n recommended: true,\n },\n {\n id: "qwen3-30b",\n name: "Qwen3 30B",\n description: "OpenRouter (Free)",\n modelPath: "openai/qwen/qwen3-30b-a3b",\n avatarUrl: "https://huggingface.co/api/avatars/Qwen",\n },' /source/frontend/src/components/Chat/ChatInput.tsx && echo "✅ Frontend patched"
 
8
 
9
  WORKDIR /source/frontend
10
  RUN npm install && npm run build
@@ -28,7 +29,7 @@ RUN uv sync --no-dev --frozen
28
  COPY --from=frontend-builder /source/frontend/dist ./static/
29
  COPY configs/frontend_agent_config.json ./configs/frontend_agent_config.json
30
 
31
- # Patch backend: add new model IDs to AVAILABLE_MODELS so backend accepts them
32
  COPY patch_models.py /tmp/patch_models.py
33
  RUN python /tmp/patch_models.py
34
 
 
1
+ # Restore from 4bac0e2 + patch frontend + backend models
2
  FROM node:20-alpine AS frontend-builder
3
+ RUN apk add --no-cache git python3
4
  RUN git clone --depth 1 https://huggingface.co/spaces/smolagents/ml-intern /source
5
 
6
+ # Patch frontend: add Gemini + Qwen3 models to dropdown
7
+ COPY patch_frontend.py /tmp/patch_frontend.py
8
+ RUN python3 /tmp/patch_frontend.py
9
 
10
  WORKDIR /source/frontend
11
  RUN npm install && npm run build
 
29
  COPY --from=frontend-builder /source/frontend/dist ./static/
30
  COPY configs/frontend_agent_config.json ./configs/frontend_agent_config.json
31
 
32
+ # Patch backend: accept new model IDs
33
  COPY patch_models.py /tmp/patch_models.py
34
  RUN python /tmp/patch_models.py
35