mirror of
https://github.com/fabro-sh/fabro.git
synced 2026-11-01 07:02:30 +00:00
Don't report Fabro-side model request failures as the provider's refusal
A configuration, model-selection, network, middleware or resource-limit error names a provider but never got an answer from it, yet the banner said the provider rejected the request. Give these kinds wording that points at Fabro's catalog, the network, or Fabro's own limits. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
fdfa016c3a
commit
3107793f2b
2 changed files with 30 additions and 0 deletions
|
|
@ -82,6 +82,20 @@ describe("buildRunFailureView", () => {
|
|||
.toBe("The request to OpenAI timed out");
|
||||
});
|
||||
|
||||
test("doesn't blame the provider for failures on Fabro's side", () => {
|
||||
const failure = (message: string) => view(failedRun({ message }));
|
||||
expect(failure("model request failed (configuration): provider anthropic is disabled in the catalog")).toMatchObject({
|
||||
headline: "Fabro couldn't send the request to Anthropic",
|
||||
nextStep: "Check Anthropic and the step's model under Settings → Models, then choose Retry from Actions.",
|
||||
});
|
||||
expect(failure("model request failed (model_selection): provider anthropic has no default model")?.headline)
|
||||
.toBe("Fabro couldn't send the request to Anthropic");
|
||||
expect(failure("model request failed (network): provider openai connection refused")?.headline)
|
||||
.toBe("The request never reached OpenAI");
|
||||
expect(failure("model request failed (resource_limit): provider openai response exceeded 16 MiB")?.headline)
|
||||
.toBe("Fabro stopped the request to OpenAI");
|
||||
});
|
||||
|
||||
test("falls back to the provider's status and code", () => {
|
||||
const failure = view(
|
||||
failedRun({
|
||||
|
|
|
|||
|
|
@ -141,6 +141,22 @@ function parseModelRequest(message: string): ModelRequest | null {
|
|||
}
|
||||
|
||||
function requestAdvice({ kind, status, code }: ModelRequest, message: string, who: string): Advice {
|
||||
// These kinds fail on Fabro's side, before or without the provider's say.
|
||||
if (kind === "configuration" || kind === "model_selection") {
|
||||
return {
|
||||
headline: `Fabro couldn't send the request to ${who}`,
|
||||
nextStep: `Check ${who} and the step's model under Settings → Models, then ${RETRY}.`,
|
||||
};
|
||||
}
|
||||
if (kind === "network") {
|
||||
return {
|
||||
headline: `The request never reached ${who}`,
|
||||
nextStep: "Check that the Fabro server can reach the provider, then choose Retry from Actions.",
|
||||
};
|
||||
}
|
||||
if (kind === "middleware" || kind === "resource_limit") {
|
||||
return { headline: `Fabro stopped the request to ${who}`, nextStep: "The message, under Details, says why." };
|
||||
}
|
||||
if (
|
||||
kind === "quota_exceeded" ||
|
||||
status === 402 ||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue