[feat] add modify request chat
This commit is contained in:
@@ -224,9 +224,9 @@ let compCode:{[key:string]:string[]} = {}
|
||||
|
||||
export async function runCharacterJS(arg:{
|
||||
code: string|null,
|
||||
mode: ScriptMode|'onButtonClick'
|
||||
data: string
|
||||
}):Promise<string>{
|
||||
mode: ScriptMode|'onButtonClick'|'modifyRequestChat'
|
||||
data: any
|
||||
}):Promise<any>{
|
||||
try {
|
||||
if(arg.code === null){
|
||||
const db = get(DataBase)
|
||||
@@ -238,7 +238,8 @@ export async function runCharacterJS(arg:{
|
||||
"editoutput": 'editOutput',
|
||||
"editprocess": 'editProcess',
|
||||
"editdisplay": 'editDisplay',
|
||||
'onButtonClick': "onButtonClick"
|
||||
'onButtonClick': "onButtonClick",
|
||||
'modifyRequestChat': 'modifyRequestChat'
|
||||
} as const
|
||||
|
||||
let runCodes = [...additionalCharaJS, arg.code]
|
||||
@@ -278,7 +279,7 @@ export async function runCharacterJS(arg:{
|
||||
continue
|
||||
}
|
||||
|
||||
r = result.toString()
|
||||
r = result
|
||||
|
||||
if(runCode === 'onButtonClick'){
|
||||
return r
|
||||
|
||||
@@ -23,6 +23,7 @@ import { getInlayImage, supportsInlayImage } from "../image";
|
||||
import { getGenerationModelString } from "./models/modelString";
|
||||
import { sendPeerChar } from "../sync/multiuser";
|
||||
import { runInlayScreen } from "./inlayScreen";
|
||||
import { runCharacterJS } from "../plugins/embedscript";
|
||||
|
||||
export interface OpenAIChat{
|
||||
role: 'system'|'user'|'assistant'|'function'
|
||||
@@ -841,6 +842,12 @@ export async function sendChat(chatProcessIndex = -1,arg:{chatAdditonalTokens?:n
|
||||
})
|
||||
}
|
||||
|
||||
formated = await runCharacterJS({
|
||||
code: null,
|
||||
mode: 'modifyRequestChat',
|
||||
data: formated
|
||||
})
|
||||
|
||||
{
|
||||
//token rechecking
|
||||
let tokens = 0
|
||||
|
||||
Reference in New Issue
Block a user