File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 2626from http .server import BaseHTTPRequestHandler , ThreadingHTTPServer
2727from urllib .parse import parse_qs , unquote , urlparse
2828
29- PORT = int (sys .argv [1 ]) if len (sys .argv ) > 1 else int (os .environ .get ("STOA_CHAT_PORT " , 9940 ))
29+ PORT = int (sys .argv [1 ]) if len (sys .argv ) > 1 else int (os .environ .get ("STOA_MODELS_OLLAMA_PORT " , 9940 ))
3030OLLAMA = ("127.0.0.1" , 11434 )
3131HERE = os .path .dirname (os .path .realpath (__file__ ))
3232UI = os .path .expanduser ("~/.cache/stoa/llama-ui" )
Original file line number Diff line number Diff line change 88Só desliga depois de ter visto ao menos uma aba, então usar só a API não é afetado.
99
1010Uso: stoa-models-watch [porta] (padrão 9942, só em 127.0.0.1)
11- Env: STOA_AI_GRACE (segundos, padrão 30), STOA_AI_STOP_CMD (padrão: stoa-models stop)
11+ Env: STOA_MODELS_GRACE (segundos, padrão 30), STOA_MODELS_STOP_CMD (padrão: stoa-models stop)
1212"""
1313import os
1414import select
1919import time
2020from http .server import BaseHTTPRequestHandler , ThreadingHTTPServer
2121
22- PORT = int (sys .argv [1 ]) if len (sys .argv ) > 1 else int (os .environ .get ("STOA_AI_WATCH_PORT " , 9942 ))
23- GRACE = float (os .environ .get ("STOA_AI_GRACE " , 30 ))
24- STOP = os .environ .get ("STOA_AI_STOP_CMD " , os .path .expanduser ("~/.local/bin/stoa-models" ) + " stop" )
22+ PORT = int (sys .argv [1 ]) if len (sys .argv ) > 1 else int (os .environ .get ("STOA_MODELS_WATCH_PORT " , 9942 ))
23+ GRACE = float (os .environ .get ("STOA_MODELS_GRACE " , 30 ))
24+ STOP = os .environ .get ("STOA_MODELS_STOP_CMD " , os .path .expanduser ("~/.local/bin/stoa-models" ) + " stop" )
2525HOSTS = {f"127.0.0.1:{ PORT } " , f"localhost:{ PORT } " }
2626ORIGINS = {f"http://{ h } :{ p } " for h in ("localhost" , "127.0.0.1" ) for p in (9931 , 9940 )}
2727
You can’t perform that action at this time.
0 commit comments