update regex matching - now bot responds only for base commands (like /ping) and with mention (like /ping@panfilovi4_bot) and ignores command if it mentions other bot;

Add ability to see, change and list gemini, mistral and ollama models
This commit is contained in:
2026-01-20 08:31:05 +03:00
parent c31345a3eb
commit 32baaebb93
52 changed files with 605 additions and 231 deletions
+16 -4
View File
@@ -30,10 +30,10 @@ export class Environment {
static OLLAMA_API_KEY?: string;
static GEMINI_API_KEY?: string;
static GEMINI_MODEL?: string;
static GEMINI_MODEL: string;
static MISTRAL_API_KEY?: string;
static MISTRAL_MODEL?: string;
static MISTRAL_MODEL: string;
static waitText = "⏳ Дайте-ка подумать...";
@@ -64,10 +64,10 @@ export class Environment {
Environment.OLLAMA_API_KEY = process.env.OLLAMA_API_KEY;
Environment.GEMINI_API_KEY = process.env.GEMINI_API_KEY;
Environment.GEMINI_MODEL = process.env.GEMINI_MODEL;
Environment.GEMINI_MODEL = process.env.GEMINI_MODEL || "gemini-2.5-flash";
Environment.MISTRAL_API_KEY = process.env.MISTRAL_API_KEY;
Environment.MISTRAL_MODEL = process.env.MISTRAL_MODEL;
Environment.MISTRAL_MODEL = process.env.MISTRAL_MODEL || "mistral-small-latest";
}
static setAdmins(admins: Set<number>) {
@@ -93,4 +93,16 @@ export class Environment {
return has;
}
static setOllamaModel(newModel: string) {
Environment.OLLAMA_MODEL = newModel;
}
static setGeminiModel(newModel: string) {
Environment.GEMINI_MODEL = newModel;
}
static setMistralModel(newModel: string) {
Environment.MISTRAL_MODEL = newModel;
}
}
+1
View File
@@ -2,4 +2,5 @@ export type MessagePart = {
bot: boolean;
name?: string;
content: string;
images: string[];
}
+1 -1
View File
@@ -18,7 +18,7 @@ export class MessageStore {
static async put(m: Message, prefix: string = Environment.BOT_PREFIX) {
const msg: StoredMessage = {
chatId: m.chat.id,
messageId: m.message_id,
id: m.message_id,
replyToMessageId: m.reply_to_message?.message_id ?? null,
fromId: m.from.id,
text: extractTextMessage(m, prefix),