everydaycats commited on
Commit
49740aa
·
verified ·
1 Parent(s): 0ef87a8

Delete aiEngine.js

Browse files
Files changed (1) hide show
  1. aiEngine.js +0 -91
aiEngine.js DELETED
@@ -1,91 +0,0 @@
1
- // aiEngine.js
2
- import { GoogleGenAI } from '@google/genai';
3
-
4
- /* import dotenv from 'dotenv';
5
- dotenv.config();
6
- */
7
-
8
- const genAI = new GoogleGenAI({ apiKey: process.env.GEMINI_API_KEY });
9
-
10
- console.log(process.env.GEMINI_API_KEY);
11
-
12
- // Prompt Loader
13
- import fs from 'fs';
14
- const prompts = JSON.parse(fs.readFileSync('./prompts.json', 'utf8'));
15
-
16
- export const AIEngine = {
17
- /**
18
- * PM MODEL (Gemini 3.0 Pro Preview - High Thinking)
19
- */
20
- callPM: async (history, input) => {
21
- const modelId = 'gemini-3-pro-preview'; // Per prompt requirements
22
- const config = {
23
- thinkingConfig: { thinkingLevel: 'HIGH' },
24
- tools: [{
25
- systemInstruction: [{
26
- text: prompts.pm_system_prompt
27
- }],
28
- googleSearch: {} }],
29
- };
30
-
31
- const contents = [
32
- { role: 'user', parts: [{ text: prompts.pm_system_prompt }] }, // System instruction injection
33
- ...history,
34
- { role: 'user', parts: [{ text: input }] }
35
- ];
36
-
37
- try {
38
- const response = await genAI.models.generateContent({
39
- model: modelId,
40
- config,
41
- contents,
42
- });
43
- return response.text; // Simple text return for non-stream internal logic
44
- } catch (error) {
45
- console.error("PM AI Error:", error);
46
- throw error;
47
- }
48
- },
49
-
50
- /**
51
- * WORKER MODEL (Gemini 2.5 Flash - Fast execution)
52
- */
53
- callWorker: async (history, input, imagePart = null) => {
54
- /* const modelId = 'gemini-flash-latest'; // Per prompt requirements
55
- const config = {
56
- thinkingConfig: { thinkingBudget: -1 }, // Standard generation
57
- */
58
- const modelId = 'gemini-3-pro-preview'; // Per prompt requirements
59
- const config = {
60
- thinkingConfig: { thinkingLevel: 'HIGH' },
61
- tools: [{
62
- systemInstruction: [{
63
- text: prompts.worker_system_prompt
64
- }],
65
- googleSearch: {} }],
66
- };
67
-
68
- const currentParts = [{ text: input }];
69
- if (imagePart) {
70
- currentParts.push(imagePart);
71
- }
72
-
73
- const contents = [
74
- { role: 'user', parts: [{ text: prompts.worker_system_prompt }] },
75
- ...history,
76
- { role: 'user', parts: currentParts }
77
- ];
78
-
79
- try {
80
- const response = await genAI.models.generateContent({
81
- model: modelId,
82
- config,
83
- contents,
84
- });
85
- return response.text;
86
- } catch (error) {
87
- console.error("Worker AI Error:", error);
88
- throw error;
89
- }
90
- }
91
- };