mirror of
https://github.com/moltbot/moltbot.git
synced 2026-04-21 05:32:53 +00:00
fix(telegram): lazy-load sticker vision model lookup
This commit is contained in:
@@ -1,9 +1,3 @@
|
||||
import {
|
||||
findModelInCatalog,
|
||||
loadModelCatalog,
|
||||
modelSupportsVision,
|
||||
} from "openclaw/plugin-sdk/agent-runtime";
|
||||
import { resolveDefaultModelForAgent } from "openclaw/plugin-sdk/agent-runtime";
|
||||
import {
|
||||
buildMentionRegexes,
|
||||
formatLocationText,
|
||||
@@ -62,16 +56,8 @@ async function resolveStickerVisionSupport(params: {
|
||||
agentId?: string;
|
||||
}): Promise<boolean> {
|
||||
try {
|
||||
const catalog = await loadModelCatalog({ config: params.cfg });
|
||||
const defaultModel = resolveDefaultModelForAgent({
|
||||
cfg: params.cfg,
|
||||
agentId: params.agentId,
|
||||
});
|
||||
const entry = findModelInCatalog(catalog, defaultModel.provider, defaultModel.model);
|
||||
if (!entry) {
|
||||
return false;
|
||||
}
|
||||
return modelSupportsVision(entry);
|
||||
const { resolveStickerVisionSupportRuntime } = await import("./sticker-vision.runtime.js");
|
||||
return await resolveStickerVisionSupportRuntime(params);
|
||||
} catch {
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -78,6 +78,7 @@ export type TelegramMessageContext = {
|
||||
statusReactionController: StatusReactionController | null;
|
||||
accountId: string;
|
||||
};
|
||||
|
||||
export const buildTelegramMessageContext = async ({
|
||||
primaryCtx,
|
||||
allMedia,
|
||||
|
||||
23
extensions/telegram/src/sticker-vision.runtime.ts
Normal file
23
extensions/telegram/src/sticker-vision.runtime.ts
Normal file
@@ -0,0 +1,23 @@
|
||||
import {
|
||||
findModelInCatalog,
|
||||
loadModelCatalog,
|
||||
modelSupportsVision,
|
||||
resolveDefaultModelForAgent,
|
||||
} from "openclaw/plugin-sdk/agent-runtime";
|
||||
import type { OpenClawConfig } from "openclaw/plugin-sdk/config-runtime";
|
||||
|
||||
export async function resolveStickerVisionSupportRuntime(params: {
|
||||
cfg: OpenClawConfig;
|
||||
agentId?: string;
|
||||
}): Promise<boolean> {
|
||||
const catalog = await loadModelCatalog({ config: params.cfg });
|
||||
const defaultModel = resolveDefaultModelForAgent({
|
||||
cfg: params.cfg,
|
||||
agentId: params.agentId,
|
||||
});
|
||||
const entry = findModelInCatalog(catalog, defaultModel.provider, defaultModel.model);
|
||||
if (!entry) {
|
||||
return false;
|
||||
}
|
||||
return modelSupportsVision(entry);
|
||||
}
|
||||
Reference in New Issue
Block a user