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:
@@ -166,18 +166,15 @@ async def create_knowledge(
|
||||
return item
|
||||
|
||||
|
||||
def item_link(base_url: str, ws_id: uuid.UUID, item: Item) -> str:
|
||||
"""给人点的链接。`base_url` 传站点根(http://host:8200),不带 /api/v1。"""
|
||||
base = base_url.rstrip("/")
|
||||
if item.kind == "knowledge":
|
||||
return f"{base}/w/{ws_id}/knowledge/{item.id}"
|
||||
return f"{base}/w/{ws_id}?open={item.id}"
|
||||
def reply_text(kind: str, item: Item) -> str:
|
||||
"""回话只说"收下了",不带链接。
|
||||
|
||||
|
||||
def reply_text(kind: str, item: Item, link: str) -> str:
|
||||
链接是站点地址,可"站点地址"对手机不一定打得开(内网 IP、端口、还没上 HTTPS 的域名),
|
||||
发过去反而像坏消息。要看详情回网页里看就行。
|
||||
"""
|
||||
if kind == "knowledge":
|
||||
return f"已存成知识草稿:{item.title}\n{link}"
|
||||
return f"已记下任务:{item.title}\n{link}"
|
||||
return f"已保存知识草稿:{item.title}"
|
||||
return f"已保存任务:{item.title}"
|
||||
|
||||
|
||||
async def handle_text(
|
||||
@@ -208,7 +205,7 @@ async def handle_text(
|
||||
return {
|
||||
"action": "knowledge",
|
||||
"item_id": item.id,
|
||||
"reply": reply_text("knowledge", item, item_link(base_url, channel.workspace_id, item)),
|
||||
"reply": reply_text("knowledge", item),
|
||||
}
|
||||
item = await create_task(
|
||||
session,
|
||||
@@ -221,5 +218,5 @@ async def handle_text(
|
||||
return {
|
||||
"action": "task",
|
||||
"item_id": item.id,
|
||||
"reply": reply_text("task", item, item_link(base_url, channel.workspace_id, item)),
|
||||
"reply": reply_text("task", item),
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user