fix: GLM-5 бэкенд — правильный endpoint + прокси + 100% точность
- Модель: glm-5 (не glm-4-plus) - Base URL: /api/coding/paas/v4 (не /api/paas/v4) - Прокси через HTTPS_PROXY для доступа к Z.ai API - Тест 7/7 (100%): НР, СП, коэффициенты, правила — всё из CAG-контекста - GLM-5 в 3.5x быстрее Claude Code (190с vs 650с на 7 вопросов) Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -15,8 +15,8 @@ import httpx
|
|||||||
|
|
||||||
SMETA_DIR = Path(os.environ.get("SMETA_PROJECT_DIR", os.path.expanduser("~/smeta-railway")))
|
SMETA_DIR = Path(os.environ.get("SMETA_PROJECT_DIR", os.path.expanduser("~/smeta-railway")))
|
||||||
ZAI_API_KEY = os.environ.get("ZAI_API_KEY", "")
|
ZAI_API_KEY = os.environ.get("ZAI_API_KEY", "")
|
||||||
ZAI_BASE_URL = os.environ.get("ZAI_BASE_URL", "https://open.bigmodel.cn/api/paas/v4")
|
ZAI_BASE_URL = os.environ.get("ZAI_BASE_URL", "https://open.bigmodel.cn/api/coding/paas/v4")
|
||||||
ZAI_MODEL = os.environ.get("ZAI_MODEL", "glm-4-plus")
|
ZAI_MODEL = os.environ.get("ZAI_MODEL", "glm-5")
|
||||||
DATA_DIR = Path(os.environ.get("DATA_DIR", "./smeta-web-data"))
|
DATA_DIR = Path(os.environ.get("DATA_DIR", "./smeta-web-data"))
|
||||||
|
|
||||||
# Session tracking: (username, tab_id) -> conversation history
|
# Session tracking: (username, tab_id) -> conversation history
|
||||||
@@ -156,8 +156,9 @@ async def stream_claude(
|
|||||||
|
|
||||||
# Stream from GLM API
|
# Stream from GLM API
|
||||||
full_response = ""
|
full_response = ""
|
||||||
|
proxy = os.environ.get("HTTPS_PROXY") or os.environ.get("HTTP_PROXY")
|
||||||
try:
|
try:
|
||||||
async with httpx.AsyncClient(timeout=60) as client:
|
async with httpx.AsyncClient(timeout=60, proxy=proxy) as client:
|
||||||
resp = await client.post(
|
resp = await client.post(
|
||||||
f"{ZAI_BASE_URL}/chat/completions",
|
f"{ZAI_BASE_URL}/chat/completions",
|
||||||
headers={"Authorization": f"Bearer {ZAI_API_KEY}"},
|
headers={"Authorization": f"Bearer {ZAI_API_KEY}"},
|
||||||
|
|||||||
Reference in New Issue
Block a user