myavana-bot-test-core 2.1.6 → 2.1.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +2 -1
- package/src/cacheManager.js +4 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "myavana-bot-test-core",
|
|
3
|
-
"version": "2.1.
|
|
3
|
+
"version": "2.1.7",
|
|
4
4
|
"description": "Shared bot functionality with enhanced features",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -13,6 +13,7 @@
|
|
|
13
13
|
"dependencies": {
|
|
14
14
|
"@genkit-ai/google-genai": "^1.28.0",
|
|
15
15
|
"@genkit-ai/googleai": "^1.28.0",
|
|
16
|
+
"@google/genai": "^1.39.0",
|
|
16
17
|
"dotenv": "^16.4.7",
|
|
17
18
|
"express-rate-limit": "^7.1.5",
|
|
18
19
|
"express-slow-down": "^2.0.1",
|
package/src/cacheManager.js
CHANGED
|
@@ -3,11 +3,14 @@
|
|
|
3
3
|
const ai = require('./ai');
|
|
4
4
|
const { googleAI } = require('@genkit-ai/google-genai');
|
|
5
5
|
const { pgClient, redisClient } = require('./database');
|
|
6
|
+
const {GoogleGenAI} = require("@google/genai");
|
|
7
|
+
const config = require('./config');
|
|
6
8
|
|
|
7
9
|
/**
|
|
8
10
|
* Cache Manager for Gemini API
|
|
9
11
|
* Handles creation, retrieval, and expiration of cached system instructions
|
|
10
12
|
*/
|
|
13
|
+
const cacheAi = new GoogleGenAI({ apiKey: config.genkitApiKey });
|
|
11
14
|
class CacheManager {
|
|
12
15
|
constructor() {
|
|
13
16
|
this.CACHE_TTL_HOURS = 24;
|
|
@@ -52,7 +55,7 @@ class CacheManager {
|
|
|
52
55
|
console.log('🆕 Creating new cache for user:', userId);
|
|
53
56
|
const cacheStartTime = performance.now();
|
|
54
57
|
|
|
55
|
-
const cache = await
|
|
58
|
+
const cache = await cacheAi.caches.create({
|
|
56
59
|
model: googleAI.model('gemini-3-flash-preview'),
|
|
57
60
|
config: {
|
|
58
61
|
systemInstruction: systemPrompt,
|