Rework AI alts

This commit is contained in:
Aslan 2025-12-26 13:52:46 +01:00
parent ac06436359
commit de06012053
5 changed files with 176 additions and 112 deletions

View file

@ -1,6 +1,6 @@
{ {
"name": "aslobot-matrix", "name": "aslobot-matrix",
"version": "0.5.3", "version": "0.6.0",
"description": "", "description": "",
"license": "ISC", "license": "ISC",
"author": "", "author": "",

View file

@ -2,7 +2,7 @@ import { MatrixClient, MsgType } from "matrix-js-sdk";
import type { ICallbackStore } from "../types.js"; import type { ICallbackStore } from "../types.js";
import { config } from "../../config.js"; import { config } from "../../config.js";
import { getTextGemini, getImageGemini } from "../../services/ai/ai.js"; import { getTextGemini, getImageGemini } from "../../services/ai/ai.js";
import { animals } from "./animals.js"; import { alts } from "./alts.js";
let client: MatrixClient; let client: MatrixClient;
@ -18,8 +18,8 @@ const registerModuleAI = (
}); });
callbackStore.messageCallbacks.push({ callbackStore.messageCallbacks.push({
startConditions: [ startConditions: [
...animals.map((animal) => `${animal.name} when`), ...alts.map((alt) => `${alt.key} when`),
...animals.map((animal) => `${animal.name} ked`), ...alts.map((alt) => `${alt.key} ked`),
`!img`, `!img`,
], ],
callbackFunc: onImageGen, callbackFunc: onImageGen,
@ -37,8 +37,8 @@ const onAI = async (text: string, roomId: string) => {
const onImageGen = async (text: string, roomId: string) => { const onImageGen = async (text: string, roomId: string) => {
let textMod = text.replace("!img", "").trim().toLowerCase(); let textMod = text.replace("!img", "").trim().toLowerCase();
animals.forEach((animal) => { alts.forEach((alt) => {
textMod = textMod.replaceAll(animal.name, animal.animal); textMod = textMod.replaceAll(alt.key, alt.alt);
}); });
const buffer = await getImageGemini(textMod); const buffer = await getImageGemini(textMod);

166
src/modules/ai/alts.ts Normal file
View file

@ -0,0 +1,166 @@
import type { IAIAlt } from "./types.js";
const alts: IAIAlt[] = [
{
key: "satek",
alt: "black cat",
},
{
key: "sateg",
alt: "black cat",
},
{
key: "sadeg",
alt: "black cat",
},
{
key: "satko",
alt: "black cat",
},
{
key: "sadko",
alt: "black cat",
},
{
key: "vlado",
alt: "black cat",
},
{
key: "vladko",
alt: "black cat",
},
{
key: "vladimir",
alt: "black cat",
},
{
key: "macag",
alt: "black cat",
},
{
key: "vladko",
alt: "black cat",
},
{
key: "macica",
alt: "white cat",
},
{
key: "macico",
alt: "white cat",
},
{
key: "gabor",
alt: "hedgehog",
},
{
key: "martin",
alt: "hedgehog",
},
{
key: "madys",
alt: "beaver",
},
{
key: "mandak",
alt: "beaver",
},
{
key: "mando",
alt: "beaver",
},
{
key: "mandik",
alt: "beaver",
},
{
key: "madik",
alt: "beaver",
},
{
key: "madeg",
alt: "beaver",
},
{
key: "janys",
alt: "lion",
},
{
key: "jano",
alt: "lion",
},
{
key: "janeg",
alt: "lion",
},
{
key: "aslan",
alt: "lion",
},
{
key: "aslo",
alt: "lion",
},
{
key: "marek",
alt: "purple snake",
},
{
key: "mareg",
alt: "purple snake",
},
{
key: "maceg",
alt: "purple snake",
},
{
key: "rod",
alt: "purple snake",
},
{
key: "lara",
alt: "ginger dog",
},
{
key: "kostur",
alt: "ginger dog",
},
{
key: "kosturik",
alt: "ginger dog",
},
{
key: "tato",
alt: "troll",
},
{
key: "mama",
alt: "angel",
},
{
key: "monika",
alt: "angel",
},
{
key: "puk",
alt: "rat",
},
{
key: "becky",
alt: "giantess",
},
{
key: "beky",
alt: "giantess",
},
{
key: "beki",
alt: "giantess",
},
{
key: "veronika",
alt: "lgbt princess",
},
];
export { alts };

View file

@ -1,102 +0,0 @@
import type { IAnimal } from "./types.js";
const animals: IAnimal[] = [
{
name: "satek",
animal: "black cat",
},
{
name: "satko",
animal: "black cat",
},
{
name: "vlado",
animal: "black cat",
},
{
name: "macag",
animal: "black cat",
},
{
name: "vladko",
animal: "black cat",
},
{
name: "macica",
animal: "white cat",
},
{
name: "macico",
animal: "white cat",
},
{
name: "gabor",
animal: "hedgehog",
},
{
name: "martin",
animal: "hedgehog",
},
{
name: "madys",
animal: "beaver",
},
{
name: "mandak",
animal: "beaver",
},
{
name: "mando",
animal: "beaver",
},
{
name: "mandik",
animal: "beaver",
},
{
name: "madik",
animal: "beaver",
},
{
name: "madeg",
animal: "beaver",
},
{
name: "janys",
animal: "lion",
},
{
name: "jano",
animal: "lion",
},
{
name: "janeg",
animal: "lion",
},
{
name: "aslan",
animal: "lion",
},
{
name: "aslo",
animal: "lion",
},
{
name: "marek",
animal: "purple snake",
},
{
name: "mareg",
animal: "purple snake",
},
{
name: "maceg",
animal: "purple snake",
},
{
name: "rod",
animal: "purple snake",
},
];
export { animals };

View file

@ -1,6 +1,6 @@
interface IAnimal { interface IAIAlt {
name: string; key: string;
animal: string; alt: string;
} }
export { type IAnimal }; export { type IAIAlt };