feat(chat): 完善聊天恢复与会话管理体验

- 聊天:断流保留内容、同请求重试和阅读位置恢复
- 会话:搜索、命名、置顶、撤销删除和具名分支来源
- 发现与设定:最近聊天、开场预览及账号设置作用范围
- 组件与测试:拆分列表、弹窗和阅读逻辑,补充流解析回归
This commit is contained in:
湛兮
2026-10-28 19:19:38 +08:00
parent 76abb3ecfb
commit 15f672e10d
12 changed files with 953 additions and 128 deletions
+8 -2
View File
@@ -33,7 +33,7 @@ async function proxy(
const { path } = await context.params;
const joined = path.join("/");
if (
!/^(bootstrap|profile|exposure|decisions\/[a-zA-Z0-9_-]+|conversations(?:\/[a-zA-Z0-9_-]+(?:\/(?:stream|stop|branch|suggestions|style-policy|messages\/[a-zA-Z0-9_-]+))?)?)$/.test(
!/^(bootstrap|profile|exposure|decisions\/[a-zA-Z0-9_-]+|conversations(?:\/[a-zA-Z0-9_-]+(?:\/(?:stream|stop|branch|restore|suggestions|style-policy|messages\/[a-zA-Z0-9_-]+))?)?)$/.test(
joined,
)
)
@@ -55,6 +55,12 @@ async function proxy(
return Response.json({ message: "请求来源不合法" }, { status: 403 });
}
}
const search =
request.method === "GET" && joined === "conversations"
? new URL(request.url).searchParams.get("q")
: null;
const query =
search === null ? "" : `?q=${encodeURIComponent(search.slice(0, 100))}`;
const token = await getSessionToken();
if (!token) return Response.json({ message: "请先登录" }, { status: 401 });
const headers = new Headers({
@@ -63,7 +69,7 @@ async function proxy(
});
try {
const response = await fetch(
`${getBackendBaseUrl().replace(/\/$/, "")}/digital/${joined}`,
`${getBackendBaseUrl().replace(/\/$/, "")}/digital/${joined}${query}`,
{
method: request.method,
headers,