mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-08 14:58:26 +00:00
fix(providers): include provider name in billing error messages (#14697)
Merged via /review-pr -> /prepare-pr -> /merge-pr.
Prepared head SHA: 774e0b6605
Co-authored-by: fagemx <117356295+fagemx@users.noreply.github.com>
Co-authored-by: shakkernerd <165377636+shakkernerd@users.noreply.github.com>
Reviewed-by: @shakkernerd
This commit is contained in:
@@ -6,6 +6,7 @@ import { parseReplyDirectives } from "../../../auto-reply/reply/reply-directives
|
||||
import { isSilentReplyText, SILENT_REPLY_TOKEN } from "../../../auto-reply/tokens.js";
|
||||
import { formatToolAggregate } from "../../../auto-reply/tool-meta.js";
|
||||
import {
|
||||
BILLING_ERROR_USER_MESSAGE,
|
||||
formatAssistantErrorText,
|
||||
formatRawAssistantErrorForUi,
|
||||
getApiErrorPayloadFingerprint,
|
||||
@@ -27,6 +28,7 @@ export function buildEmbeddedRunPayloads(params: {
|
||||
lastToolError?: { toolName: string; meta?: string; error?: string };
|
||||
config?: OpenClawConfig;
|
||||
sessionKey: string;
|
||||
provider?: string;
|
||||
verboseLevel?: VerboseLevel;
|
||||
reasoningLevel?: ReasoningLevel;
|
||||
toolResultFormat?: ToolResultFormat;
|
||||
@@ -57,6 +59,7 @@ export function buildEmbeddedRunPayloads(params: {
|
||||
? formatAssistantErrorText(params.lastAssistant, {
|
||||
cfg: params.config,
|
||||
sessionKey: params.sessionKey,
|
||||
provider: params.provider,
|
||||
})
|
||||
: undefined;
|
||||
const rawErrorMessage = lastAssistantErrored
|
||||
@@ -75,6 +78,7 @@ export function buildEmbeddedRunPayloads(params: {
|
||||
? normalizeTextForComparison(rawErrorMessage)
|
||||
: null;
|
||||
const normalizedErrorText = errorText ? normalizeTextForComparison(errorText) : null;
|
||||
const normalizedGenericBillingErrorText = normalizeTextForComparison(BILLING_ERROR_USER_MESSAGE);
|
||||
const genericErrorText = "The AI service returned an error. Please try again.";
|
||||
if (errorText) {
|
||||
replyItems.push({ text: errorText, isError: true });
|
||||
@@ -133,6 +137,13 @@ export function buildEmbeddedRunPayloads(params: {
|
||||
if (trimmed === genericErrorText) {
|
||||
return true;
|
||||
}
|
||||
if (
|
||||
normalized &&
|
||||
normalizedGenericBillingErrorText &&
|
||||
normalized === normalizedGenericBillingErrorText
|
||||
) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
if (rawErrorMessage && trimmed === rawErrorMessage) {
|
||||
return true;
|
||||
|
||||
Reference in New Issue
Block a user