diff --git a/src/services/chat.ts b/src/services/chat.ts index f57f05db2466..02ef60f45b76 100644 --- a/src/services/chat.ts +++ b/src/services/chat.ts @@ -106,18 +106,12 @@ export function initializeWithClientStore(provider: string, payload: any) { }; break; } - case ModelProvider.ZhiPu: { - break; - } case ModelProvider.Google: { providerOptions = { baseURL: providerAuthPayload?.endpoint, }; break; } - case ModelProvider.Moonshot: { - break; - } case ModelProvider.Bedrock: { if (providerAuthPayload?.apiKey) { providerOptions = { @@ -142,20 +136,12 @@ export function initializeWithClientStore(provider: string, payload: any) { }; break; } - case ModelProvider.Qwen: { - break; - } - case ModelProvider.Anthropic: { providerOptions = { baseURL: providerAuthPayload?.endpoint, }; break; } - - case ModelProvider.Mistral: { - break; - } case ModelProvider.Groq: { providerOptions = { apikey: providerAuthPayload?.apiKey, @@ -163,18 +149,6 @@ export function initializeWithClientStore(provider: string, payload: any) { }; break; } - case ModelProvider.DeepSeek: { - break; - } - case ModelProvider.OpenRouter: { - break; - } - case ModelProvider.TogetherAI: { - break; - } - case ModelProvider.ZeroOne: { - break; - } case ModelProvider.Cloudflare: { providerOptions = { apikey: providerAuthPayload?.apiKey, diff --git a/src/store/chat/slices/aiChat/actions/generateAIChat.ts b/src/store/chat/slices/aiChat/actions/generateAIChat.ts index 86dd6d871d9b..a7b41ecb44d5 100644 --- a/src/store/chat/slices/aiChat/actions/generateAIChat.ts +++ b/src/store/chat/slices/aiChat/actions/generateAIChat.ts @@ -207,7 +207,7 @@ export const generateAIChat: StateCreator< } // Get the current messages to generate AI response - const messages = chatSelectors.mainDisplayChats(get()); + const messages = chatSelectors.activeBaseChats(get()); const userFiles = chatSelectors.currentUserFiles(get()).map((f) => f.id); await internal_coreProcessMessage(messages, id, { @@ -484,7 +484,7 @@ export const generateAIChat: StateCreator< internal_resendMessage: async (messageId, traceId) => { // 1. 构造所有相关的历史记录 - const chats = chatSelectors.mainDisplayChats(get()); + const chats = chatSelectors.activeBaseChats(get()); const currentIndex = chats.findIndex((c) => c.id === messageId); if (currentIndex < 0) return; diff --git a/src/store/chat/slices/message/selectors.test.ts b/src/store/chat/slices/message/selectors.test.ts index c9e9994683c0..e91692ea53f5 100644 --- a/src/store/chat/slices/message/selectors.test.ts +++ b/src/store/chat/slices/message/selectors.test.ts @@ -232,6 +232,19 @@ describe('chatSelectors', () => { }); }); + describe('mainDisplayChats', () => { + it('should return existing messages except tool message', () => { + const state = merge(initialStore, { + messagesMap: { + [messageMapKey('someActiveId')]: mockMessages, + }, + activeId: 'someActiveId', + }); + const chats = chatSelectors.mainDisplayChats(state); + expect(chats).toEqual(mockedChats.slice(0, 2)); + }); + }); + describe('chatsMessageString', () => { it('should concatenate the contents of all messages returned by currentChatsWithHistoryConfig', () => { // Prepare a state with a few messages