feat: 回忆录证据血缘与内部评测可追溯,顺带对齐本地评测台与 CI
数据库与模型:新增多版迁移(章节证据快照、对话血缘、记忆事实/时间线 lineage 等),把「成稿 ↔ 对话/记忆」的溯源信息落到表结构里。 业务链路:会话与 WS、回忆录/故事流水线、记忆写入与 enrichment 等跟着接上线索与快照;新增章节证据快照与评测侧 EvalTraceService 等模块,方便组评审用的证据包。 内部评测:自动化 run 与手工 memoir 评审共用可追溯证据;rubric/ judge 相关脚本与文档有配套调整。 app-eval-web:Memoir/实验详情里能展开看证据摘要与 evidence_trace(含对话轮次 id);Vite 代理与 development.sh 注入的 API 端口与当前默认内部评测端口一致,避免改端口后页面连错服务。 工程杂项:GitHub Actions / 仓库说明有更新;各适配器与支付/配额/plan 等多处为小改动或跟随主改动的收尾;新增/扩充了?
This commit is contained in:
@@ -21,8 +21,15 @@ def extract_json_payload(raw_response: str | None) -> str:
|
||||
return cleaned
|
||||
|
||||
start = cleaned.find("{")
|
||||
end = cleaned.rfind("}")
|
||||
if start != -1 and end != -1 and end > start:
|
||||
return cleaned[start : end + 1].strip()
|
||||
if start == -1:
|
||||
return cleaned
|
||||
depth = 0
|
||||
for i, ch in enumerate(cleaned[start:], start):
|
||||
if ch == "{":
|
||||
depth += 1
|
||||
elif ch == "}":
|
||||
depth -= 1
|
||||
if depth == 0:
|
||||
return cleaned[start : i + 1].strip()
|
||||
|
||||
return cleaned
|
||||
|
||||
@@ -4,10 +4,11 @@ HTTP 中间件:request_id 注入。
|
||||
|
||||
import uuid
|
||||
|
||||
from app.core.logging import logger
|
||||
from starlette.middleware.base import BaseHTTPMiddleware
|
||||
from starlette.requests import Request
|
||||
|
||||
from app.core.logging import logger
|
||||
|
||||
|
||||
class RequestIdMiddleware(BaseHTTPMiddleware):
|
||||
"""Inject request_id into request.state and response headers, bind to loguru context."""
|
||||
|
||||
@@ -34,7 +34,17 @@ class RedisService:
|
||||
)
|
||||
await self._client.ping()
|
||||
logger.info("Redis 连接成功")
|
||||
logger.debug("Redis 连接 URL: {}", self.redis_url)
|
||||
try:
|
||||
from urllib.parse import urlparse
|
||||
|
||||
p = urlparse(self.redis_url)
|
||||
logger.debug(
|
||||
"Redis 连接 host={} port={}",
|
||||
p.hostname or "",
|
||||
p.port or "",
|
||||
)
|
||||
except Exception:
|
||||
logger.debug("Redis 已连接(URL 解析省略)")
|
||||
except Exception as e:
|
||||
logger.error("Redis 连接失败: {}", e)
|
||||
raise
|
||||
|
||||
@@ -3,10 +3,10 @@
|
||||
"""
|
||||
|
||||
import json
|
||||
from app.core.logging import get_logger
|
||||
from datetime import datetime, timezone
|
||||
from typing import Any, Dict, List, Optional
|
||||
from typing import Any, Dict, List
|
||||
|
||||
from app.core.logging import get_logger
|
||||
from app.core.redis import redis_service
|
||||
|
||||
logger = get_logger(__name__)
|
||||
|
||||
@@ -6,9 +6,9 @@ import json
|
||||
import re
|
||||
from typing import Any
|
||||
|
||||
from app.core.json_utils import extract_json_payload
|
||||
from app.core.langchain_llm import invoke_json_object
|
||||
from app.core.logging import get_logger
|
||||
from app.core.json_utils import extract_json_payload
|
||||
|
||||
logger = get_logger(__name__)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user