feat(ollama): add tool calling support
Add Ollama tool integration for web search, weather, datetime, filesystem operations, and shell evaluation. Implement multi-round tool call handling, streaming updates, thinking cleanup, and safer path validation for file tools. Also add related environment configuration, command execution helper, MarkdownV2 cancel handling fixes, and remove unused TryAgain callback command.
This commit is contained in:
@@ -13,7 +13,7 @@ export class Cancel extends CallbackCommand {
|
||||
}
|
||||
|
||||
static withData(data?: string): Cancel {
|
||||
return new Cancel("", data);
|
||||
return new Cancel(undefined, data);
|
||||
}
|
||||
|
||||
async execute(): Promise<void> {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import {CallbackCommand} from "../base/callback-command";
|
||||
import {CallbackQuery} from "typescript-telegram-bot-api";
|
||||
import {abortOllamaRequest, bot, getOllamaRequest} from "../index";
|
||||
import {logError} from "../util/utils";
|
||||
import {escapeMarkdownV2Text, logError} from "../util/utils";
|
||||
import {MessageStore} from "../common/message-store";
|
||||
import {StoredMessage} from "../model/stored-message";
|
||||
import {Requirements} from "../base/requirements";
|
||||
@@ -59,8 +59,8 @@ export class OllamaCancel extends CallbackCommand {
|
||||
await bot.editMessageText({
|
||||
chat_id: chatId,
|
||||
message_id: messageId,
|
||||
text: newText,
|
||||
parse_mode: "Markdown",
|
||||
text: escapeMarkdownV2Text(newText),
|
||||
parse_mode: "MarkdownV2",
|
||||
reply_markup: {inline_keyboard: []},
|
||||
});
|
||||
|
||||
|
||||
@@ -1,21 +0,0 @@
|
||||
import {CallbackCommand} from "../base/callback-command";
|
||||
|
||||
export class TryAgain extends CallbackCommand {
|
||||
data = "";
|
||||
text = "🔁 Повторить";
|
||||
|
||||
constructor(text?: string, data?: string) {
|
||||
super();
|
||||
|
||||
this.text = text ?? this.text;
|
||||
this.data = data ?? this.data;
|
||||
}
|
||||
|
||||
static withData(data?: string): TryAgain {
|
||||
return new TryAgain("", data);
|
||||
}
|
||||
|
||||
async execute(): Promise<void> {
|
||||
return Promise.resolve();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user