From f43e90f2d292a72aba4d91302849fb2df1426163 Mon Sep 17 00:00:00 2001 From: Kacper Date: Tue, 30 Dec 2025 14:20:06 +0100 Subject: [PATCH] feat(server): Wire describe-image to use phaseModels.imageDescriptionModel MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Replace hardcoded CLAUDE_MODEL_MAP.haiku with configurable model from settings.phaseModels.imageDescriptionModel. Falls back to DEFAULT_PHASE_MODELS if settings unavailable. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 --- .../routes/context/routes/describe-image.ts | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/apps/server/src/routes/context/routes/describe-image.ts b/apps/server/src/routes/context/routes/describe-image.ts index e4821b4a..4424aeb9 100644 --- a/apps/server/src/routes/context/routes/describe-image.ts +++ b/apps/server/src/routes/context/routes/describe-image.ts @@ -1,8 +1,9 @@ /** * POST /context/describe-image endpoint - Generate description for an image * - * Uses Claude Haiku to analyze an image and generate a concise description - * suitable for context file metadata. + * Uses AI to analyze an image and generate a concise description + * suitable for context file metadata. Model is configurable via + * phaseModels.imageDescriptionModel in settings (defaults to Haiku). * * IMPORTANT: * The agent runner (chat/auto-mode) sends images as multi-part content blocks (base64 image blocks), @@ -13,7 +14,8 @@ import type { Request, Response } from 'express'; import { query } from '@anthropic-ai/claude-agent-sdk'; import { createLogger, readImageAsBase64 } from '@automaker/utils'; -import { CLAUDE_MODEL_MAP } from '@automaker/types'; +import { DEFAULT_PHASE_MODELS } from '@automaker/types'; +import { resolveModelString } from '@automaker/model-resolver'; import { createCustomOptions } from '../../../lib/sdk-options.js'; import * as fs from 'fs'; import * as path from 'path'; @@ -337,10 +339,18 @@ export function createDescribeImageHandler( '[DescribeImage]' ); + // Get model from phase settings + const settings = await settingsService?.getGlobalSettings(); + const imageDescriptionModel = + settings?.phaseModels?.imageDescriptionModel || DEFAULT_PHASE_MODELS.imageDescriptionModel; + const model = resolveModelString(imageDescriptionModel); + + logger.info(`[${requestId}] Using model: ${model}`); + // Use the same centralized option builder used across the server (validates cwd) const sdkOptions = createCustomOptions({ cwd, - model: CLAUDE_MODEL_MAP.haiku, + model, maxTurns: 1, allowedTools: [], autoLoadClaudeMd,