- 知识库笔记列表支持按实体精确筛选(路由/服务/仓储层透传,关系图索引查询) - 自定义智能体技能白名单在 skill_view 与 skill_manage 的 list/view 别名上同样生效; config 未声明 skills 时视为无可见技能 - 嵌入圆桌主题解析默认深蓝,强制主题期间不再写 localStorage 覆盖主站选择 - 智能体提问建议拆出 agent-question-chips 组件,编辑器与详情面板联动优化 - 新增 qa-client 问答测试脚本 Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
58 lines
1.8 KiB
TypeScript
58 lines
1.8 KiB
TypeScript
import { resolveThemeFromQuery } from "@/core/auth/external-login";
|
||
|
||
const DEFAULT_USERNAME = "guest";
|
||
|
||
export type EmbedChatParams = {
|
||
/** Parent correlation id — required for status polling without thread_id. */
|
||
sessionId: string;
|
||
message: string;
|
||
username: string;
|
||
theme: string;
|
||
};
|
||
|
||
/**
|
||
* Resolve iframe embed params from URL query only (plain iframe, not wujie).
|
||
*
|
||
* Parent must generate ``sessionId`` and pass it on the iframe URL so it can
|
||
* poll ``GET /api/public/embed/sessions/{sessionId}/status`` without reading
|
||
* the child frame.
|
||
*/
|
||
export function resolveEmbedChatParams(search: string): EmbedChatParams {
|
||
const params = new URLSearchParams(search.startsWith("?") ? search : `?${search}`);
|
||
|
||
const sessionId =
|
||
params.get("sessionId")?.trim() ||
|
||
params.get("session_id")?.trim() ||
|
||
"";
|
||
|
||
const message =
|
||
params.get("message")?.trim() ||
|
||
params.get("question")?.trim() ||
|
||
params.get("text")?.trim() ||
|
||
"";
|
||
|
||
const username =
|
||
params.get("username")?.trim() ||
|
||
params.get("userName")?.trim() ||
|
||
DEFAULT_USERNAME;
|
||
|
||
const theme = params.get("theme")?.trim() || "";
|
||
|
||
return { sessionId, message, username, theme };
|
||
}
|
||
|
||
export function resolveEmbedTheme(themeParam: string): "dark" | "light" {
|
||
return resolveThemeFromQuery(themeParam || null);
|
||
}
|
||
|
||
/**
|
||
* 把宿主传入的主题标识映射成 light/dark。**默认深蓝(dark)**:
|
||
* 只有明确传 light/红白 才走浅色,其余(dark / dark-blue / 深蓝 / 空)一律深蓝。
|
||
* 不复用 `resolveEmbedTheme`(它只认严格的 "dark-blue",传 "dark" 会被判成浅色)。
|
||
*/
|
||
export function resolveEmbedRoundtableTheme(raw: string): "dark" | "light" {
|
||
const v = raw.trim().toLowerCase();
|
||
if (v === "light" || v === "red" || v === "红白") return "light";
|
||
return "dark";
|
||
}
|