wodongdong commited on
Commit
298b4fc
·
verified ·
1 Parent(s): ed37209

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +1 -5
Dockerfile CHANGED
@@ -13,11 +13,7 @@ RUN uv sync
13
  # 修改main.py文件
14
  RUN sed -i 's/await gemini_client.init(timeout=300)/await gemini_client.init(timeout=5000)/g' /app/main.py
15
  RUN sed -i 's/response = await gemini_client.generate_content(/response = await gemini_client.generate_content( , timeout=5000)/g' /app/main.py # 调整为实际
16
- RUN sed -i '/import logging/a\import httpx\nfrom tenacity import retry, stop_after_attempt, wait_exponential' /app/main.py
17
- RUN sed -i '/async def create_chat_completion(/a\ @retry(stop=stop_after_attempt(3), wait=wait_exponential(multiplier=1, min=4, max=10))\n async def safe_generate_content(*args, **kwargs):\n return await gemini_client.generate_content(*args, **kwargs)' /app/main.py
18
- RUN sed -i 's/response = await gemini_client.generate_content(/response = await safe_generate_content(/g' /app/main.py
19
- RUN sed -i '/response = await/a\ logger.info("Starting generate_content request with timeout=5000")\n try:' /app/main.py
20
- RUN sed -i '/response = await/a\ except httpx.ReadTimeout as e:\n logger.error(f"httpx ReadTimeout: {str(e)}")\n except Exception as e:\n logger.error(f"Error: {str(e)}", exc_info=True)' /app/main.py
21
  # 网络和凭证测试
22
  RUN curl -I https://generativelanguage.googleapis.com || echo "Network test failed"
23
  RUN echo "Checking credentials..." && [ -n "$SECURE_1PSID" ] && echo "SECURE_1PSID is set" || echo "SECURE_1PSID is not set"
 
13
  # 修改main.py文件
14
  RUN sed -i 's/await gemini_client.init(timeout=300)/await gemini_client.init(timeout=5000)/g' /app/main.py
15
  RUN sed -i 's/response = await gemini_client.generate_content(/response = await gemini_client.generate_content( , timeout=5000)/g' /app/main.py # 调整为实际
16
+
 
 
 
 
17
  # 网络和凭证测试
18
  RUN curl -I https://generativelanguage.googleapis.com || echo "Network test failed"
19
  RUN echo "Checking credentials..." && [ -n "$SECURE_1PSID" ] && echo "SECURE_1PSID is set" || echo "SECURE_1PSID is not set"