fix(shared): switch promptWithModelSuggestionRetry to use promptAsync
This commit is contained in:
parent
2c394cd497
commit
b8221a883e
@ -84,28 +84,7 @@ export async function promptWithModelSuggestionRetry(
|
|||||||
client: Client,
|
client: Client,
|
||||||
args: PromptArgs,
|
args: PromptArgs,
|
||||||
): Promise<void> {
|
): Promise<void> {
|
||||||
try {
|
// NOTE: Model suggestion retry removed — promptAsync returns 204 immediately,
|
||||||
await client.session.prompt(args as Parameters<typeof client.session.prompt>[0])
|
// model errors happen asynchronously server-side and cannot be caught here
|
||||||
} catch (error) {
|
await client.session.promptAsync(args as Parameters<typeof client.session.promptAsync>[0])
|
||||||
const suggestion = parseModelSuggestion(error)
|
|
||||||
if (!suggestion || !args.body.model) {
|
|
||||||
throw error
|
|
||||||
}
|
|
||||||
|
|
||||||
log("[model-suggestion-retry] Model not found, retrying with suggestion", {
|
|
||||||
original: `${suggestion.providerID}/${suggestion.modelID}`,
|
|
||||||
suggested: suggestion.suggestion,
|
|
||||||
})
|
|
||||||
|
|
||||||
await client.session.prompt({
|
|
||||||
...args,
|
|
||||||
body: {
|
|
||||||
...args.body,
|
|
||||||
model: {
|
|
||||||
providerID: suggestion.providerID,
|
|
||||||
modelID: suggestion.suggestion,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
} as Parameters<typeof client.session.prompt>[0])
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user