Add da fallback

This commit is contained in:
kwaroran
2025-03-24 16:53:39 +09:00
parent fe88f0ddb7
commit cd9d81e405

View File

@@ -271,6 +271,7 @@ export async function requestChatData(arg:requestDataArgument, model:ModelModeEx
const db = getDatabase()
const fallBackModels:string[] = safeStructuredClone(db?.fallbackModels?.[model] ?? [])
fallBackModels.push('')
let da:requestDataResponse
const originalFormated = safeStructuredClone(arg.formated)
for(let fallbackIndex=0;fallbackIndex<fallBackModels.length;fallbackIndex++){
@@ -312,7 +313,7 @@ export async function requestChatData(arg:requestDataArgument, model:ModelModeEx
}
const da = await requestChatDataMain({
da = await requestChatDataMain({
...arg,
staticModel: fallBackModels[fallbackIndex]
}, model, abortSignal)
@@ -372,7 +373,7 @@ export async function requestChatData(arg:requestDataArgument, model:ModelModeEx
}
return {
return da ?? {
type: 'fail',
result: "All models failed"
}