Files
tg-chat-bot/src/commands/ollama-get-model.ts
T
melod1n b74e0a0f3e refactor(bot): centralize runtime state; support albums + safer vision handling
- make MessageStore.put() return StoredMessage and allow collectReplyChainText() to work with StoredMessage
- move muted users + answers loading into Environment (add Answers model + GEMINI_IMAGE_MODEL)
- extract message handling into processNewMessage() and add media-group (album) caching/downloading by unique_file_id
- for Ollama: check model capabilities before sending images; use replyToMessage helper consistently
- add /geminiGenImage command stub for Gemini image generation
2026-01-29 20:01:30 +03:00

35 lines
1.3 KiB
TypeScript

import {ChatCommand} from "../base/chat-command";
import {Message} from "typescript-telegram-bot-api";
import {boolToEmoji, logError, replyToMessage} from "../util/utils";
import {Environment} from "../common/environment";
import {ollama} from "../index";
import {ShowResponse} from "ollama";
export class OllamaGetModel extends ChatCommand {
title = "/ollamaGetModel";
description = "Ollama model info";
async execute(msg: Message): Promise<void> {
try {
const showResponse = await this.loadModelInfo();
const caps = showResponse.capabilities;
const text = "```Ollama\n" +
`model: ${Environment.OLLAMA_MODEL}\n\n` +
`vision: ${boolToEmoji(caps.includes("vision"))}\n` +
`thinking: ${boolToEmoji(caps.includes("thinking"))}\n` +
`tools: ${boolToEmoji(caps.includes("tools"))}`
+ "```";
await replyToMessage({message: msg, text: text, parse_mode: "Markdown"}).catch(logError);
} catch (e) {
logError(e);
await replyToMessage({message: msg, text: e.toString()}).catch(logError);
}
}
async loadModelInfo(): Promise<ShowResponse | null> {
return ollama.show({model: Environment.OLLAMA_MODEL});
}
}