feat(v3): Web 应用化基线(异步任务/SSE/llama-server 管理/Vue SPA 四页 + 设置页整页滚动修复)
This commit is contained in:
+11
-6
@@ -1,4 +1,4 @@
|
||||
"""启动路由网关服务(后台、无窗口)。
|
||||
"""启动路由网关服务(后台、无窗口)。
|
||||
|
||||
用法:
|
||||
python scripts/serve.py [--port 8000] [--stop]
|
||||
@@ -41,11 +41,16 @@ def stop():
|
||||
return
|
||||
pid = int(PID_FILE.read_text().strip())
|
||||
try:
|
||||
import signal
|
||||
os.kill(pid, signal.SIGTERM)
|
||||
print(f"已发送终止信号 pid={pid}")
|
||||
except ProcessLookupError:
|
||||
print(f"进程 {pid} 不存在,清理 pid 文件。")
|
||||
# Windows 下 SIGTERM 对 detached 进程不可靠,改用 taskkill 强制结束进程树
|
||||
subprocess.run(
|
||||
["taskkill", "/PID", str(pid), "/T", "/F"],
|
||||
capture_output=True, text=True, timeout=15,
|
||||
)
|
||||
print(f"已终止服务 pid={pid}")
|
||||
except subprocess.TimeoutExpired:
|
||||
print(f"终止超时 pid={pid},请手动结束进程。")
|
||||
except Exception as e:
|
||||
print(f"终止失败(进程可能不存在): {e}")
|
||||
PID_FILE.unlink(missing_ok=True)
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user