using stream_fetch in App

This commit is contained in:
lloydzhou
2024-09-29 19:44:09 +08:00
parent 2d920f7ccc
commit 3898c507c4
5 changed files with 156 additions and 137 deletions

View File

@@ -10,6 +10,7 @@ import {
fetchEventSource,
} from "@fortaine/fetch-event-source";
import { prettyObject } from "./format";
import { fetch as tauriFetch } from "./stream";
export function compressImage(file: Blob, maxSize: number): Promise<string> {
return new Promise((resolve, reject) => {
@@ -287,6 +288,7 @@ export function stream(
REQUEST_TIMEOUT_MS,
);
fetchEventSource(chatPath, {
fetch: tauriFetch,
...chatPayload,
async onopen(res) {
clearTimeout(requestTimeoutId);