fix:国际化配置余额不足
This commit is contained in:
parent
345a143e38
commit
46711ffec8
|
|
@ -174,7 +174,6 @@ def _extract_run_id(request: ModelRequest) -> str | None: # noqa: ARG001
|
|||
|
||||
def _reserve_failure_message(status_code: int | None) -> str:
|
||||
if status_code in _blocking_reserve_code_set():
|
||||
# TODO: 将账单错误文案迁移到国际化资源中,按语言返回提示。
|
||||
return "The account balance is insufficient for this model call."
|
||||
return "Billing reservation failed. Please try again later."
|
||||
|
||||
|
|
|
|||
|
|
@ -46,6 +46,13 @@ import { CopyButton } from "../copy-button";
|
|||
|
||||
import { MarkdownContent } from "./markdown-content";
|
||||
|
||||
function localizeAssistantFixedCopy(content: string, localized: string): string {
|
||||
if (content.includes("The account balance is insufficient for this model call.")) {
|
||||
return localized;
|
||||
}
|
||||
return content;
|
||||
}
|
||||
|
||||
export function MessageListItem({
|
||||
className,
|
||||
message,
|
||||
|
|
@ -176,8 +183,14 @@ function MessageContent_({
|
|||
const cleaned = stripPriorityHintSuffix(stripUploadedFilesTag(rawContent));
|
||||
return normalizeHumanMessageDisplayText(cleaned);
|
||||
}
|
||||
return rawContent ?? "";
|
||||
}, [rawContent, isHuman]);
|
||||
if (!rawContent) {
|
||||
return "";
|
||||
}
|
||||
return localizeAssistantFixedCopy(
|
||||
rawContent,
|
||||
t.threads.billingInsufficientBalance,
|
||||
);
|
||||
}, [rawContent, isHuman, t.threads.billingInsufficientBalance]);
|
||||
const isSummaryMessage = useMemo(
|
||||
() => isHuman && isSummaryTemplateMessage(message),
|
||||
[isHuman, message],
|
||||
|
|
|
|||
|
|
@ -319,6 +319,8 @@ export const enUS: Translations = {
|
|||
|
||||
threads: {
|
||||
streamError: "Something went wrong.",
|
||||
billingInsufficientBalance:
|
||||
"The account balance is insufficient for this model call.",
|
||||
invalidThreadId: "Invalid thread id 'new'. Please refresh and retry.",
|
||||
staleReferencesRemoved:
|
||||
"Some referenced files were invalid and were removed automatically.",
|
||||
|
|
|
|||
|
|
@ -245,6 +245,7 @@ export interface Translations {
|
|||
|
||||
threads: {
|
||||
streamError: string;
|
||||
billingInsufficientBalance: string;
|
||||
invalidThreadId: string;
|
||||
staleReferencesRemoved: string;
|
||||
uploadFailed: string;
|
||||
|
|
|
|||
|
|
@ -306,6 +306,7 @@ export const zhCN: Translations = {
|
|||
|
||||
threads: {
|
||||
streamError: "出现了某些错误。",
|
||||
billingInsufficientBalance: "账户余额不足,无法完成本次模型调用。",
|
||||
invalidThreadId: "线程 ID 无效(new),请刷新后重试。",
|
||||
staleReferencesRemoved: "部分引用文件已失效,已自动移除并继续发送。",
|
||||
uploadFailed: "文件上传失败。",
|
||||
|
|
|
|||
Loading…
Reference in New Issue