bep40 commited on
Commit
3c0610b
·
verified ·
1 Parent(s): 8f67867

Fix: Use Python script to patch agent.py safely (no sed syntax issues)

Browse files
Files changed (1) hide show
  1. Dockerfile +4 -14
Dockerfile CHANGED
@@ -1,4 +1,4 @@
1
- # CACHE_BUST=20260514_v5_ROOTFIX
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
@@ -25,19 +25,9 @@ RUN uv sync --no-dev --frozen
25
  # Copy frontend
26
  COPY --from=frontend-builder /source/frontend/dist ./static/
27
 
28
- # ====== ROOT FIX: Patch models list directly in agent.py ======
29
- RUN sed -i 's/DEFAULT_FREE_MODEL_ID = "moonshotai\/Kimi-K2.6"/DEFAULT_FREE_MODEL_ID = "deepseek\/deepseek-chat-v3-0324"/' ./backend/routes/agent.py && \
30
- sed -i '/"id": "moonshotai\/Kimi-K2.6"/,/},/c\ {"id": "deepseek/deepseek-chat-v3-0324", "label": "DeepSeek V3", "provider": "openrouter", "tier": "free", "recommended": True},' ./backend/routes/agent.py && \
31
- sed -i '/"id": _claude_picker_model_id()/,/},/c\ {"id": "google/gemini-2.0-flash-001", "label": "Gemini 2.0 Flash", "provider": "openrouter", "tier": "free", "recommended": True},' ./backend/routes/agent.py && \
32
- sed -i '/"id": "openai\/gpt-5.5"/,/},/c\ {"id": "qwen/qwen3-30b-a3b", "label": "Qwen3 30B", "provider": "openrouter", "tier": "free"},' ./backend/routes/agent.py && \
33
- sed -i '/"id": "MiniMaxAI\/MiniMax-M2.7"/,/},/c\ {"id": "anthropic/claude-sonnet-4", "label": "Claude Sonnet 4", "provider": "openrouter", "tier": "pro"},' ./backend/routes/agent.py && \
34
- sed -i '/"id": "zai-org\/GLM-5.1"/,/},/c\' ./backend/routes/agent.py && \
35
- sed -i '/"id": "deepseek-ai\/DeepSeek-V4-Pro:deepinfra"/,/},/c\' ./backend/routes/agent.py && \
36
- echo "✅ Models list patched"
37
-
38
- # Verify patch
39
- RUN grep -A2 "DEFAULT_FREE_MODEL_ID" ./backend/routes/agent.py | head -3
40
- RUN grep "deepseek-chat-v3" ./backend/routes/agent.py && echo "✅ DeepSeek V3 in models"
41
 
42
  # Override main.py and config
43
  COPY backend/main.py ./backend/main.py
 
1
+ # CACHE_BUST=20260514_v6
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
 
25
  # Copy frontend
26
  COPY --from=frontend-builder /source/frontend/dist ./static/
27
 
28
+ # ====== PATCH: Use Python to safely modify agent.py ======
29
+ COPY patch_agent.py /tmp/patch_agent.py
30
+ RUN python /tmp/patch_agent.py && echo "✅ Agent patched"
 
 
 
 
 
 
 
 
 
 
31
 
32
  # Override main.py and config
33
  COPY backend/main.py ./backend/main.py