fix: gemini
This commit is contained in:
parent
20d0717d0c
commit
6c71c83af7
|
@ -170,15 +170,15 @@ export class ClientApi {
|
||||||
export function getHeaders(ignoreHeaders?: boolean) {
|
export function getHeaders(ignoreHeaders?: boolean) {
|
||||||
const accessStore = useAccessStore.getState();
|
const accessStore = useAccessStore.getState();
|
||||||
let headers: Record<string, string> = {};
|
let headers: Record<string, string> = {};
|
||||||
if (!ignoreHeaders) {
|
const modelConfig = useChatStore.getState().currentSession().mask.modelConfig;
|
||||||
|
const isGoogle = modelConfig.model === "gemini-pro";
|
||||||
|
if (!ignoreHeaders && !isGoogle) {
|
||||||
headers = {
|
headers = {
|
||||||
"Content-Type": "application/json",
|
"Content-Type": "application/json",
|
||||||
"x-requested-with": "XMLHttpRequest",
|
"x-requested-with": "XMLHttpRequest",
|
||||||
Accept: "application/json",
|
Accept: "application/json",
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
const modelConfig = useChatStore.getState().currentSession().mask.modelConfig;
|
|
||||||
const isGoogle = modelConfig.model === "gemini-pro";
|
|
||||||
const isAzure = accessStore.provider === ServiceProvider.Azure;
|
const isAzure = accessStore.provider === ServiceProvider.Azure;
|
||||||
const authHeader = isGoogle
|
const authHeader = isGoogle
|
||||||
? "x-goog-api-key"
|
? "x-goog-api-key"
|
||||||
|
|
|
@ -187,7 +187,9 @@ export class GeminiProApi implements LLMApi {
|
||||||
}
|
}
|
||||||
path(path: string): string {
|
path(path: string): string {
|
||||||
const accessStore = useAccessStore.getState();
|
const accessStore = useAccessStore.getState();
|
||||||
const isGoogle = accessStore.provider === ServiceProvider.Google;
|
const isGoogle =
|
||||||
|
accessStore.useCustomConfig &&
|
||||||
|
accessStore.provider === ServiceProvider.Google;
|
||||||
|
|
||||||
if (isGoogle && !accessStore.isValidGoogle()) {
|
if (isGoogle && !accessStore.isValidGoogle()) {
|
||||||
throw Error(
|
throw Error(
|
||||||
|
|
Loading…
Reference in New Issue