Files
UHD_Media_Tool/apps/web/app/components/agent/quick-goals.ts
T
rootandClaude Opus 5.5 39a001c099 feat(web): prominent agent launcher (FAB, Ctrl/Cmd+J, sidebar entry, quick goals)
- Bottom-right FAB (56px, prism ring) with active-run count, pulse and latest
  status summary; turns into "collapse" beside the open drawer; hidden on the
  Agent page and while the mini dock shows; lifts above bottom floating bars
- Ctrl/Cmd+J toggles the drawer, Esc closes; input is focused on open
- Emphasized Agent entry at the top of the sidebar (expanded and collapsed)
  with active-run count; header button kept only below xl
- Drawer first screen offers 3 page-aware quick goals that fill the input
- Respects reduced motion; AgentShortcutsHelp exported for the settings page

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-09-28 02:10:28 +08:00

70 lines
2.9 KiB
TypeScript

// 抽屉首屏的快捷目标:按当前页面给 3 个最常见的问法,点一下填进输入框(不直接提交)。
// 以空格结尾的是"半句",填入后光标停在末尾等用户补完(如"从这个站找 ")。
type Rule = { match: RegExp; goals: [string, string, string] };
const RULES: Rule[] = [
{
match: /^\/console\/library\/[^/]+/,
goals: ["检查这部作品缺什么版本", "这部作品有没有更好的片源可以升级", "核对这部作品的文件和元数据是否一致"],
},
{
match: /^\/console\/library\/?$/,
goals: ["盘点媒体库里还缺 4K 版本的作品", "找出最近入库但没识别成功的作品", "列出占用空间最大的 10 部作品"],
},
{
match: /^\/console\/sites\/[^/]+/,
goals: ["从这个站找 ", "看看这个站最近有哪些新的 4K 资源", "检查这个站的登录和抓取是否正常"],
},
{
match: /^\/console\/sites\/?$/,
goals: ["在所有站点里找 ", "哪个站点最近抓取失败了,原因是什么", "对比各站点最近一周的新资源数量"],
},
{
match: /^\/console\/tasks\/[^/]+/,
goals: ["看看为什么没进展", "下载完成后帮我整理入库", "换一个做种更多的资源重新下载"],
},
{
match: /^\/console\/tasks\/?$/,
goals: ["看看哪些下载卡住了、为什么没进展", "汇总今天的下载和整理结果", "找出失败的任务并说明原因"],
},
{
match: /^\/console\/organize/,
goals: ["这次整理为什么有文件失败", "核对整理后的路径是否符合命名规则", "把失败的文件重新整理一遍"],
},
{
match: /^\/console\/files/,
goals: ["把下载目录里还没整理的文件整理入库", "找出重复的文件", "看看哪些文件还没被识别"],
},
{
match: /^\/console\/inbox/,
goals: ["逐条说明待处理事项的原因和建议", "先处理最紧急的一项", "哪些事项可以直接按建议批量处理"],
},
{
match: /^\/console\/identity/,
goals: ["帮我识别待识别池里的文件", "找出外部身份映射可能错误的作品", "补全缺少元数据的作品"],
},
{
match: /^\/console\/subscriptions/,
goals: ["帮我新建一个订阅:", "哪些订阅很久没有新收录了", "检查订阅的版本目标是否合理"],
},
{
match: /^\/console\/sources/,
goals: ["哪些来源不新鲜了,原因是什么", "检查所有 RSS 的抓取状态", "最近一天各来源抓到了什么"],
},
{
match: /^\/console\/engine/,
goals: ["这个任务为什么失败", "哪些工作流一直在重试", "汇总最近一小时失败的运行"],
},
];
const FALLBACK: [string, string, string] = [
"收一部电影:",
"看看今天有什么需要我处理的",
"检查下载器和媒体服务器是否正常",
];
export function quickGoalsFor(pathname: string): string[] {
return RULES.find((r) => r.match.test(pathname))?.goals ?? FALLBACK;
}