mirror of
https://github.com/sst/opencode.git
synced 2025-12-23 10:11:41 +00:00
fix(command): validate model before executing slash command (#5740)
This commit is contained in:
parent
d5dcc55a47
commit
4bf882ba81
1 changed files with 14 additions and 0 deletions
|
|
@ -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…
Add table
Add a link
Reference in a new issue