fix(middlewares): 标题模型推理不再泄漏到 UI 流 + open/ephemeral 会话避免无谓 DB 访问
- title: 标题模型用隔离 config(不继承父级 streaming callbacks),force_disable_thinking,<think> 块清洗,避免推理 token 进入实时流/运行日志 - uploads: 无文件的普通对话轮次直接跳过,不再解析线程归属(避免命中 DB) - thread_data: ephemeral 会话用当前登录用户解析数据目录 - thread_paths: open-/__skill-review__ 等合成线程视为 local-only,直接用当前用户 - frontend: 新增 build:test 构建脚本 Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
1 parent
6aff165d09
commit
acc29c8121
5 files changed
+57
-28
No files matched your search
@@ -42,6 +42,12 @@ logger = logging.getLogger(__name__)
|
||||
_owner_cache: dict[str, str] = {}
|
||||
_owner_cache_lock = threading.Lock()
|
||||
_OWNER_CACHE_MAX = 4096
|
||||
_LOCAL_ONLY_THREAD_PREFIXES = ("open-", "__skill-review__")
|
||||
|
||||
|
||||
def _is_local_only_thread(thread_id: str | None) -> bool:
|
||||
"""Return True for synthetic threads that are never persisted in threads_meta."""
|
||||
return bool(thread_id) and str(thread_id).startswith(_LOCAL_ONLY_THREAD_PREFIXES)
|
||||
|
||||
|
||||
def _cache_get(thread_id: str) -> str | None:
|
||||
@@ -112,7 +118,7 @@ def resolve_path_user_id(thread_id: str | None) -> str:
|
||||
share the conversation read/write the same physical directory. For every
|
||||
other case it is the current login (``get_effective_user_id``).
|
||||
"""
|
||||
if not thread_id:
|
||||
if not thread_id or _is_local_only_thread(thread_id):
|
||||
return get_effective_user_id()
|
||||
cached = _cache_get(thread_id)
|
||||
if cached is not None:
|
||||
@@ -132,7 +138,7 @@ def resolve_path_user_id(thread_id: str | None) -> str:
|
||||
|
||||
async def aresolve_path_user_id(thread_id: str | None) -> str:
|
||||
"""Async variant of :func:`resolve_path_user_id` for FastAPI handlers."""
|
||||
if not thread_id:
|
||||
if not thread_id or _is_local_only_thread(thread_id):
|
||||
return get_effective_user_id()
|
||||
cached = _cache_get(thread_id)
|
||||
if cached is not None:
|
||||
|
||||
Reference in new issue
Block a user