mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-10 13:34:58 +00:00
fix(models): support minimax-portal coding plan vlm routing for image tool (openclaw#33953)
Verified: - pnpm install --frozen-lockfile - pnpm build - pnpm check - pnpm test:macmini Co-authored-by: tars90percent <252094836+tars90percent@users.noreply.github.com>
This commit is contained in:
@@ -12,6 +12,7 @@ import type { OpenClawConfig } from "../config/config.js";
|
||||
import { STATE_DIR } from "../config/paths.js";
|
||||
import { logVerbose } from "../globals.js";
|
||||
import { loadJsonFile, saveJsonFile } from "../infra/json-file.js";
|
||||
import { AUTO_IMAGE_KEY_PROVIDERS, DEFAULT_IMAGE_MODELS } from "../media-understanding/defaults.js";
|
||||
import { resolveAutoImageModel } from "../media-understanding/runner.js";
|
||||
|
||||
const CACHE_FILE = path.join(STATE_DIR, "telegram", "sticker-cache.json");
|
||||
@@ -142,7 +143,6 @@ export function getCacheStats(): { count: number; oldestAt?: string; newestAt?:
|
||||
|
||||
const STICKER_DESCRIPTION_PROMPT =
|
||||
"Describe this sticker image in 1-2 sentences. Focus on what the sticker depicts (character, object, action, emotion). Be concise and objective.";
|
||||
const VISION_PROVIDERS = ["openai", "anthropic", "google", "minimax"] as const;
|
||||
let imageRuntimePromise: Promise<
|
||||
typeof import("../media-understanding/providers/image-runtime.js")
|
||||
> | null = null;
|
||||
@@ -198,14 +198,7 @@ export async function describeStickerImage(params: DescribeStickerParams): Promi
|
||||
if (entries.length === 0) {
|
||||
return undefined;
|
||||
}
|
||||
const defaultId =
|
||||
provider === "openai"
|
||||
? "gpt-5-mini"
|
||||
: provider === "anthropic"
|
||||
? "claude-opus-4-6"
|
||||
: provider === "google"
|
||||
? "gemini-3-flash-preview"
|
||||
: "MiniMax-VL-01";
|
||||
const defaultId = DEFAULT_IMAGE_MODELS[provider];
|
||||
const preferred = entries.find((entry) => entry.id === defaultId);
|
||||
return preferred ?? entries[0];
|
||||
};
|
||||
@@ -213,14 +206,16 @@ export async function describeStickerImage(params: DescribeStickerParams): Promi
|
||||
let resolved = null as { provider: string; model?: string } | null;
|
||||
if (
|
||||
activeModel &&
|
||||
VISION_PROVIDERS.includes(activeModel.provider as (typeof VISION_PROVIDERS)[number]) &&
|
||||
AUTO_IMAGE_KEY_PROVIDERS.includes(
|
||||
activeModel.provider as (typeof AUTO_IMAGE_KEY_PROVIDERS)[number],
|
||||
) &&
|
||||
(await hasProviderKey(activeModel.provider))
|
||||
) {
|
||||
resolved = activeModel;
|
||||
}
|
||||
|
||||
if (!resolved) {
|
||||
for (const provider of VISION_PROVIDERS) {
|
||||
for (const provider of AUTO_IMAGE_KEY_PROVIDERS) {
|
||||
if (!(await hasProviderKey(provider))) {
|
||||
continue;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user