Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/main'
Browse files Browse the repository at this point in the history
  • Loading branch information
bentwnghk committed Nov 25, 2024
2 parents 24f57b2 + b04f599 commit c95acd4
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 28 deletions.
26 changes: 0 additions & 26 deletions src/services/chat.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {
Expand All @@ -142,39 +136,19 @@ 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,
baseURL: providerAuthPayload?.endpoint,
};
break;
}
case ModelProvider.DeepSeek: {
break;
}
case ModelProvider.OpenRouter: {
break;
}
case ModelProvider.TogetherAI: {
break;
}
case ModelProvider.ZeroOne: {
break;
}
case ModelProvider.Cloudflare: {
providerOptions = {
apikey: providerAuthPayload?.apiKey,
Expand Down
4 changes: 2 additions & 2 deletions src/store/chat/slices/aiChat/actions/generateAIChat.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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, {
Expand Down Expand Up @@ -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;
Expand Down
13 changes: 13 additions & 0 deletions src/store/chat/slices/message/selectors.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit c95acd4

Please sign in to comment.