mirror of
https://github.com/siteboon/claudecodeui.git
synced 2026-07-02 10:33:00 +08:00
refactor: generic provider effort handling
This commit is contained in:
@@ -12,11 +12,13 @@
|
||||
* - WebSocket message streaming
|
||||
*/
|
||||
|
||||
import { query } from '@anthropic-ai/claude-agent-sdk';
|
||||
import crypto from 'crypto';
|
||||
import { promises as fs } from 'fs';
|
||||
import path from 'path';
|
||||
import os from 'os';
|
||||
import path from 'path';
|
||||
|
||||
import { query } from '@anthropic-ai/claude-agent-sdk';
|
||||
|
||||
import { CLAUDE_FALLBACK_MODELS } from './modules/providers/list/claude/claude-models.provider.js';
|
||||
import { providerModelsService } from './modules/providers/services/provider-models.service.js';
|
||||
import { resolveClaudeCodeExecutablePath } from './shared/claude-cli-path.js';
|
||||
@@ -42,8 +44,7 @@ const TOOL_APPROVAL_TIMEOUT_MS = parseInt(process.env.CLAUDE_TOOL_APPROVAL_TIMEO
|
||||
const TOOLS_REQUIRING_INTERACTION = new Set(['AskUserQuestion', 'ExitPlanMode']);
|
||||
|
||||
function resolveClaudeEffort(model, effort, modelsDefinition = CLAUDE_FALLBACK_MODELS) {
|
||||
const selectedModel = modelsDefinition.OPTIONS
|
||||
.find((option) => option.value === model) || null;
|
||||
const selectedModel = modelsDefinition?.OPTIONS?.find((option) => option.value === model) || null;
|
||||
const allowedEfforts = selectedModel?.effort?.values
|
||||
?.map((value) => value.value) || [];
|
||||
return typeof effort === 'string' && effort !== 'default' && allowedEfforts.includes(effort)
|
||||
|
||||
Reference in New Issue
Block a user