diff --git a/apps/desktop/layer/renderer/src/modules/ai-chat/components/layouts/ChatShortcutsRow.tsx b/apps/desktop/layer/renderer/src/modules/ai-chat/components/layouts/ChatShortcutsRow.tsx index 9304c4668..b187c4a8f 100644 --- a/apps/desktop/layer/renderer/src/modules/ai-chat/components/layouts/ChatShortcutsRow.tsx +++ b/apps/desktop/layer/renderer/src/modules/ai-chat/components/layouts/ChatShortcutsRow.tsx @@ -1,3 +1,4 @@ +import { getReadonlyRoute } from "@follow/components/atoms/route.js" import { DEFAULT_SHORTCUT_TARGETS } from "@follow/shared/settings/interface" import { useCallback, useMemo } from "react" import { useTranslation } from "react-i18next" @@ -17,12 +18,13 @@ export const ChatShortcutsRow: React.FC = ({ onSelect }) const { t } = useTranslation("ai") const aiSettings = useAISettingValue() const mainEntryId = useMainEntryId() + const isAiPage = useMemo(() => getReadonlyRoute().location.pathname === "/ai", []) const shortcutsToDisplay = useMemo(() => { const shortcuts = aiSettings.shortcuts ?? [] const list: typeof shortcuts = [] const entry: typeof shortcuts = [] - + const aiPage: typeof shortcuts = [] for (const shortcut of shortcuts) { if (!shortcut.enabled) continue const targets = @@ -35,10 +37,19 @@ export const ChatShortcutsRow: React.FC = ({ onSelect }) if (targets.includes("entry")) { entry.push(shortcut) } + if (targets.includes("ai-page")) { + aiPage.push(shortcut) + } } - return (mainEntryId ? entry : list) ?? [] - }, [aiSettings.shortcuts, mainEntryId]) + if (mainEntryId) { + return entry + } + if (isAiPage) { + return aiPage + } + return list + }, [aiSettings.shortcuts, mainEntryId, isAiPage]) const handleAddShortcut = useCreateAIShortcutModal() const handleCustomize = useCallback(() => { @@ -52,9 +63,12 @@ export const ChatShortcutsRow: React.FC = ({ onSelect }) onClick={handleCustomize} animationDelay={0} size="sm" - title={t("customize_shortcuts_title")} + title={t("new_shortcuts")} > + 0 ? "sr-only" : "text-text"}> + {t("new_shortcuts")} + {shortcutsToDisplay.map((shortcut) => ( {t("shortcuts.targets.entry")} +

{t("shortcuts.targets.help")}

diff --git a/locales/ai/en.json b/locales/ai/en.json index cd4d22487..ea6529542 100644 --- a/locales/ai/en.json +++ b/locales/ai/en.json @@ -27,7 +27,6 @@ "common.generating_title": "Generating title...", "common.new_chat": "New Chat", "customize_shortcuts": "Customize shortcuts", - "customize_shortcuts_title": "Customize AI shortcuts", "delete_chat": "Delete Chat", "delete_chat_error": "Failed to delete chat", "delete_chat_message": "Are you sure you want to delete \"{{title}}\"? This action cannot be undone.", @@ -125,6 +124,7 @@ "mentions.section.entry": "Entries", "mentions.section.feed": "Feeds", "mentions.section.view": "Views", + "new_shortcuts": "New shortcut", "personalize.description": "Tell me about yourself to get personalized AI responses.", "personalize.prompt.help": "This helps AI provide personalized responses based on your preferences.", "personalize.prompt.placeholder": "Tell me about yourself and how you prefer to read content...", @@ -185,6 +185,7 @@ "shortcuts.name_placeholder": "e.g. Summarize Article", "shortcuts.prompt": "Prompt", "shortcuts.prompt_placeholder": "Write a clear instruction for the AI...", + "shortcuts.targets.ai-page": "AI Page", "shortcuts.targets.entry": "Entry Details", "shortcuts.targets.help": "Choose scenarios to control where this shortcut appears.", "shortcuts.targets.label": "Display location", diff --git a/locales/ai/ja.json b/locales/ai/ja.json index cb2d87d22..5f33aadfb 100644 --- a/locales/ai/ja.json +++ b/locales/ai/ja.json @@ -27,7 +27,6 @@ "common.generating_title": "タイトルを生成中...", "common.new_chat": "新規チャット", "customize_shortcuts": "ショートカットをカスタマイズ", - "customize_shortcuts_title": "AIショートカットをカスタマイズ", "delete_chat": "Chat を削除", "delete_chat_error": "Chat の削除に失敗しました", "delete_chat_message": "本当に「{{title}}」を削除してもよろしいですか?この操作は元に戻すことはできません。", diff --git a/locales/ai/zh-CN.json b/locales/ai/zh-CN.json index 9f34d4f55..9f17a4cad 100644 --- a/locales/ai/zh-CN.json +++ b/locales/ai/zh-CN.json @@ -27,7 +27,6 @@ "common.generating_title": "正在生成标题...", "common.new_chat": "新对话", "customize_shortcuts": "自定义快捷方式", - "customize_shortcuts_title": "自定义 AI 快捷方式", "delete_chat": "删除对话", "delete_chat_error": "删除对话失败", "delete_chat_message": "确定要删除\"{{title}}\"吗?此操作无法撤销。", @@ -179,6 +178,7 @@ "shortcuts.name_placeholder": "例如:总结文章", "shortcuts.prompt": "提示", "shortcuts.prompt_placeholder": "为AI编写清晰的指令...", + "shortcuts.targets.ai-page": "AI 页面", "shortcuts.targets.entry": "条目详情", "shortcuts.targets.help": "选择适用场景以控制此快捷方式的展示位置。", "shortcuts.targets.label": "展示位置", diff --git a/packages/internal/shared/src/settings/interface.ts b/packages/internal/shared/src/settings/interface.ts index 1286cf4f2..cb347c546 100644 --- a/packages/internal/shared/src/settings/interface.ts +++ b/packages/internal/shared/src/settings/interface.ts @@ -182,9 +182,9 @@ export interface CustomIntegration { enabled: boolean } -export type AIShortcutTarget = "list" | "entry" +export type AIShortcutTarget = "list" | "entry" | "ai-page" -export const DEFAULT_SHORTCUT_TARGETS: readonly AIShortcutTarget[] = ["list", "entry"] +export const DEFAULT_SHORTCUT_TARGETS: readonly AIShortcutTarget[] = ["list", "entry", "ai-page"] export interface AIShortcut { id: string