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:
@@ -1,4 +1,4 @@
|
||||
import {messagesTable} from "./schema";
|
||||
import {MessageInsert, messagesTable} from "./schema";
|
||||
import {DatabaseManager} from "./database-manager";
|
||||
import {StoredMessage} from "../model/stored-message";
|
||||
import {and, eq} from "drizzle-orm";
|
||||
@@ -66,7 +66,7 @@ export class MessageDao extends Dao<StoredMessage> {
|
||||
return this.mapFrom(messages);
|
||||
}
|
||||
|
||||
async insert(values: typeof messagesTable.$inferInsert[]): Promise<true> {
|
||||
async insert(values: MessageInsert[]): Promise<true> {
|
||||
const then = Date.now();
|
||||
const r = await DatabaseManager.db
|
||||
.insert(messagesTable)
|
||||
@@ -82,7 +82,7 @@ export class MessageDao extends Dao<StoredMessage> {
|
||||
return true;
|
||||
}
|
||||
|
||||
mapTo(messages: Message[]): typeof messagesTable.$inferInsert[] {
|
||||
mapTo(messages: Message[]): MessageInsert[] {
|
||||
return messages.map(msg => {
|
||||
return {
|
||||
chatId: msg.chat.id,
|
||||
@@ -95,15 +95,16 @@ export class MessageDao extends Dao<StoredMessage> {
|
||||
});
|
||||
}
|
||||
|
||||
mapFrom(messages: typeof messagesTable.$inferInsert[]): StoredMessage[] {
|
||||
mapFrom(messages: MessageInsert[]): StoredMessage[] {
|
||||
return messages.map(m => {
|
||||
return {
|
||||
chatId: m.chatId,
|
||||
messageId: m.id,
|
||||
id: m.id,
|
||||
replyToMessageId: m.replyToMessageId,
|
||||
fromId: m.fromId,
|
||||
text: m.text,
|
||||
date: m.date
|
||||
date: m.date,
|
||||
photoMaxSizeFilePath: m.photoMaxSizeFilePath
|
||||
};
|
||||
});
|
||||
}
|
||||
|
||||
@@ -7,6 +7,7 @@ export const messagesTable = sqliteTable("messages", {
|
||||
fromId: int().notNull(),
|
||||
text: text(),
|
||||
date: int().notNull(),
|
||||
photoMaxSizeFilePath: text(),
|
||||
});
|
||||
|
||||
export type MessageInsert = typeof messagesTable.$inferInsert;
|
||||
|
||||
Reference in New Issue
Block a user