Rework AI

This commit is contained in:
Aslan 2025-12-28 23:11:33 +01:00
parent e46c4427cc
commit aebee54562
10 changed files with 79 additions and 20 deletions

View file

@ -1,15 +1,22 @@
import { GoogleGenAI } from "@google/genai";
import { config } from "../../config.js";
import type { AIResponseImage, AIResponseText } from "./types.js";
import type { IAIInstructions } from "../../modules/ai/types.js";
const googleAI = new GoogleGenAI({
apiKey: config.app.ai.api.key,
});
const getTextGemini = async (input: string): Promise<AIResponseText> => {
const getTextGemini = async (
instructions: IAIInstructions,
input: string,
): Promise<AIResponseText> => {
const response = await googleAI.models.generateContent({
model: "gemini-3-flash-preview",
contents: input,
config: {
systemInstruction: JSON.stringify(instructions),
},
});
return {