mirror of
https://github.com/hansjone/dsh-im-ops.git
synced 2026-10-15 00:50:45 +08:00
feat: add reasoning effort commands
This commit is contained in:
parent
36cbbe48e7
commit
9e39333ff6
24 changed files with 1346 additions and 240 deletions
|
|
@ -104,7 +104,26 @@ function validModelSelection(value) {
|
|||
&& Boolean(value.provider)
|
||||
&& typeof value.model === 'string'
|
||||
&& Boolean(value.model)
|
||||
&& (value.reasoningEffort === undefined || typeof value.reasoningEffort === 'string');
|
||||
&& (value.reasoningEffort === undefined
|
||||
|| (typeof value.reasoningEffort === 'string' && Boolean(value.reasoningEffort)));
|
||||
}
|
||||
|
||||
function validModelReasoning(value) {
|
||||
return value !== null
|
||||
&& typeof value === 'object'
|
||||
&& Array.isArray(value.efforts)
|
||||
&& value.efforts.length > 0
|
||||
&& value.efforts.every((effort) => (
|
||||
effort !== null
|
||||
&& typeof effort === 'object'
|
||||
&& typeof effort.id === 'string'
|
||||
&& Boolean(effort.id)
|
||||
&& typeof effort.name === 'string'
|
||||
&& Boolean(effort.name)
|
||||
&& (effort.description === undefined || typeof effort.description === 'string')
|
||||
))
|
||||
&& (value.defaultEffort === undefined
|
||||
|| (typeof value.defaultEffort === 'string' && Boolean(value.defaultEffort)));
|
||||
}
|
||||
|
||||
function validateModelCatalog(value, method, { session = false } = {}) {
|
||||
|
|
@ -123,7 +142,9 @@ function validateModelCatalog(value, method, { session = false } = {}) {
|
|||
for (const model of group.models) {
|
||||
if (!model || typeof model !== 'object'
|
||||
|| typeof model.id !== 'string' || !model.id
|
||||
|| typeof model.name !== 'string' || !model.name) {
|
||||
|| typeof model.name !== 'string' || !model.name
|
||||
|| (model.description !== undefined && typeof model.description !== 'string')
|
||||
|| (model.reasoning !== undefined && !validModelReasoning(model.reasoning))) {
|
||||
throw new Error(`Harness returned an invalid response for ${method}`);
|
||||
}
|
||||
}
|
||||
|
|
@ -728,6 +749,9 @@ export class HarnessClient {
|
|||
sessionId,
|
||||
provider: selection.provider,
|
||||
model: selection.model,
|
||||
...(selection.reasoningEffort === undefined
|
||||
? {}
|
||||
: { reasoningEffort: selection.reasoningEffort }),
|
||||
}, 30_000, signal ? { ...options, signal } : options);
|
||||
};
|
||||
const value = this.#sessionMaintenanceExecutor
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue