mirror of
https://gitea.toothfairyai.com/ToothFairyAI/tf_code.git
synced 2026-03-30 05:43:55 +00:00
fix(command): validate model before executing slash command (#5740)
This commit is contained in:
parent
d5dcc55a47
commit
4bf882ba81
@ -1333,6 +1333,20 @@ export namespace SessionPrompt {
|
||||
if (input.model) return Provider.parseModel(input.model)
|
||||
return await lastModel(input.sessionID)
|
||||
})()
|
||||
|
||||
try {
|
||||
await Provider.getModel(model.providerID, model.modelID)
|
||||
} catch (e) {
|
||||
if (Provider.ModelNotFoundError.isInstance(e)) {
|
||||
const { providerID, modelID, suggestions } = e.data
|
||||
const hint = suggestions?.length ? ` Did you mean: ${suggestions.join(", ")}?` : ""
|
||||
Bus.publish(Session.Event.Error, {
|
||||
sessionID: input.sessionID,
|
||||
error: new NamedError.Unknown({ message: `Model not found: ${providerID}/${modelID}.${hint}` }).toObject(),
|
||||
})
|
||||
}
|
||||
throw e
|
||||
}
|
||||
const agent = await Agent.get(agentName)
|
||||
|
||||
const parts =
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user