Rework AI alts
This commit is contained in:
parent
ac06436359
commit
de06012053
5 changed files with 176 additions and 112 deletions
|
|
@ -2,7 +2,7 @@ import { MatrixClient, MsgType } from "matrix-js-sdk";
|
|||
import type { ICallbackStore } from "../types.js";
|
||||
import { config } from "../../config.js";
|
||||
import { getTextGemini, getImageGemini } from "../../services/ai/ai.js";
|
||||
import { animals } from "./animals.js";
|
||||
import { alts } from "./alts.js";
|
||||
|
||||
let client: MatrixClient;
|
||||
|
||||
|
|
@ -18,8 +18,8 @@ const registerModuleAI = (
|
|||
});
|
||||
callbackStore.messageCallbacks.push({
|
||||
startConditions: [
|
||||
...animals.map((animal) => `${animal.name} when`),
|
||||
...animals.map((animal) => `${animal.name} ked`),
|
||||
...alts.map((alt) => `${alt.key} when`),
|
||||
...alts.map((alt) => `${alt.key} ked`),
|
||||
`!img`,
|
||||
],
|
||||
callbackFunc: onImageGen,
|
||||
|
|
@ -37,8 +37,8 @@ const onAI = async (text: string, roomId: string) => {
|
|||
|
||||
const onImageGen = async (text: string, roomId: string) => {
|
||||
let textMod = text.replace("!img", "").trim().toLowerCase();
|
||||
animals.forEach((animal) => {
|
||||
textMod = textMod.replaceAll(animal.name, animal.animal);
|
||||
alts.forEach((alt) => {
|
||||
textMod = textMod.replaceAll(alt.key, alt.alt);
|
||||
});
|
||||
|
||||
const buffer = await getImageGemini(textMod);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue