🤯 LobeHub - Super-Agents on Your Team. Add super-agents to the chats your team already uses.They take on work by themselves and get better every week.
TypeScript agentagent-collaborationagent-harnessloop-engineeringmcppersonal-assistantproactive-agentskillssuper-agenttask-management
🐛 fix(topic): use responseLanguage for topic/thread title summarization (#12627)
YuTengjingb44f79857bef
diff --git a/src/store/chat/slices/thread/action.test.ts b/src/store/chat/slices/thread/action.test.tsindex 81a001952f8..2c7cffec1c6 100644--- a/src/store/chat/slices/thread/action.test.ts+++ b/src/store/chat/slices/thread/action.test.ts@@ -79,6 +79,9 @@ vi.mock('@/store/user/selectors', () => ({systemAgentSelectors: {thread: vi.fn(() => ({})),},+ userGeneralSettingsSelectors: {+ responseLanguage: vi.fn(() => undefined),+ },userProfileSelectors: {userAvatar: vi.fn(() => 'avatar-url'),},diff --git a/src/store/chat/slices/thread/action.ts b/src/store/chat/slices/thread/action.tsindex d25c92cdb9f..dfbcf0c9449 100644--- a/src/store/chat/slices/thread/action.ts+++ b/src/store/chat/slices/thread/action.ts@@ -18,7 +18,7 @@ import { type ChatStore } from '@/store/chat/store';import { globalHelpers } from '@/store/global/helpers';import { type StoreSetter } from '@/store/types';import { useUserStore } from '@/store/user';-import { systemAgentSelectors } from '@/store/user/selectors';+import { systemAgentSelectors, userGeneralSettingsSelectors } from '@/store/user/selectors';import { merge } from '@/utils/merge';import { setNamespace } from '@/utils/storeDebug';@@ -202,7 +202,14 @@ export class ChatThreadActionImpl {internal_updateThreadTitleInSummary(threadId, output);},- params: merge(threadConfig, chainSummaryTitle(messages, globalHelpers.getCurrentLanguage())),+ params: merge(+ threadConfig,+ chainSummaryTitle(+ messages,+ userGeneralSettingsSelectors.responseLanguage(useUserStore.getState()) ||+ globalHelpers.getCurrentLanguage(),+ ),+ ),});};diff --git a/src/store/chat/slices/topic/action.ts b/src/store/chat/slices/topic/action.tsindex 29e480b1c31..74bda02fe2b 100644--- a/src/store/chat/slices/topic/action.ts+++ b/src/store/chat/slices/topic/action.ts@@ -20,7 +20,7 @@ import { useGlobalStore } from '@/store/global';import { globalHelpers } from '@/store/global/helpers';import { type StoreSetter } from '@/store/types';import { useUserStore } from '@/store/user';-import { systemAgentSelectors } from '@/store/user/selectors';+import { systemAgentSelectors, userGeneralSettingsSelectors } from '@/store/user/selectors';import { type ChatTopic, type CreateTopicParams } from '@/types/topic';import { merge } from '@/utils/merge';import { setNamespace } from '@/utils/storeDebug';@@ -221,7 +221,14 @@ export class ChatTopicActionImpl {internal_updateTopicTitleInSummary(topicId, output);},- params: merge(topicConfig, chainSummaryTitle(messages, globalHelpers.getCurrentLanguage())),+ params: merge(+ topicConfig,+ chainSummaryTitle(+ messages,+ userGeneralSettingsSelectors.responseLanguage(useUserStore.getState()) ||+ globalHelpers.getCurrentLanguage(),+ ),+ ),trace: this.#get().getCurrentTracePayload({traceName: TraceNameMap.SummaryTopicTitle,topicId,diff --git a/src/store/image/slices/generationTopic/action.test.ts b/src/store/image/slices/generationTopic/action.test.tsindex af434e205e2..26e22970c69 100644--- a/src/store/image/slices/generationTopic/action.test.ts+++ b/src/store/image/slices/generationTopic/action.test.ts@@ -47,6 +47,9 @@ vi.mock('@/store/user/selectors', () => ({provider: 'openai',}),},+ userGeneralSettingsSelectors: {+ responseLanguage: vi.fn(() => undefined),+ },}));beforeEach(() => {diff --git a/src/store/image/slices/generationTopic/action.ts b/src/store/image/slices/generationTopic/action.tsindex a409ce7797f..709ba935cda 100644--- a/src/store/image/slices/generationTopic/action.ts+++ b/src/store/image/slices/generationTopic/action.ts@@ -10,7 +10,7 @@ import { generationTopicService } from '@/services/generationTopic';import { globalHelpers } from '@/store/global/helpers';import { type StoreSetter } from '@/store/types';import { useUserStore } from '@/store/user';-import { systemAgentSelectors } from '@/store/user/selectors';+import { systemAgentSelectors, userGeneralSettingsSelectors } from '@/store/user/selectors';import { type ImageGenerationTopic } from '@/types/generation';import { merge } from '@/utils/merge';import { setNamespace } from '@/utils/storeDebug';@@ -108,7 +108,12 @@ export class GenerationTopicActionImpl {await chatService.fetchPresetTaskResult({params: merge(generationTopicAgentConfig,- chainSummaryGenerationTitle(prompts, 'image', globalHelpers.getCurrentLanguage()),+ chainSummaryGenerationTitle(+ prompts,+ 'image',+ userGeneralSettingsSelectors.responseLanguage(useUserStore.getState()) ||+ globalHelpers.getCurrentLanguage(),+ ),),onError: async () => {const fallbackTitle = generateFallbackTitle();diff --git a/src/store/user/slices/settings/selectors/general.ts b/src/store/user/slices/settings/selectors/general.tsindex bd68df6b5e1..7ae1285882e 100644--- a/src/store/user/slices/settings/selectors/general.ts+++ b/src/store/user/slices/settings/selectors/general.ts@@ -17,6 +17,7 @@ const contextMenuMode = (s: UserStore) => {if (config !== undefined) return config;return isDesktop ? 'default' : 'disabled';};+const responseLanguage = (s: UserStore) => generalConfig(s).responseLanguage;const telemetry = (s: UserStore) => generalConfig(s).telemetry;const enableAutoScrollOnStreaming = (s: UserStore) =>generalConfig(s).enableAutoScrollOnStreaming ?? true;@@ -31,6 +32,7 @@ export const userGeneralSettingsSelectors = {mermaidTheme,neutralColor,primaryColor,+ responseLanguage,telemetry,transitionMode,};diff --git a/src/store/video/slices/generationTopic/action.ts b/src/store/video/slices/generationTopic/action.tsindex 53dce444c04..fc87cea0a6a 100644--- a/src/store/video/slices/generationTopic/action.ts+++ b/src/store/video/slices/generationTopic/action.ts@@ -10,7 +10,7 @@ import { chatService } from '@/services/chat';import { generationTopicService } from '@/services/generationTopic';import { globalHelpers } from '@/store/global/helpers';import { useUserStore } from '@/store/user';-import { systemAgentSelectors } from '@/store/user/selectors';+import { systemAgentSelectors, userGeneralSettingsSelectors } from '@/store/user/selectors';import { type ImageGenerationTopic } from '@/types/generation';import { merge } from '@/utils/merge';import { setNamespace } from '@/utils/storeDebug';@@ -252,7 +252,12 @@ export const createGenerationTopicSlice: StateCreator<},params: merge(generationTopicAgentConfig,- chainSummaryGenerationTitle(prompts, 'video', globalHelpers.getCurrentLanguage()),+ chainSummaryGenerationTitle(+ prompts,+ 'video',+ userGeneralSettingsSelectors.responseLanguage(useUserStore.getState()) ||+ globalHelpers.getCurrentLanguage(),+ ),),});