mirror of
https://github.com/HKUDS/DeepTutor.git
synced 2026-12-05 22:49:51 +08:00
fix: server startup on Windows + missing runtime deps
Two independent issues that block `python scripts/start_web.py` after a
clean install on Windows:
1. UnicodeDecodeError when streaming subprocess output
`_spawn()` opened the backend / frontend stdout pipe with `text=True`
but no explicit encoding. On Windows this defaults to the system
ANSI codepage (e.g. `gbk` on Chinese Windows), which raises
`UnicodeDecodeError` as soon as the child process emits a UTF-8 byte.
Fix: pin `encoding="utf-8"` and `errors="replace"` so any locale
produces clean, lossless output.
2. Missing runtime dependencies in requirements/server.txt
`deeptutor/services/llm/provider_core/__init__.py` unconditionally
imports `AnthropicProvider`, `OpenAICompatProvider`, and
`OpenAIResponses`, which in turn import:
- `loguru` (provider_core/base.py, openai_codex_provider.py,
openai_responses/parsing.py)
- `json_repair` (anthropic_provider.py, openai_compat_provider.py,
openai_responses/parsing.py)
These are declared only in `requirements/tutorbot.txt`, so
`pip install -r requirements/server.txt && pip install -e .` followed
by `python scripts/start_web.py` crashes with `ModuleNotFoundError`
before the API server can serve a single request.
Fix: declare both packages in `server.txt` with the same version
bounds used by `tutorbot.txt`.
Reproduced and verified on Windows 11 + Python 3.12 + a fresh venv.
This commit is contained in:
@@ -78,6 +78,8 @@ def _spawn(
|
||||
"stderr": subprocess.STDOUT,
|
||||
"text": True,
|
||||
"bufsize": 1,
|
||||
"encoding": "utf-8",
|
||||
"errors": "replace",
|
||||
}
|
||||
if os.name == "nt":
|
||||
kwargs["creationflags"] = subprocess.CREATE_NEW_PROCESS_GROUP # type: ignore[attr-defined]
|
||||
|
||||
Reference in New Issue
Block a user