落地并存测服全端:智能体 Graph/路由、后台切 8180、主账与部署脚本齐备,便于线上重发与验收。

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
linmianxun
2026-09-13 21:15:58 +08:00
co-authored by Cursor
parent 0eb1adecc8
commit 8103b3b651
143 changed files with 8968 additions and 277 deletions
+46
View File
@@ -0,0 +1,46 @@
"""
Redis 键名拼装。
本文件职责:所有 Redis key 必须带 REDIS_KEY_PREFIX,避免与现网 ytd:prod: 冲突。
说明:Redis 的「db1」是连接 URL 里的数字库号(/1),不是库名;
可读业务名靠前缀 inquiry_robot:(见 prompt/14、13)。
禁止:写入 checkpoint / 六态 / Worker 全局单例锁键。
"""
from __future__ import annotations
def normalize_prefix(prefix: str) -> str:
"""
规范化前缀:去掉首尾空白,确保以冒号结尾便于拼接。
例:inquiry_robot → inquiry_robot:
"""
p = (prefix or "").strip()
if not p:
return "inquiry_robot:"
return p if p.endswith(":") else f"{p}:"
def join_key(prefix: str, *parts: str) -> str:
"""
拼完整 key:{prefix}{part1}:{part2}:…
参数 parts 不得包含前缀本身;空段丢弃。
"""
base = normalize_prefix(prefix)
segs = [str(p).strip(":") for p in parts if p is not None and str(p).strip() != ""]
if not segs:
return base.rstrip(":")
return base + ":".join(segs)
# 约定后缀(骨架);正式业务可扩展,勿改成无前缀的裸键
STREAM_LLM = "stream:llm"
STREAM_RECOGNITION = "stream:recognition"
STREAM_PDF = "stream:pdf"
STREAM_ARCHIVE = "stream:archive"
STREAM_WAKE = "stream:wake"
IDEMPOTENCY = "idem"
RATE_LIMIT = "ratelimit"
TOKEN_WECOM = "token:wecom"