Normalize fullwidth punctuation to ASCII across codebase.
Add scripts/normalize_ambiguous_unicode.py; fix corrupted patch_instance_theme_templates.py. Preserves curly quotes in string literals; removes Git homoglyph warnings on .env.example. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
Vendored
+6
-6
@@ -1,4 +1,4 @@
|
||||
"""中控统一 AI 环境变量:字段定义、读写、同步三实例。"""
|
||||
"""中控统一 AI 环境变量:字段定义,读写,同步三实例."""
|
||||
from __future__ import annotations
|
||||
|
||||
import os
|
||||
@@ -26,7 +26,7 @@ AI_ENV_FIELDS: list[tuple[str, str, str]] = [
|
||||
("OPENAI_MODEL", "云端模型", ""),
|
||||
("OLLAMA_API", "Ollama 地址", "本地服务 URL"),
|
||||
("AI_MODEL", "Ollama 模型", ""),
|
||||
("AI_TIMEOUT_SECONDS", "请求超时(秒)", "默认 120"),
|
||||
("AI_TIMEOUT_SECONDS", "请求超时(秒)", "默认 120"),
|
||||
]
|
||||
|
||||
AI_ENV_KEYS = frozenset(k for k, _l, _n in AI_ENV_FIELDS)
|
||||
@@ -108,7 +108,7 @@ def build_ai_env_payload(env_path: str | None = None, example_path: str | None =
|
||||
|
||||
|
||||
def ai_sync_status() -> dict[str, Any]:
|
||||
"""比较 hub 与三实例 AI 键是否一致(用于 UI 提示)。"""
|
||||
"""比较 hub 与三实例 AI 键是否一致(用于 UI 提示)."""
|
||||
hub_vals = env_get_all(read_env_lines(hub_env_path()))
|
||||
per_instance: dict[str, dict[str, Any]] = {}
|
||||
all_ok = True
|
||||
@@ -165,7 +165,7 @@ def validate_ai_env_updates(updates: dict[str, str], example_path: str | None =
|
||||
|
||||
|
||||
def apply_ai_env_to_all(updates: dict[str, str]) -> dict[str, Any]:
|
||||
"""写入 hub .env 并强制同步三实例相同键。"""
|
||||
"""写入 hub .env 并强制同步三实例相同键."""
|
||||
clean, errors = validate_ai_env_updates(updates)
|
||||
if errors:
|
||||
return {"ok": False, "errors": errors, "changed": {}}
|
||||
@@ -196,7 +196,7 @@ def apply_ai_env_to_all(updates: dict[str, str]) -> dict[str, Any]:
|
||||
|
||||
|
||||
def restart_instances_then_hub_pm2() -> dict[str, Any]:
|
||||
"""先重启三实例,最后重启中控(避免当前请求被中断)。"""
|
||||
"""先重启三实例,最后重启中控(避免当前请求被中断)."""
|
||||
if not sys.platform.startswith("linux"):
|
||||
return {"ok": False, "msg": "仅 Linux 服务器支持 PM2 重启", "results": []}
|
||||
from lib.instance.instance_pm2_lib import restart_instance_pm2
|
||||
@@ -212,7 +212,7 @@ def restart_instances_then_hub_pm2() -> dict[str, Any]:
|
||||
|
||||
|
||||
def restart_hub_and_instances_pm2() -> dict[str, Any]:
|
||||
"""兼容旧调用:与 restart_instances_then_hub_pm2 相同顺序。"""
|
||||
"""兼容旧调用:与 restart_instances_then_hub_pm2 相同顺序."""
|
||||
return restart_instances_then_hub_pm2()
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user