fix: upload image error
This commit is contained in:
parent
24de1bb77a
commit
e60c0f009b
|
@ -167,12 +167,15 @@ export class ClientApi {
|
|||
}
|
||||
}
|
||||
|
||||
export function getHeaders() {
|
||||
export function getHeaders(ignoreHeaders?: boolean) {
|
||||
const accessStore = useAccessStore.getState();
|
||||
const headers: Record<string, string> = {
|
||||
"Content-Type": "application/json",
|
||||
"x-requested-with": "XMLHttpRequest",
|
||||
};
|
||||
let headers: Record<string, string> = {};
|
||||
if (!ignoreHeaders) {
|
||||
headers = {
|
||||
"Content-Type": "application/json",
|
||||
"x-requested-with": "XMLHttpRequest",
|
||||
};
|
||||
}
|
||||
const modelConfig = useChatStore.getState().currentSession().mask.modelConfig;
|
||||
const isGoogle = modelConfig.model === "gemini-pro";
|
||||
const isAzure = accessStore.provider === ServiceProvider.Azure;
|
||||
|
|
|
@ -4,7 +4,7 @@ export class FileApi {
|
|||
async upload(file: any): Promise<void> {
|
||||
const formData = new FormData();
|
||||
formData.append("file", file);
|
||||
var headers = getHeaders();
|
||||
var headers = getHeaders(true);
|
||||
var res = await fetch("/api/file/upload", {
|
||||
method: "POST",
|
||||
body: formData,
|
||||
|
|
Loading…
Reference in New Issue