commands: switch AI commands to unified runtime

This commit is contained in:
2026-05-10 22:53:22 +03:00
parent 1b94760b21
commit 3d14e3c0d5
24 changed files with 465 additions and 3580 deletions
+6 -28
View File
@@ -1,37 +1,15 @@
import {Command} from "../base/command";
import {Message} from "typescript-telegram-bot-api";
import {logError, replyToMessage} from "../util/utils";
import {AiProvider} from "../model/ai-provider";
import {formatRuntimeModelInfo} from "../ai/provider-model-runtime";
import {Environment} from "../common/environment";
import {Requirements} from "../base/requirements";
import {Requirement} from "../base/requirement";
import {mistralAi} from "../index";
import {AiModelCapabilities} from "../model/ai-model-capabilities";
export class MistralGetModel extends Command {
title = "/mistralGetModel";
description = "Get current Mistral model";
requirements = Requirements.Build(Requirement.BOT_CREATOR);
title = Environment.commandTitles.mistralGetModel;
description = Environment.commandDescriptions.mistralGetModel;
async execute(msg: Message): Promise<void> {
await replyToMessage({message: msg, text: `Текущая модель: "${Environment.MISTRAL_MODEL}"`}).catch(logError);
await replyToMessage({message: msg, text: await formatRuntimeModelInfo(AiProvider.MISTRAL)}).catch(logError);
}
async getModelCapabilities(): Promise<AiModelCapabilities | null> {
try {
const info = await mistralAi.models.retrieve({modelId: Environment.MISTRAL_MODEL}) as any;
console.log(info);
return {
vision: {supported: info.capabilities.vision},
ocr: {supported: info.capabilities.ocr},
thinking: undefined,
tools: {supported: info.capabilities.functionCalling},
audio: {supported: info.capabilities.audioTranscription}
};
} catch (e) {
logError(e);
return null;
}
}
}
}