3848dd82d9
Add explicit chat capability tracking, expose formatted runtime capabilities in the info command, and support a max context size option for user AI settings. Also update Ollama base URL resolution to use OLLAMA_ADDRESS and simplify provider chat command execution.
28 lines
983 B
TypeScript
28 lines
983 B
TypeScript
import {Message} from "typescript-telegram-bot-api";
|
|
import {ChatCommand} from "../base/chat-command";
|
|
import {Requirements} from "../base/requirements";
|
|
import {Requirement} from "../base/requirement";
|
|
import {AiProvider} from "../model/ai-provider";
|
|
import {runUnifiedAi} from "../ai/unified-ai-runner";
|
|
import {Environment} from "../common/environment";
|
|
|
|
export class OllamaChat extends ChatCommand {
|
|
command = ["ollama", "ollama-chat", "think"];
|
|
argsMode = "required" as const;
|
|
|
|
requirements = Requirements.Build(Requirement.BOT_CREATOR);
|
|
|
|
title = Environment.commandTitles.ollamaChat;
|
|
description = Environment.commandDescriptions.ollamaChat;
|
|
|
|
async execute(msg: Message, match?: RegExpExecArray): Promise<void> {
|
|
await runUnifiedAi({
|
|
provider: AiProvider.OLLAMA,
|
|
msg: msg,
|
|
text: match?.[3] ?? "",
|
|
stream: true,
|
|
think: match?.[1]?.toLowerCase()?.startsWith("think")
|
|
});
|
|
}
|
|
}
|