[feat] log for streaming
This commit is contained in:
@@ -4,7 +4,7 @@ import { DataBase, setDatabase, type character } from "../storage/database";
|
|||||||
import { pluginProcess } from "../plugins/plugins";
|
import { pluginProcess } from "../plugins/plugins";
|
||||||
import { language } from "../../lang";
|
import { language } from "../../lang";
|
||||||
import { stringlizeAINChat, stringlizeChat, stringlizeChatOba, getStopStrings, unstringlizeAIN, unstringlizeChat } from "./stringlize";
|
import { stringlizeAINChat, stringlizeChat, stringlizeChatOba, getStopStrings, unstringlizeAIN, unstringlizeChat } from "./stringlize";
|
||||||
import { globalFetch, isNodeServer, isTauri } from "../storage/globalApi";
|
import { addFetchLog, globalFetch, isNodeServer, isTauri } from "../storage/globalApi";
|
||||||
import { sleep } from "../util";
|
import { sleep } from "../util";
|
||||||
import { createDeep } from "./deepai";
|
import { createDeep } from "./deepai";
|
||||||
import { hubURL } from "../characterCards";
|
import { hubURL } from "../characterCards";
|
||||||
@@ -246,6 +246,13 @@ export async function requestChatDataMain(arg:requestDataArgument, model:'model'
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
addFetchLog({
|
||||||
|
body: body,
|
||||||
|
response: "Streaming",
|
||||||
|
success: true,
|
||||||
|
url: replacerURL,
|
||||||
|
})
|
||||||
|
|
||||||
let dataUint = new Uint8Array([])
|
let dataUint = new Uint8Array([])
|
||||||
|
|
||||||
const transtream = new TransformStream<Uint8Array, string>( {
|
const transtream = new TransformStream<Uint8Array, string>( {
|
||||||
|
|||||||
@@ -441,6 +441,17 @@ export async function loadData() {
|
|||||||
|
|
||||||
const knownHostes = ["localhost","127.0.0.1"]
|
const knownHostes = ["localhost","127.0.0.1"]
|
||||||
|
|
||||||
|
export function addFetchLog(body:any, headers:any, response:any, success:boolean, url:string){
|
||||||
|
fetchLog.unshift({
|
||||||
|
body: JSON.stringify(body, null, 2),
|
||||||
|
header: JSON.stringify(headers ?? {}, null, 2),
|
||||||
|
response: JSON.stringify(response, null, 2),
|
||||||
|
success: success,
|
||||||
|
date: (new Date()).toLocaleTimeString(),
|
||||||
|
url: url
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
export async function globalFetch(url:string, arg:{
|
export async function globalFetch(url:string, arg:{
|
||||||
plainFetchForce?:boolean,
|
plainFetchForce?:boolean,
|
||||||
body?:any,
|
body?:any,
|
||||||
|
|||||||
Reference in New Issue
Block a user