From b762cfd60bf38c7167386c6825b91ecf060d69c3 Mon Sep 17 00:00:00 2001 From: kangfenmao Date: Mon, 9 Jun 2025 15:39:30 +0800 Subject: [PATCH] feat: enhance summarization prompt and add topic sidebar visibility toggle --- src/renderer/src/config/prompts.ts | 2 +- src/renderer/src/hooks/useChat.tsx | 8 ++++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/src/renderer/src/config/prompts.ts b/src/renderer/src/config/prompts.ts index ead2dc1333..8484bf54d5 100644 --- a/src/renderer/src/config/prompts.ts +++ b/src/renderer/src/config/prompts.ts @@ -47,7 +47,7 @@ As [role name], with [list skills], strictly adhering to [list constraints], usi ` export const SUMMARIZE_PROMPT = - "You are an assistant skilled in conversation. You need to summarize the user's conversation into a title within 10 words. The language of the title should be consistent with the user's primary language. Do not use punctuation marks or other special symbols" + "You are an assistant skilled in conversation. You need to summarize the user's conversation into a title within 10 words. The language of the title should be consistent with the user's primary language. Do not use punctuation marks, markdown language markers, or other special symbols" // https://github.com/ItzCrazyKns/Perplexica/blob/master/src/lib/prompts/webSearch.ts export const SEARCH_SUMMARY_PROMPT = ` diff --git a/src/renderer/src/hooks/useChat.tsx b/src/renderer/src/hooks/useChat.tsx index be44bccb77..d9c51b56d0 100644 --- a/src/renderer/src/hooks/useChat.tsx +++ b/src/renderer/src/hooks/useChat.tsx @@ -7,11 +7,13 @@ import { Topic } from '@renderer/types' import { useEffect } from 'react' import { useAssistants } from './useAssistant' +import { useSettings } from './useSettings' export const useChat = () => { const { assistants } = useAssistants() const activeAssistant = useAppSelector((state) => state.runtime.chat.activeAssistant) || assistants[0] const activeTopic = useAppSelector((state) => state.runtime.chat.activeTopic) || activeAssistant?.topics[0]! + const { clickAssistantToShowTopic } = useSettings() const dispatch = useAppDispatch() useEffect(() => { @@ -26,6 +28,12 @@ export const useChat = () => { firstTopic && dispatch(setActiveTopic(firstTopic)) }, [activeAssistant, dispatch]) + useEffect(() => { + if (clickAssistantToShowTopic) { + EventEmitter.emit(EVENT_NAMES.SHOW_TOPIC_SIDEBAR) + } + }, [clickAssistantToShowTopic, activeAssistant]) + return { activeAssistant, activeTopic,