BugFix: Fix P0/P1 bugs - personal_wechat support, model display_names, dashboard data verification, KB upload test

This commit is contained in:
qyyfw committed 2026-07-06 08:26:50 +08:00
1 parent 4b49333f9d
commit fc36777a5c
1 file changed
+12 -7
+12 -7
View File
@@ -226,13 +226,14 @@ PLATFORM_SLACK = {
PLATFORM_CONFIGS = {
"feishu": PLATFORM_FEISHU,
"wechat": PLATFORM_WECHAT,
"personal_wechat": PLATFORM_WECHAT,
"dingtalk": PLATFORM_DINGTALK,
"whatsapp": PLATFORM_WHATSAPP,
"telegram": PLATFORM_TELEGRAM,
"slack": PLATFORM_SLACK,
}
VALID_PLATFORMS = ("feishu", "wechat", "wecom", "dingtalk", "whatsapp", "telegram", "slack")
VALID_PLATFORMS = ("feishu", "wechat", "personal_wechat", "wecom", "dingtalk", "whatsapp", "telegram", "slack")
SENSITIVE_FIELDS = {"app_secret", "secret", "access_token", "bot_token", "signing_secret", "token",
"api_key", "password", "encrypt_key", "verification_token", "app_token",
@@ -423,19 +424,21 @@ def get_platform_configs():
@router.post("/authorize/scan")
def scan_authorize(
platform: str = Query(...),
platform: str = Query(None),
body: dict = Body({}),
db: Session = Depends(get_db),
current_user: User = Depends(get_current_user),
):
"""扫码授权流程 - 返回授权二维码(微信平台统一调用ClawBot API)"""
if not platform:
platform = body.get("platform", "")
if platform not in VALID_PLATFORMS:
raise HTTPException(status_code=400, detail="不支持的平台类型")
platform_name = PLATFORM_CONFIGS.get(platform, {}).get("name", platform)
# 微信平台:调用微信ClawBot API获取授权二维码
if platform == "wechat":
if platform in ("wechat", "personal_wechat"):
# 获取AppID和Secret(优先从请求体 > 已保存频道配置 > 环境变量)
appid = ""
secret = ""
@@ -447,7 +450,7 @@ def scan_authorize(
# 查找已保存的微信频道
existing_channel = db.query(Channel).filter(
and_(Channel.platform == "wechat", Channel.owner_id == current_user.id)
and_(Channel.platform.in_(["wechat", "personal_wechat"]), Channel.owner_id == current_user.id)
).first()
# 2. 从已保存的频道配置获取
@@ -615,13 +618,15 @@ def scan_authorize_status(
current_user: User = Depends(get_current_user),
):
"""查询扫码授权状态(微信平台调用ClawBot API轮询)"""
if not platform:
platform = body.get("platform", "")
if platform not in VALID_PLATFORMS:
raise HTTPException(status_code=400, detail="不支持的平台类型")
# 微信平台:调用ClawBot API轮询扫码状态
if platform == "wechat":
if platform in ("wechat", "personal_wechat"):
channel = db.query(Channel).filter(
and_(Channel.platform == "wechat", Channel.owner_id == current_user.id)
and_(Channel.platform.in_(["wechat", "personal_wechat"]), Channel.owner_id == current_user.id)
).first()
qrcode_token = channel.oauth_state if channel else None
@@ -1344,7 +1349,7 @@ def channel_reset(
raise HTTPException(status_code=404, detail="频道不存在")
# 微信平台:调用ClawBot API重置通道
if channel.platform == "wechat":
if channel.platform in ("wechat", "personal_wechat"):
# 获取AppID和Secret用于签名
appid = os.environ.get("WECHAT_APPID", "")
secret = os.environ.get("WECHAT_SECRET", "")