mirror of
https://github.com/wu736139669/hapi.git
synced 2026-08-05 06:24:37 +00:00
fix(codex): support dynamic reasoning efforts (#1012)
* fix(codex): support model-reported reasoning efforts * fix(web): prevent service worker edge caching * ci: retrigger stuck Actions run * fix(codex): accept dynamic reasoning effort values * fix(web): restore reasoning effort on model switch failure
This commit is contained in:
@@ -19,11 +19,10 @@ import type { ReasoningEffort } from './appServerTypes';
|
||||
import { parseCodexSpecialCommand } from './codexSpecialCommands';
|
||||
import { listSlashCommands } from '@/modules/common/slashCommands';
|
||||
import { resolveCodexSlashCommand } from './utils/slashCommands';
|
||||
import { parseReasoningEffortValue } from './utils/reasoningEffort';
|
||||
|
||||
export { emitReadyIfIdle } from './utils/emitReadyIfIdle';
|
||||
|
||||
const REASONING_EFFORTS = new Set<ReasoningEffort>(['none', 'minimal', 'low', 'medium', 'high', 'xhigh'])
|
||||
|
||||
export async function runCodex(opts: {
|
||||
startedBy?: 'runner' | 'terminal';
|
||||
codexArgs?: string[];
|
||||
@@ -304,16 +303,6 @@ export async function runCodex(opts: {
|
||||
return parsed.data;
|
||||
};
|
||||
|
||||
const resolveModelReasoningEffort = (value: unknown): ReasoningEffort | undefined => {
|
||||
if (value === null) {
|
||||
return undefined;
|
||||
}
|
||||
if (typeof value !== 'string' || !REASONING_EFFORTS.has(value as ReasoningEffort)) {
|
||||
throw new Error('Invalid model reasoning effort');
|
||||
}
|
||||
return value as ReasoningEffort;
|
||||
};
|
||||
|
||||
const resolveModel = (value: unknown): string => {
|
||||
if (typeof value !== 'string') {
|
||||
throw new Error('Invalid model');
|
||||
@@ -363,7 +352,7 @@ export async function runCodex(opts: {
|
||||
}
|
||||
|
||||
if (config.modelReasoningEffort !== undefined) {
|
||||
currentModelReasoningEffort = resolveModelReasoningEffort(config.modelReasoningEffort);
|
||||
currentModelReasoningEffort = parseReasoningEffortValue(config.modelReasoningEffort);
|
||||
}
|
||||
|
||||
if (config.collaborationMode !== undefined) {
|
||||
|
||||
Reference in New Issue
Block a user