mirror of
https://gitea.toothfairyai.com/ToothFairyAI/tf_code.git
synced 2026-03-29 21:33:54 +00:00
fix: better agents
This commit is contained in:
parent
16bdb0707f
commit
0f62ba8dd5
@ -35,9 +35,7 @@ export const { use: useLocal, provider: LocalProvider } = createSimpleContext({
|
|||||||
}
|
}
|
||||||
|
|
||||||
const tfFallbackModel = createMemo(() => {
|
const tfFallbackModel = createMemo(() => {
|
||||||
const m = { providerID: "toothfairyai", modelID: "mystica-15" }
|
return { providerID: "toothfairyai", modelID: "mystica-15" }
|
||||||
if (isModelValid(m)) return m
|
|
||||||
return undefined
|
|
||||||
})
|
})
|
||||||
|
|
||||||
const agent = iife(() => {
|
const agent = iife(() => {
|
||||||
@ -393,15 +391,24 @@ export const { use: useLocal, provider: LocalProvider } = createSimpleContext({
|
|||||||
createEffect(() => {
|
createEffect(() => {
|
||||||
const value = agent.current()
|
const value = agent.current()
|
||||||
const isTFAgent = !!value.options?.tf_agent_id
|
const isTFAgent = !!value.options?.tf_agent_id
|
||||||
if (value.model) {
|
|
||||||
|
if (isTFAgent) {
|
||||||
|
// For TF agents, always ensure a valid model is set
|
||||||
|
if (value.model && isModelValid(value.model)) {
|
||||||
|
model.set({
|
||||||
|
providerID: value.model.providerID,
|
||||||
|
modelID: value.model.modelID,
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
// Fallback to toothfairyai/mystica-15 for TF agents
|
||||||
|
model.setDefault({ providerID: "toothfairyai", modelID: "mystica-15" })
|
||||||
|
}
|
||||||
|
} else if (value.model) {
|
||||||
if (isModelValid(value.model)) {
|
if (isModelValid(value.model)) {
|
||||||
model.set({
|
model.set({
|
||||||
providerID: value.model.providerID,
|
providerID: value.model.providerID,
|
||||||
modelID: value.model.modelID,
|
modelID: value.model.modelID,
|
||||||
})
|
})
|
||||||
} else if (isTFAgent) {
|
|
||||||
// For TF agents with invalid model, force default to toothfairyai/mystica-15
|
|
||||||
model.setDefault({ providerID: "toothfairyai", modelID: "mystica-15" })
|
|
||||||
} else {
|
} else {
|
||||||
toast.show({
|
toast.show({
|
||||||
variant: "warning",
|
variant: "warning",
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user