mirror of
https://github.com/ChatGPTNextWeb/ChatGPT-Next-Web.git
synced 2025-11-15 05:23:42 +08:00
fix: #349
This commit is contained in:
@@ -11,6 +11,7 @@ import {
|
||||
} from "@fortaine/fetch-event-source";
|
||||
import { prettyObject } from "./format";
|
||||
import { fetch as tauriFetch } from "./stream";
|
||||
import { getWebReferenceMessageTextContent } from "../utils";
|
||||
|
||||
export function compressImage(file: Blob, maxSize: number): Promise<string> {
|
||||
return new Promise((resolve, reject) => {
|
||||
@@ -92,6 +93,16 @@ export async function preProcessImageContent(
|
||||
return result;
|
||||
}
|
||||
|
||||
export async function preProcessImageAndWebReferenceContent(
|
||||
message: RequestMessage,
|
||||
) {
|
||||
const content = message.content;
|
||||
if (typeof content === "string") {
|
||||
return getWebReferenceMessageTextContent(message);
|
||||
}
|
||||
return preProcessImageContent(content);
|
||||
}
|
||||
|
||||
const imageCaches: Record<string, string> = {};
|
||||
export function cacheImageToBase64Image(imageUrl: string) {
|
||||
if (imageUrl.includes(CACHE_URL_PREFIX)) {
|
||||
|
||||
Reference in New Issue
Block a user