Arshit Malik commited on
Commit
f7d419b
·
1 Parent(s): f1211b7

fix: clean Dockerfile with /v1/ proxy, OpenAI-compatible API

Browse files
Files changed (2) hide show
  1. Dockerfile +1 -7
  2. health_server.py +2 -2
Dockerfile CHANGED
@@ -13,13 +13,7 @@ RUN curl -fsSL https://ollama.com/install.sh | sh
13
 
14
  RUN pip3 install --no-cache-dir --break-system-packages huggingface_hub
15
 
16
- RUN printf 'server {\n listen 7860;\n set $auth_header "";\n if ($arg_token) {\n set $auth_header "Bearer $arg_token";\n }\n location /__openclaw__/ {\n proxy_pass http://127.0.0.1:8081;\n proxy_http_version 1.1;\n proxy_set_header Upgrade $http_upgrade;\n proxy_set_header Connection "upgrade";\n proxy_set_header Host $host;\n proxy_set_header Authorization $auth_header;\n }\n location /api/ {\n proxy_pass http://127.0.0.1:8081;\n proxy_http_version 1.1;\n proxy_set_header Upgrade $http_upgrade;\n proxy_set_header Connection "upgrade";\n proxy_set_header Host $host;\n proxy_set_header Authorization $auth_header;\n }\n location /ollama/ {
17
- rewrite ^/ollama/(.*) /$1 break;
18
- proxy_pass http://127.0.0.1:11434;
19
- proxy_http_version 1.1;
20
- proxy_set_header Host $host;
21
- }
22
- location /health {\n proxy_pass http://127.0.0.1:8081;\n proxy_set_header Host $host;\n proxy_set_header Authorization $auth_header;\n }\n location / {\n proxy_pass http://127.0.0.1:8080;\n proxy_set_header Host $host;\n }\n}\n' > /etc/nginx/sites-available/default
23
 
24
  WORKDIR /app
25
  COPY . .
 
13
 
14
  RUN pip3 install --no-cache-dir --break-system-packages huggingface_hub
15
 
16
+ RUN printf 'server {\n listen 7860;\n location /__openclaw__/ {\n proxy_pass http://127.0.0.1:8081;\n proxy_http_version 1.1;\n proxy_set_header Upgrade \$http_upgrade;\n proxy_set_header Connection "upgrade";\n proxy_set_header Host \$host;\n }\n location /api/ {\n proxy_pass http://127.0.0.1:8081;\n proxy_http_version 1.1;\n proxy_set_header Upgrade \$http_upgrade;\n proxy_set_header Connection "upgrade";\n proxy_set_header Host \$host;\n }\n location /v1/ {\n proxy_pass http://127.0.0.1:8081;\n proxy_http_version 1.1;\n proxy_set_header Upgrade \$http_upgrade;\n proxy_set_header Connection "upgrade";\n proxy_set_header Host \$host;\n }\n location /health {\n proxy_pass http://127.0.0.1:8081;\n proxy_set_header Host \$host;\n }\n location / {\n proxy_pass http://127.0.0.1:8080;\n proxy_set_header Host \$host;\n }\n}\n' > /etc/nginx/sites-available/default
 
 
 
 
 
 
17
 
18
  WORKDIR /app
19
  COPY . .
health_server.py CHANGED
@@ -34,9 +34,9 @@ async function chat(){
34
  const p=prompt.value.trim();if(!p)return;addMsg(p,'user');messages.push({role:'user',content:p});
35
  prompt.value='';sendBtn.disabled=prompt.disabled=true;statusDiv.textContent='Thinking...';
36
  try{
37
- const r=await fetch('/ollama/api/chat',{method:'POST',
38
  headers:{'Content-Type':'application/json'},
39
- body:JSON.stringify({model:'hf.co/bartowski/DeepSeek-R1-Distill-Qwen-14B-GGUF:IQ3_XS',stream:false,
40
  messages:messages,max_tokens:4096,temperature:0.7})});
41
  if(!r.ok)throw new Error(await r.text());
42
  const j=await r.json();const reply=j.choices[0].message.content;
 
34
  const p=prompt.value.trim();if(!p)return;addMsg(p,'user');messages.push({role:'user',content:p});
35
  prompt.value='';sendBtn.disabled=prompt.disabled=true;statusDiv.textContent='Thinking...';
36
  try{
37
+ const r=await fetch('/v1/chat/completions',{method:'POST',
38
  headers:{'Content-Type':'application/json'},
39
+ body:JSON.stringify({model:'ollama/hf.co/bartowski/DeepSeek-R1-Distill-Qwen-14B-GGUF:IQ3_XS',
40
  messages:messages,max_tokens:4096,temperature:0.7})});
41
  if(!r.ok)throw new Error(await r.text());
42
  const j=await r.json();const reply=j.choices[0].message.content;