fix(integrations): 扫码确认后不再 500,回话不带链接,栏目改叫「机器人」
CI / backend (push) Canceled after 0s

1. 扫码确认那一刻页面报「服务器内部错误」:`bot_channel` 的轮询口子直接
   `current_setting('app.bot_channel', true)::uuid`,而事务级 set_config 提交后
   会把连接上的变量还原成空串而不是 NULL,空串 cast 就 InvalidTextRepresentation。
   迁移 0015 改成 nullif(...,'')::uuid,与 app_ws_id() 同一写法。
2. 微信回话只回「已保存任务:…」/「已保存知识草稿:…」,不再带站点链接
   (PUBLIC_BASE_URL 是内网地址,手机上打不开)。
3. 栏目名「接入」改名「机器人」;页面标题与提示文案同步。

pytest 151 passed;ruff check/format 干净;tsc 0;vite build 通过;
web/e2e/integrations.mjs 7 项全绿。
This commit is contained in:
Steven
2026-11-05 23:22:49 +08:00
parent 8e3dc65cc6
commit 1e8cd01b3d
9 changed files with 94 additions and 25 deletions
+1 -1
View File
@@ -67,7 +67,7 @@ async function main() {
);
await page.goto(`${WEB}/w/${ws.id}/integrations`, { waitUntil: "networkidle" });
check("接入页打开", await page.getByText("怎么用").isVisible());
check("机器人页打开", await page.getByText("怎么用").isVisible());
const button = page.getByRole("button", { name: "扫码连接微信" });
if (await button.isVisible()) {
+1 -1
View File
@@ -39,7 +39,7 @@ const NAV: { key: Section; label: string; to: (id: string) => string; icon: Reac
icon: <Bell size={16} />,
},
{ key: "members", label: "成员", to: (id) => `/w/${id}/members`, icon: <Users size={16} /> },
{ key: "integrations", label: "接入", to: (id) => `/w/${id}/integrations`, icon: <Chat size={16} /> },
{ key: "integrations", label: "机器人", to: (id) => `/w/${id}/integrations`, icon: <Chat size={16} /> },
];
function initial(name: string) {
+4 -4
View File
@@ -56,7 +56,7 @@ function ChannelStatus({ channel }: { channel: BotChannel }) {
}
/**
* 接入页:把微信(clawbot)接进这个工作区。
* 机器人页:把微信(clawbot)接进这个工作区。
*
* 走的是腾讯 iLink Bot 协议:**扫码登录 → 后端长轮询收消息 → 用 context_token 回复**。
* 页面这一侧只做两件事:把二维码画出来、反复问「扫了没」。
@@ -85,7 +85,7 @@ export function IntegrationsPage() {
const data = await api.get<{ items: BotChannel[] }>(`/workspaces/${wsId}/integrations`);
setChannels(data.items);
} catch (err) {
setError(err instanceof ApiError ? err.message : "读不到接入配置");
setError(err instanceof ApiError ? err.message : "读不到机器人配置");
} finally {
setLoading(false);
}
@@ -188,7 +188,7 @@ export function IntegrationsPage() {
return (
<AppShell wsId={wsId} active="integrations">
<PageHeader
title="接入"
title="机器人"
desc="微信里发一句话,这里就多一条任务或知识。不用装 App,也不用切浏览器。"
actions={
canManage ? (
@@ -335,7 +335,7 @@ export function IntegrationsPage() {
{!canManage ? (
<p className="mt-3 text-xs text-ink-500">
你不是这个工作区的管理员,能看到接入状态,但不能扫码或断开。
你不是这个工作区的管理员,能看到机器人的状态,但不能扫码或断开。
</p>
) : null}
</>