mirror of
https://github.com/AutoMaker-Org/automaker.git
synced 2026-02-03 08:53:36 +00:00
feat(server): Wire describe-image to use phaseModels.imageDescriptionModel
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 <noreply@anthropic.com>
This commit is contained in:
@@ -1,8 +1,9 @@
|
|||||||
/**
|
/**
|
||||||
* POST /context/describe-image endpoint - Generate description for an image
|
* POST /context/describe-image endpoint - Generate description for an image
|
||||||
*
|
*
|
||||||
* Uses Claude Haiku to analyze an image and generate a concise description
|
* Uses AI to analyze an image and generate a concise description
|
||||||
* suitable for context file metadata.
|
* suitable for context file metadata. Model is configurable via
|
||||||
|
* phaseModels.imageDescriptionModel in settings (defaults to Haiku).
|
||||||
*
|
*
|
||||||
* IMPORTANT:
|
* IMPORTANT:
|
||||||
* The agent runner (chat/auto-mode) sends images as multi-part content blocks (base64 image blocks),
|
* 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 type { Request, Response } from 'express';
|
||||||
import { query } from '@anthropic-ai/claude-agent-sdk';
|
import { query } from '@anthropic-ai/claude-agent-sdk';
|
||||||
import { createLogger, readImageAsBase64 } from '@automaker/utils';
|
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 { createCustomOptions } from '../../../lib/sdk-options.js';
|
||||||
import * as fs from 'fs';
|
import * as fs from 'fs';
|
||||||
import * as path from 'path';
|
import * as path from 'path';
|
||||||
@@ -337,10 +339,18 @@ export function createDescribeImageHandler(
|
|||||||
'[DescribeImage]'
|
'[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)
|
// Use the same centralized option builder used across the server (validates cwd)
|
||||||
const sdkOptions = createCustomOptions({
|
const sdkOptions = createCustomOptions({
|
||||||
cwd,
|
cwd,
|
||||||
model: CLAUDE_MODEL_MAP.haiku,
|
model,
|
||||||
maxTurns: 1,
|
maxTurns: 1,
|
||||||
allowedTools: [],
|
allowedTools: [],
|
||||||
autoLoadClaudeMd,
|
autoLoadClaudeMd,
|
||||||
|
|||||||
Reference in New Issue
Block a user