Skip to content

Commit 54c3aa4

Browse files
committed
feat: remove ununsed pluginKeys
1 parent dd0b878 commit 54c3aa4

File tree

2 files changed

+4
-31
lines changed

2 files changed

+4
-31
lines changed

src/components/Chat/Chat.tsx

Lines changed: 3 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ interface Props {
2121

2222
export const Chat = memo(({ stopConversationRef }: Props) => {
2323
const {
24-
state: { selectedConversation, conversations, models, apiKey, pluginKeys },
24+
state: { selectedConversation, conversations, apiKey },
2525
handleUpdateConversation,
2626
dispatch: homeDispatch,
2727
} = useContext(HomeContext);
@@ -37,7 +37,7 @@ export const Chat = memo(({ stopConversationRef }: Props) => {
3737
const textareaRef = useRef<HTMLTextAreaElement>(null);
3838

3939
const handleSend = useCallback(
40-
async (message: Message, deleteCount = 0, plugin: Plugin | null = null) => {
40+
async (message: Message, deleteCount = 0) => {
4141
if (selectedConversation) {
4242
let updatedConversation: Conversation;
4343
if (deleteCount) {
@@ -61,27 +61,6 @@ export const Chat = memo(({ stopConversationRef }: Props) => {
6161
});
6262
homeDispatch({ field: 'loading', value: true });
6363
homeDispatch({ field: 'messageIsStreaming', value: true });
64-
const chatBody: ChatBody = {
65-
model: updatedConversation.model,
66-
messages: updatedConversation.messages,
67-
key: apiKey,
68-
prompt: updatedConversation.prompt,
69-
temperature: updatedConversation.temperature,
70-
};
71-
let body;
72-
if (!plugin) {
73-
body = JSON.stringify(chatBody);
74-
} else {
75-
body = JSON.stringify({
76-
...chatBody,
77-
googleAPIKey: pluginKeys
78-
.find((key) => key.pluginId === 'google-search')
79-
?.requiredKeys.find((key) => key.key === 'GOOGLE_API_KEY')?.value,
80-
googleCSEId: pluginKeys
81-
.find((key) => key.pluginId === 'google-search')
82-
?.requiredKeys.find((key) => key.key === 'GOOGLE_CSE_ID')?.value,
83-
});
84-
}
8564
if (updatedConversation.messages.length === 1) {
8665
const { content } = message;
8766
const customName =
@@ -246,7 +225,6 @@ QuickSort is an efficient, in-place sorting algorithm that, in practice, outperf
246225
[
247226
apiKey,
248227
conversations,
249-
pluginKeys,
250228
selectedConversation,
251229
stopConversationRef,
252230
],
@@ -369,7 +347,7 @@ QuickSort is an efficient, in-place sorting algorithm that, in practice, outperf
369347
onScrollDownClick={handleScrollDown}
370348
onRegenerate={() => {
371349
if (currentMessage) {
372-
handleSend(currentMessage, 2, null);
350+
handleSend(currentMessage, 2);
373351
}
374352
}}
375353
showScrollDownButton={showScrollDownButton}

src/components/ReactStreamChat/home.state.tsx

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,10 @@
11
import { Conversation, Message } from '@/types/chat';
22
import { FolderInterface } from '@/types/folder';
33
import { OpenAIModel, OpenAIModelID } from '@/types/openai';
4-
import { PluginKey } from '@/types/plugin';
54
import { Prompt } from '@/types/prompt';
65

76
export interface HomeInitialState {
87
apiKey: string;
9-
pluginKeys: PluginKey[];
108
loading: boolean;
119
lightMode: 'light' | 'dark';
1210
messageIsStreaming: boolean;
@@ -24,13 +22,11 @@ export interface HomeInitialState {
2422
searchTerm: string;
2523
defaultModelId: OpenAIModelID | undefined;
2624
serverSideApiKeyIsSet: boolean;
27-
serverSidePluginKeysSet: boolean;
2825
}
2926

3027
export const initialState: HomeInitialState = {
3128
apiKey: '',
3229
loading: false,
33-
pluginKeys: [],
3430
lightMode: 'dark',
3531
messageIsStreaming: false,
3632
models: [],
@@ -46,6 +42,5 @@ export const initialState: HomeInitialState = {
4642
messageError: false,
4743
searchTerm: '',
4844
defaultModelId: undefined,
49-
serverSideApiKeyIsSet: false,
50-
serverSidePluginKeysSet: false,
45+
serverSideApiKeyIsSet: false
5146
};

0 commit comments

Comments
 (0)