fixes
This commit is contained in:
+16
-1
@@ -118,6 +118,21 @@ const Home: React.FC<HomeProps> = ({
|
||||
};
|
||||
|
||||
const endpoint = getEndpoint(plugin);
|
||||
let body;
|
||||
|
||||
if (!plugin) {
|
||||
body = JSON.stringify(chatBody);
|
||||
} else {
|
||||
body = JSON.stringify({
|
||||
...chatBody,
|
||||
googleAPIKey: pluginKeys
|
||||
.find((key) => key.pluginId === 'google-search')
|
||||
?.requiredKeys.find((key) => key.key === 'GOOGLE_API_KEY')?.value,
|
||||
googleCSEId: pluginKeys
|
||||
.find((key) => key.pluginId === 'google-search')
|
||||
?.requiredKeys.find((key) => key.key === 'GOOGLE_CSE_ID')?.value,
|
||||
});
|
||||
}
|
||||
|
||||
const controller = new AbortController();
|
||||
const response = await fetch(endpoint, {
|
||||
@@ -126,7 +141,7 @@ const Home: React.FC<HomeProps> = ({
|
||||
'Content-Type': 'application/json',
|
||||
},
|
||||
signal: controller.signal,
|
||||
body: JSON.stringify(chatBody),
|
||||
body,
|
||||
});
|
||||
|
||||
if (!response.ok) {
|
||||
|
||||
Reference in New Issue
Block a user