Files
Agent-Workbench/docs/model-selection-k-evidence/source-bytes/src/shared/budget-presentation.mjs
T
2026-11-03 15:37:04 +08:00

19 lines
1.1 KiB
JavaScript

const reasons = {
context_limit: '上下文窗口不足', engine_input_budget: '原生引擎输入或剩余预算不足',
token_limit: '本次运行预算不足', task_token_limit: '任务累计预算不足', time_limit: '本次运行时间已用完',
};
export function budgetPausePresentation(pause, stopReason = '') {
const reason = pause?.reason ?? stopReason;
if (!reasons[reason]) return null;
if (reason === 'engine_input_budget' && pause?.limitingReason === 'remaining_token_budget') return {
title: '原生引擎剩余预算不足', inputLabel: '当前窗口可用输入',
guidance: '输入可容纳于当前上下文窗口;下一次请求的用量预留超过剩余预算。请核对运行和任务预算。',
};
if (reason === 'engine_input_budget' && pause?.limitingReason === 'context_limit') return {
title: '原生引擎上下文窗口不足', inputLabel: '当前窗口可用输入',
guidance: '必需输入超过当前上下文窗口可用容量。请核对模型容量和输入范围。',
};
return { title: reasons[reason], inputLabel: '当前可用输入', guidance: '' };
}