mirror of
https://github.com/anomalyco/opencode.git
synced 2026-05-13 07:11:55 +00:00
fix: publish session.error event for invalid model selection (#8451)
This commit is contained in:
parent
3d6fb29f0c
commit
832902c8e3
1 changed files with 12 additions and 1 deletions
|
|
@ -321,7 +321,18 @@ export namespace SessionPrompt {
|
|||
history: msgs,
|
||||
})
|
||||
|
||||
const model = await Provider.getModel(lastUser.model.providerID, lastUser.model.modelID)
|
||||
const model = await Provider.getModel(lastUser.model.providerID, lastUser.model.modelID).catch((e) => {
|
||||
if (Provider.ModelNotFoundError.isInstance(e)) {
|
||||
const hint = e.data.suggestions?.length ? ` Did you mean: ${e.data.suggestions.join(", ")}?` : ""
|
||||
Bus.publish(Session.Event.Error, {
|
||||
sessionID,
|
||||
error: new NamedError.Unknown({
|
||||
message: `Model not found: ${e.data.providerID}/${e.data.modelID}.${hint}`,
|
||||
}).toObject(),
|
||||
})
|
||||
}
|
||||
throw e
|
||||
})
|
||||
const task = tasks.pop()
|
||||
|
||||
// pending subtask
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue