From f4674037d324ed817e0aa48e6d8b8a8d405e52e9 Mon Sep 17 00:00:00 2001 From: Stephen Zhou <38493346+hyoban@users.noreply.github.com> Date: Mon, 17 Nov 2025 18:16:50 +0800 Subject: [PATCH] fix: allow timeline summary for anonymous user --- .../modules/ai-chat/hooks/useSendAIShortcut.ts | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/apps/desktop/layer/renderer/src/modules/ai-chat/hooks/useSendAIShortcut.ts b/apps/desktop/layer/renderer/src/modules/ai-chat/hooks/useSendAIShortcut.ts index f6fd2f4c1..dc5e98e63 100644 --- a/apps/desktop/layer/renderer/src/modules/ai-chat/hooks/useSendAIShortcut.ts +++ b/apps/desktop/layer/renderer/src/modules/ai-chat/hooks/useSendAIShortcut.ts @@ -1,4 +1,5 @@ import { convertLexicalToMarkdown } from "@follow/components/ui/lexical-rich-editor/utils.js" +import { DEFAULT_SUMMARIZE_TIMELINE_SHORTCUT_ID } from "@follow/shared/settings/defaults" import type { AIShortcut } from "@follow/shared/settings/interface" import { getCategoryFeedIds } from "@follow/store/subscription/getter" import type { EditorState } from "lexical" @@ -144,7 +145,8 @@ export const useSendAIShortcut = () => { const sendShortcutMessage = useCallback( (editorState: EditorState, shortcutId?: string) => { - if (!ensureLogin()) { + const isTimelineSummaryShortcut = shortcutId === DEFAULT_SUMMARIZE_TIMELINE_SHORTCUT_ID + if (!isTimelineSummaryShortcut && !ensureLogin()) { return } const contextBlocks = buildContextBlocks() @@ -171,7 +173,16 @@ export const useSendAIShortcut = () => { id: prefixMessageIdWithShortcut(nanoid(), shortcutId), } - void chatActions.sendMessage(message) + void chatActions.sendMessage( + message, + isTimelineSummaryShortcut + ? { + body: { + scene: "timeline-summary", + }, + } + : undefined, + ) }, [buildContextBlocks, chatActions, ensureLogin, staticEditor], )