isaachaaseinstitutemail-spec commited on
Commit
b676fd9
·
1 Parent(s): c536505

fix: disable strict X-Request-ID UUID validation in starlette_context to prevent HF proxy 400 rejection

Browse files
Files changed (1) hide show
  1. Dockerfile +5 -0
Dockerfile CHANGED
@@ -9,6 +9,11 @@ RUN pip install "uvicorn<0.30.0"
9
  # Install llama-cpp-python with a server (Using pre-compiled CPU wheels to skip the long C++ build!)
10
  RUN pip install "llama-cpp-python[server]" huggingface-hub --extra-index-url https://abetlen.github.io/llama-cpp-python/whl/cpu
11
 
 
 
 
 
 
12
  # Download a fast, compressed model (Qwen 1.5B is perfect for free CPUs)
13
  RUN python3 -c "from huggingface_hub import hf_hub_download; hf_hub_download(repo_id='Qwen/Qwen2.5-1.5B-Instruct-GGUF', filename='qwen2.5-1.5b-instruct-q4_k_m.gguf', local_dir='/model')"
14
 
 
9
  # Install llama-cpp-python with a server (Using pre-compiled CPU wheels to skip the long C++ build!)
10
  RUN pip install "llama-cpp-python[server]" huggingface-hub --extra-index-url https://abetlen.github.io/llama-cpp-python/whl/cpu
11
 
12
+ # CRITICAL FIX: Hugging Face proxy injects a non-UUID 'X-Request-ID' header (e.g. 'qKsNoh').
13
+ # starlette_context's RequestIdPlugin strictly validates this as UUIDv4 by default and throws a 400 Bad Request with an empty body.
14
+ # We must patch llama_cpp to disable this validation.
15
+ RUN python3 -c "import llama_cpp.server.app as app; path = app.__file__; open(path, 'w').write(open(path).read().replace('RequestIdPlugin()', 'RequestIdPlugin(validate=False)'))"
16
+
17
  # Download a fast, compressed model (Qwen 1.5B is perfect for free CPUs)
18
  RUN python3 -c "from huggingface_hub import hf_hub_download; hf_hub_download(repo_id='Qwen/Qwen2.5-1.5B-Instruct-GGUF', filename='qwen2.5-1.5b-instruct-q4_k_m.gguf', local_dir='/model')"
19