feat: audit log всех действий + GLM-5.1 + домен infosmeta.ru

- Таблица audit_log + middleware для логирования всех API-запросов
- Раздел "Журнал" в админке с фильтрами по пользователю/действию
- Переход на GLM-5.1 с отключённым reasoning (thinking: disabled)
- max_tokens 2000→4096, timeout 60→120с
- Домен smeta.kazin.ru → infosmeta.ru во всех файлах

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
anor
2026-04-09 15:51:54 +10:00
co-authored by Claude Opus 4.6
parent adeb92f4d0
commit 1afa7adbaf
8 changed files with 235 additions and 14 deletions
+5 -3
View File
@@ -16,7 +16,7 @@ import httpx
SMETA_DIR = Path(os.environ.get("SMETA_PROJECT_DIR", os.path.expanduser("~/smeta-railway")))
ZAI_API_KEY = os.environ.get("ZAI_API_KEY", "")
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-5")
ZAI_MODEL = os.environ.get("ZAI_MODEL", "glm-5.1")
DATA_DIR = Path(os.environ.get("DATA_DIR", "./smeta-web-data"))
# Session tracking: (username, tab_id) -> conversation history
@@ -341,7 +341,7 @@ async def stream_claude(
full_response = ""
proxy = os.environ.get("HTTPS_PROXY") or os.environ.get("HTTP_PROXY")
try:
async with httpx.AsyncClient(timeout=60, proxy=proxy) as client:
async with httpx.AsyncClient(timeout=120, proxy=proxy) as client:
resp = await client.post(
f"{ZAI_BASE_URL}/chat/completions",
headers={"Authorization": f"Bearer {ZAI_API_KEY}"},
@@ -350,7 +350,8 @@ async def stream_claude(
"messages": messages,
"stream": True,
"temperature": 0.1,
"max_tokens": 2000,
"max_tokens": 4096,
"thinking": {"type": "disabled"},
},
)
resp.raise_for_status()
@@ -364,6 +365,7 @@ async def stream_claude(
try:
chunk = json.loads(data_str)
delta = chunk["choices"][0].get("delta", {})
# GLM-5.1: skip reasoning_content (internal thinking), use only content
text = delta.get("content", "")
if text:
full_response += text