feat(models): version official specifications and preserve catalog provenance
This commit is contained in:
@@ -319,11 +319,10 @@ export class Provider {
|
||||
transport:this.transport?.profile,timedOut: !!timeout.timeout, timeout: timeout.timeout, redact: value => this.redact(value, key) });
|
||||
if (config.capacityMode === 'passthrough' && diagnostic.reason === 'output_truncated') {
|
||||
// Describe the serialized request actually sent, including native user
|
||||
// settings and Messages' mandatory field, rather than a local default.
|
||||
// settings and provider-required fields, rather than a local default.
|
||||
const sent = wireBody ? JSON.parse(wireBody) : {};
|
||||
const fields = ['max_tokens', 'max_completion_tokens', 'max_output_tokens'].filter(field => Object.hasOwn(sent, field));
|
||||
const output = fields.length ? '实际请求携带 ' + fields.map(field => field + '=' + (Number.isFinite(sent[field]) ? sent[field] : '非数值(见原请求)')).join('、')
|
||||
+ (config.protocol === 'anthropic-messages' ? '(Messages 协议要求 max_tokens)' : '') : '实际请求未携带输出 token 上限';
|
||||
const output = fields.length ? '实际请求携带 ' + fields.map(field => field + '=' + (Number.isFinite(sent[field]) ? sent[field] : '非数值(见原请求)')).join('、') : '实际请求未携带输出 token 上限';
|
||||
const reason = diagnostic.upstream?.reason ?? responseDetails?.reason ?? (config.protocol === 'anthropic-messages' ? 'max_tokens' : config.protocol === 'responses' ? 'max_output_tokens' : 'length');
|
||||
diagnostic = { ...diagnostic, origin: 'upstream', title: '上游响应因输出额度结束',
|
||||
message: '上游返回结束原因 ' + reason + '。' + output + '。原响应及用量已保存;不完整的工具批次未执行。' };
|
||||
|
||||
Reference in New Issue
Block a user