Rework AI
This commit is contained in:
parent
e46c4427cc
commit
aebee54562
10 changed files with 79 additions and 20 deletions
|
|
@ -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 {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue