feat(runtime): default to passthrough and persist execution permissions
This commit is contained in:
@@ -5,7 +5,7 @@ import { ReasoningSettings } from './ReasoningSettings';
|
||||
import type { CatalogModel } from '../shared/contracts/model-catalog.mjs';
|
||||
|
||||
export type NativeConnection = { id: string; revision: number; name: string; protocol: string; model?: string; brand?: string; baseUrl?: string; parameterProfile?: string; capabilityDeclarations?: Record<string, string>; capabilities?: Record<string, string>; nativeParameters?: Record<string, unknown>; outputTokenField?: string; upstreamModel?: CatalogModel };
|
||||
export function NativeParameters({ connection, busy, onCancel, onSave }: { connection: NativeConnection; busy: boolean; onCancel: () => void;
|
||||
export function NativeParameters({ connection, busy, onCancel, onSave, executionMode }: { connection: NativeConnection; busy: boolean; executionMode?: string; onCancel: () => void;
|
||||
onSave: (input: { id: string; revision: number; nativeParameters: Record<string, unknown>; outputTokenField: string; parameterProfile?: string }) => Promise<void> }) {
|
||||
const [text, setText] = useState(JSON.stringify(connection.nativeParameters ?? {}, null, 2));
|
||||
const [field, setField] = useState(connection.outputTokenField ?? (connection.protocol === 'responses' ? 'max_output_tokens' : 'max_tokens'));
|
||||
@@ -18,7 +18,7 @@ export function NativeParameters({ connection, busy, onCancel, onSave }: { conne
|
||||
useEffect(() => { form.current?.scrollIntoView({ block: 'nearest' }); }, []);
|
||||
return <form ref={form} className="mc-editor mc-native" aria-label="原生请求参数" onSubmit={async event => {
|
||||
event.preventDefault(); setError('');
|
||||
try { const settings = nativeParameterSettings(connection.protocol, JSON.parse(text), field, profile); await onSave({ id: connection.id, revision: connection.revision, ...settings }); }
|
||||
try { const settings = nativeParameterSettings(connection.protocol, JSON.parse(text), field, profile, { executionMode }); await onSave({ id: connection.id, revision: connection.revision, ...settings }); }
|
||||
catch (cause) { setError(cause instanceof Error ? cause.message : '参数格式无效。'); }
|
||||
}}>
|
||||
<h3>{connection.name} · 推理与原生参数</h3>
|
||||
@@ -33,8 +33,8 @@ export function NativeParameters({ connection, busy, onCancel, onSave }: { conne
|
||||
setProfile(value);
|
||||
}} />
|
||||
<label>输出上限字段<select aria-label="输出上限字段" value={field} disabled={busy} onChange={event => setField(event.target.value)}>{(connection.protocol === 'responses' ? ['max_output_tokens'] : connection.protocol === 'anthropic-messages' ? ['max_tokens'] : ['max_tokens', 'max_completion_tokens']).map(value => <option key={value}>{value}</option>)}</select></label>
|
||||
<p className="mc-help">数值沿用当前任务和连接的输出预算,不允许原生参数覆盖预算、消息、工具或接口。</p>
|
||||
<label>原生参数 JSON<textarea aria-label="原生参数 JSON" rows={7} maxLength={8192} spellCheck={false} value={text} disabled={busy} onChange={event => setText(event.target.value)} /></label>
|
||||
<p className="mc-help">{executionMode === 'unrestricted' ? '默认不附加输出上限;可在 JSON 中显式填写上游参数,服务是否接受以原始响应为准。' : '数值沿用当前任务和连接的输出预算。'}消息、工具、接口和凭据由各自设置管理。</p>
|
||||
<label>原生参数 JSON<textarea aria-label="原生参数 JSON" rows={7} maxLength={executionMode === 'unrestricted' ? undefined : 8192} spellCheck={false} value={text} disabled={busy} onChange={event => setText(event.target.value)} /></label>
|
||||
<p className="mc-help">{connection.protocol === 'anthropic-messages' ? '已接入 temperature(0–1)、top_p、top_k、stop_sequences、thinking、output_config.effort。' : connection.protocol === 'responses' ? '已接入 temperature、top_p、parallel_tool_calls、reasoning.effort、text.verbosity。' : '已接入 temperature、top_p、seed、parallel_tool_calls、reasoning_effort、verbosity、DeepSeek thinking。'}推理控件与 JSON 编辑同一份参数,其他字段保存时会给出具体提示。</p>
|
||||
{error && <p className="mc-card-warning" role="alert">{error}</p>}
|
||||
<div className="mc-actions"><button className="button secondary" type="button" disabled={busy} onClick={onCancel}>取消</button><button className="button primary" disabled={busy} type="submit">保存原生参数</button></div>
|
||||
|
||||
Reference in New Issue
Block a user