mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-10 05:42:43 +00:00
fix: include provider and model name in billing error message (#20510)
Merged via /review-pr -> /prepare-pr -> /merge-pr.
Prepared head SHA: 40dbdf62e8
Co-authored-by: echoVic <16428813+echoVic@users.noreply.github.com>
Co-authored-by: gumadeiras <5599352+gumadeiras@users.noreply.github.com>
Reviewed-by: @gumadeiras
This commit is contained in:
@@ -92,13 +92,19 @@ describe("formatAssistantErrorText", () => {
|
||||
const result = formatAssistantErrorText(msg);
|
||||
expect(result).toBe(BILLING_ERROR_USER_MESSAGE);
|
||||
});
|
||||
it("includes provider name in billing message when provider is given", () => {
|
||||
it("includes provider and assistant model in billing message when provider is given", () => {
|
||||
const msg = makeAssistantError("insufficient credits");
|
||||
const result = formatAssistantErrorText(msg, { provider: "Anthropic" });
|
||||
expect(result).toBe(formatBillingErrorMessage("Anthropic"));
|
||||
expect(result).toBe(formatBillingErrorMessage("Anthropic", "test-model"));
|
||||
expect(result).toContain("Anthropic");
|
||||
expect(result).not.toContain("API provider");
|
||||
});
|
||||
it("uses the active assistant model for billing message context", () => {
|
||||
const msg = makeAssistantError("insufficient credits");
|
||||
msg.model = "claude-3-5-sonnet";
|
||||
const result = formatAssistantErrorText(msg, { provider: "Anthropic" });
|
||||
expect(result).toBe(formatBillingErrorMessage("Anthropic", "claude-3-5-sonnet"));
|
||||
});
|
||||
it("returns generic billing message when provider is not given", () => {
|
||||
const msg = makeAssistantError("insufficient credits");
|
||||
const result = formatAssistantErrorText(msg);
|
||||
|
||||
Reference in New Issue
Block a user