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
This commit is contained in:
2026-01-29 20:01:30 +03:00
parent 5f4405c9ee
commit b74e0a0f3e
16 changed files with 312 additions and 148 deletions
+7 -2
View File
@@ -34,7 +34,8 @@ export class GeminiChat extends ChatCommand {
const chatId = msg.chat.id;
const messageParts = await collectReplyChainText(msg);
const storedMsg = await MessageStore.get(chatId, msg.message_id);
const messageParts = await collectReplyChainText(storedMsg);
console.log("MESSAGE PARTS", messageParts);
const chatMessages = messageParts.map(part => {
@@ -64,7 +65,7 @@ export class GeminiChat extends ChatCommand {
if (messageParts[0].images?.length) {
const images = messageParts[0].images;
images.forEach(image=>{
images.forEach(image => {
const base64Image = Buffer.from(fs.readFileSync(image)).toString("base64");
input.push({
type: "image",
@@ -144,6 +145,10 @@ export class GeminiChat extends ChatCommand {
}
break;
}
case "image": {
const image = event.delta.data;
console.log("image", image);
}
}
}
}