feat: connect controlled engines to owned Tasks, approvals and budget ledger
This commit is contained in:
@@ -177,13 +177,13 @@ export class Provider {
|
||||
const response = await this.request(config, '/models', undefined, undefined, key);
|
||||
return (response.data ?? response.models ?? []).map(item => String(item.id ?? item.name)).filter(Boolean).slice(0, 100);
|
||||
}
|
||||
async complete(config, messages, project, signal, onProgress, requestPlan = null, tools = toolDefinitions) {
|
||||
async complete(config, messages, project, signal, onProgress, requestPlan = null, tools = toolDefinitions, requestPolicy = {}) {
|
||||
const body = completionBody(config, messages, tools);
|
||||
assertPlannedRequest(body, requestPlan);
|
||||
if (config.mode === 'demo') return this.demo(messages, project);
|
||||
this.validate(config);
|
||||
const execute = async (selected, key, input, progress) => {
|
||||
const value = await this.request(selected, '/chat/completions', input, signal, key, progress, config.modelRouting ? { attempts: 1 } : {});
|
||||
const value = await this.request(selected, '/chat/completions', input, signal, key, progress, { ...(config.modelRouting ? { attempts: 1 } : {}), ...requestPolicy });
|
||||
if (!value.choices?.[0]?.message || value.choices[0].finish_reason === 'length') throw new ModelRequestError({ kind: 'protocol', source: 'model_connection',
|
||||
stage: 'model_request', title: '模型响应不完整', message: '模型响应缺少完整message或达到输出上限,未执行工具。', retryable: false, occurredAt: new Date().toISOString() });
|
||||
return value;
|
||||
|
||||
Reference in New Issue
Block a user