myavana-bot-test-core 2.0.7 → 2.0.9
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 +1 -1
- package/src/ai.js +3 -2
- package/src/conversation.js +2 -2
- package/src/postResponseProcessing.js +3 -3
- package/src/unifiedChatHandler.js +4 -4
package/package.json
CHANGED
package/src/ai.js
CHANGED
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
// ai.js
|
|
2
2
|
const { genkit } = require('genkit');
|
|
3
|
-
const { googleAI
|
|
3
|
+
const { googleAI } = require('@genkit-ai/googleai');
|
|
4
|
+
|
|
4
5
|
const config = require('./config');
|
|
5
6
|
|
|
6
7
|
const ai = genkit({
|
|
7
8
|
plugins: [googleAI({
|
|
8
9
|
apiKey: config.genkitApiKey,
|
|
9
10
|
})],
|
|
10
|
-
model:
|
|
11
|
+
model: googleAI.model('gemini-3-flash-preview'),
|
|
11
12
|
});
|
|
12
13
|
|
|
13
14
|
module.exports = ai;
|
package/src/conversation.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// conversation.js
|
|
2
2
|
const { pgClient, redisClient } = require('./database');
|
|
3
3
|
const ai = require('./ai');
|
|
4
|
-
|
|
4
|
+
import { googleAI } from '@genkit-ai/google-genai';
|
|
5
5
|
|
|
6
6
|
const saveConversationSummary = async (conversationId, userId, summary) => {
|
|
7
7
|
const query = `
|
|
@@ -28,7 +28,7 @@ const generateConversationSummary = async (chatHistory) => {
|
|
|
28
28
|
}
|
|
29
29
|
const summaryPrompt = `Summarize the following conversation, getting all important information, especially the user's hair details, name, and location: ${JSON.stringify(chatHistory)}`;
|
|
30
30
|
const { text } = await ai.chat({
|
|
31
|
-
model:
|
|
31
|
+
model: googleAI.model('gemini-2.5-flash'),
|
|
32
32
|
system: summaryPrompt,
|
|
33
33
|
});
|
|
34
34
|
return text;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// postResponseProcessing.js
|
|
2
2
|
const ai = require("./ai");
|
|
3
|
-
|
|
3
|
+
import { googleAI } from '@genkit-ai/google-genai';
|
|
4
4
|
const DatabaseSessionStore = require("./session");
|
|
5
5
|
const { pgClient, redisClient } = require('./database');
|
|
6
6
|
const {generateAndSaveSummary, saveConversationSummary, saveConversation} = require("./conversation");
|
|
@@ -226,7 +226,7 @@ const postProcessConversation = async (chatHistory, message) => {
|
|
|
226
226
|
//console.log('Extraction prompt: ', extractionPrompt);
|
|
227
227
|
try {
|
|
228
228
|
const chat = ai.chat({
|
|
229
|
-
model:
|
|
229
|
+
model: googleAI.model('gemini-2.5-flash'),
|
|
230
230
|
config: {
|
|
231
231
|
temperature: 1.1,
|
|
232
232
|
},
|
|
@@ -385,7 +385,7 @@ const postResponseProductCheck = async (chatHistory, message) => {
|
|
|
385
385
|
// Try Gemini first
|
|
386
386
|
try {
|
|
387
387
|
const chat = ai.chat({
|
|
388
|
-
model:
|
|
388
|
+
model: googleAI.model('gemini-2.5-flash'),
|
|
389
389
|
config: {
|
|
390
390
|
temperature: 0.3, // Reduced temperature for more consistent JSON formatting
|
|
391
391
|
},
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// unifiedChatHandler.js - Fixed version with proper model prioritization
|
|
2
2
|
const { genkit, z } = require('genkit');
|
|
3
|
-
|
|
3
|
+
import { googleAI } from '@genkit-ai/google-genai';
|
|
4
4
|
|
|
5
5
|
class UnifiedChatHandler {
|
|
6
6
|
constructor(config) {
|
|
@@ -17,9 +17,9 @@ class UnifiedChatHandler {
|
|
|
17
17
|
|
|
18
18
|
// Initialize model priority list - GEMINI FIRST!
|
|
19
19
|
this.modelPriority = [
|
|
20
|
-
{ name: 'gemini20FlashExp', model:
|
|
21
|
-
{ name: 'gemini15Flash', model:
|
|
22
|
-
{ name: 'gemini15Pro', model:
|
|
20
|
+
{ name: 'gemini20FlashExp', model: googleAI.model('gemini-3-flash-preview'), type: 'primary' },
|
|
21
|
+
{ name: 'gemini15Flash', model: googleAI.model('gemini-2.5-flash'), type: 'primary' },
|
|
22
|
+
{ name: 'gemini15Pro', model: googleAI.model('gemini-3-pro-preview'), type: 'backup' }
|
|
23
23
|
];
|
|
24
24
|
|
|
25
25
|
// Only initialize xAI as last resort if API key exists
|