Skip to content

Commit 0d88cbd

Browse files
committed
update readme
1 parent 4dc41d0 commit 0d88cbd

File tree

4 files changed

+77
-1
lines changed

4 files changed

+77
-1
lines changed

README.md

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -408,6 +408,43 @@ cp .env.example .env
408408
- **参数支持**: 支持 `temperature``max_output_tokens``top_p``stop` 等参数
409409
- **认证有效期**: 认证文件可能会过期,需要重新进行认证流程
410410

411+
## 🔍 故障排除
412+
413+
### Windows 端口被系统保留
414+
415+
如果启动时出现 `端口 30XX (主机 0.0.0.0) 当前被占用` 但任务管理器中找不到占用进程,这通常是 Windows 的 Hyper-V/WSL2/Docker 的 NAT 服务随机保留了端口段。
416+
417+
> ⚠️ **以下所有指令需要在管理员权限的 PowerShell 或 CMD 中运行**
418+
419+
#### 1. 查看被 Windows 保留的端口范围
420+
421+
```powershell
422+
netsh interface ipv4 show excludedportrange protocol=tcp
423+
```
424+
425+
如果 Worker 使用的端口(如 3001-3008)落在输出的 `Start Port``End Port` 范围内,即为此问题。
426+
427+
#### 2. 临时解决(重启 WinNAT 服务)
428+
429+
```powershell
430+
net stop winnat
431+
net start winnat
432+
```
433+
434+
重启后再次执行步骤1查看,端口范围通常会变化并释放您需要的端口。
435+
436+
#### 3. 永久解决(将常用端口加入保留白名单)
437+
438+
趁端口空闲时,将开发常用端口永久标记为管理员保留,防止 Windows 再次占用:
439+
440+
```powershell
441+
netsh int ipv4 add excludedportrange protocol=tcp startport=3000 numberofports=20 store=persistent
442+
```
443+
444+
成功后列表中会出现带 `*` 标记的条目,表示该范围受永久保护。
445+
446+
更多问题排除方案请参阅 [故障排除文档](docs/troubleshooting.md)
447+
411448
## 🤝 贡献
412449

413450
欢迎提交 Issue 和 Pull Request!

README_en.md

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -402,6 +402,43 @@ This project uses [Camoufox](https://camoufox.com/) browser to avoid detection a
402402
- **Parameter Support**: Supports `temperature`, `max_output_tokens`, `top_p`, `stop` parameters
403403
- **Authentication Expiry**: Authentication files may expire; re-authentication required
404404

405+
## 🔍 Troubleshooting
406+
407+
### Windows Port Reserved by System
408+
409+
If you see `Port 30XX (host 0.0.0.0) is currently in use` on startup but can't find the occupying process in Task Manager, this is usually caused by Windows Hyper-V/WSL2/Docker NAT service randomly reserving port ranges.
410+
411+
> ⚠️ **All commands below must be run in Administrator PowerShell or CMD**
412+
413+
#### 1. View Windows Reserved Port Ranges
414+
415+
```powershell
416+
netsh interface ipv4 show excludedportrange protocol=tcp
417+
```
418+
419+
If your Worker ports (e.g., 3001-3008) fall within the `Start Port` and `End Port` range shown, this is the issue.
420+
421+
#### 2. Temporary Fix (Restart WinNAT Service)
422+
423+
```powershell
424+
net stop winnat
425+
net start winnat
426+
```
427+
428+
After restart, run step 1 again. The port ranges usually change and release your needed ports.
429+
430+
#### 3. Permanent Fix (Add Common Ports to Reserved Whitelist)
431+
432+
While ports are free, permanently mark commonly used development ports as administrator-reserved to prevent Windows from occupying them again:
433+
434+
```powershell
435+
netsh int ipv4 add excludedportrange protocol=tcp startport=3000 numberofports=20 store=persistent
436+
```
437+
438+
On success, entries with `*` marker will appear in the list, indicating permanent protection.
439+
440+
For more troubleshooting solutions, see [Troubleshooting Guide](docs/troubleshooting.md).
441+
405442
## 🤝 Contributing
406443

407444
Issues and Pull Requests are welcome!

docs/troubleshooting.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# 故障排除 / Troubleshooting
2+

src/proxy/handler.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ async def handle_response(
7373
return result
7474

7575
def _extract_content(self, raw_data: bytes) -> Dict[str, Any]:
76-
pattern = b'\\[\\[\\[null,.*?]],\"model\"]'
76+
pattern = rb'\[\[\[null,.*?]],"model"]'
7777
matches = list(re.finditer(pattern, raw_data))
7878

7979
output = {'reason': '', 'body': '', 'function': []}

0 commit comments

Comments
 (0)