8a48765a46
集中保留原版权声明,移除文件头检查和全局测试忽略规则。验证:全量单测、受影响用例复测及静态检查通过。
72 lines
2.5 KiB
JavaScript
72 lines
2.5 KiB
JavaScript
// 判定来源 / 闸门 / 过滤原因的展示文案(与后端 decide.go、gate.go、filter.go 的代码一一对应)
|
|
export const reasonText = (t, code) =>
|
|
({
|
|
disabled: t('已停用'),
|
|
level: t('等级不可用'),
|
|
scope: t('不在企业作用域白名单'),
|
|
experience_center: t('不在体验中心白名单'),
|
|
no_channel: t('分组内没有可用渠道'),
|
|
channel_query_failed: t('渠道查询失败'),
|
|
protocol: t('渠道不支持该入口格式'),
|
|
vision: t('不支持图片输入'),
|
|
tools: t('不支持工具调用'),
|
|
json_mode: t('不支持 JSON 输出'),
|
|
context: t('超出上下文长度'),
|
|
tool_id_format: t('工具调用 ID 格式不兼容'),
|
|
strip_incompatible: t('不兼容历史剥离'),
|
|
reasoning: t('不支持推理 / 思考'),
|
|
})[code] || code;
|
|
|
|
// Jev 调用失败原因(jev.FailureReason);http_xxx 为上游状态码
|
|
export const jevReasonText = (t, code) => {
|
|
if (!code) return '';
|
|
if (/^http_\d+$/.test(code))
|
|
return t('上游返回 {{code}}', { code: code.slice(5) });
|
|
return (
|
|
{
|
|
timeout: t('判定超时'),
|
|
breaker: t('通道熔断中'),
|
|
no_key: t('未配置密钥'),
|
|
parse: t('返回格式异常'),
|
|
error: t('调用失败'),
|
|
}[code] || code
|
|
);
|
|
};
|
|
|
|
export const gateText = (t, code) =>
|
|
({
|
|
jev: t('已调用 Jev'),
|
|
platform_off: t('平台未开启 Jev 出境'),
|
|
sensitive: t('命中敏感词'),
|
|
desens_off: t('脱敏未启用'),
|
|
desens_block: t('脱敏策略会拦截'),
|
|
guard_input: t('内容审核输入审查生效'),
|
|
org_no_consent: t('企业未授权'),
|
|
user_no_consent: t('个人未授权'),
|
|
profile_off: t('集合未允许使用 Jev'),
|
|
no_quota: t('余额不足,未调用 Jev'),
|
|
jev_cap: t('今日 Jev 判定次数已达上限'),
|
|
desens_residual: t('脱敏后仍有敏感信息'),
|
|
'n/a': t('未经过闸门'),
|
|
})[code] ||
|
|
(code && code.startsWith('rules:') ? gateText(t, code.slice(6)) : code) ||
|
|
'-';
|
|
|
|
export const srcText = (t, code) =>
|
|
({
|
|
jev: t('Jev 判定'),
|
|
cache: t('判定缓存'),
|
|
rules: t('规则判定器'),
|
|
rules_fallback: t('Jev 失败,规则判定'),
|
|
rule: t('自定义规则'),
|
|
rule_tier: t('自定义规则强制档位'),
|
|
forced: t('请求指定档位'),
|
|
single: t('唯一候选'),
|
|
sticky: t('会话粘性'),
|
|
continuation: t('工具调用续写'),
|
|
default: t('默认模型'),
|
|
cheapest: t('最便宜的候选'),
|
|
disabled: t('未启用,使用默认模型'),
|
|
error: t('路由失败'),
|
|
})[code] || code;
|