ninegrid2 6.506.0 → 6.508.0
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/dist/ai/aiContainer.js +19 -13
- package/dist/bundle.cjs.js +21 -15
- package/dist/bundle.esm.js +19 -13
- package/package.json +1 -1
- package/src/ai/aiContainer.js +19 -13
package/dist/ai/aiContainer.js
CHANGED
|
@@ -2,6 +2,7 @@ import ninegrid from "../index.js";
|
|
|
2
2
|
import { ChatGoogleGenerativeAI } from "@langchain/google-genai";
|
|
3
3
|
import { Ollama } from "@langchain/ollama";
|
|
4
4
|
import { ChatOpenAI } from '@langchain/openai';
|
|
5
|
+
import { HumanMessage, SystemMessage } from '@langchain/core/messages';
|
|
5
6
|
|
|
6
7
|
class aiContainer extends HTMLElement
|
|
7
8
|
{
|
|
@@ -10,6 +11,9 @@ class aiContainer extends HTMLElement
|
|
|
10
11
|
#model;
|
|
11
12
|
//#elChat;
|
|
12
13
|
|
|
14
|
+
#geminiApiKey = "";
|
|
15
|
+
#openaiApiKey = "";
|
|
16
|
+
|
|
13
17
|
constructor() {
|
|
14
18
|
super();
|
|
15
19
|
this.attachShadow({ mode: 'open' });
|
|
@@ -54,26 +58,28 @@ class aiContainer extends HTMLElement
|
|
|
54
58
|
});
|
|
55
59
|
};
|
|
56
60
|
|
|
57
|
-
get target() {
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
61
|
+
get target() { return this.#target; };
|
|
62
|
+
set target(v) { this.#target = v; };
|
|
63
|
+
|
|
64
|
+
get geminiApiKey() { return this.#geminiApiKey; };
|
|
65
|
+
set geminiApiKey(v) { this.#geminiApiKey = v; };
|
|
66
|
+
|
|
67
|
+
get openaiApiKey() { return this.#openaiApiKey; };
|
|
68
|
+
set openaiApiKey(v) { this.#openaiApiKey = v; };
|
|
63
69
|
|
|
64
70
|
#createModel = () => {
|
|
65
|
-
const
|
|
66
|
-
if (!
|
|
71
|
+
const elSettings = this.shadowRoot.querySelector("nx-ai-settings");
|
|
72
|
+
if (!elSettings) return;
|
|
67
73
|
|
|
68
|
-
switch (
|
|
74
|
+
switch (elSettings.server) {
|
|
69
75
|
case "gemini":
|
|
70
|
-
this.#model = new ChatGoogleGenerativeAI({ model:
|
|
76
|
+
this.#model = new ChatGoogleGenerativeAI({ model: elSettings.model, apiKey: this.geminiApiKey, temperature: 0,});
|
|
71
77
|
break;
|
|
72
78
|
case "openai":
|
|
73
|
-
this.#model = new ChatOpenAI({ model:
|
|
79
|
+
this.#model = new ChatOpenAI({ model: elSettings.model, apiKey: this.openaiApiKey });
|
|
74
80
|
break;
|
|
75
81
|
case "ollama":
|
|
76
|
-
this.#model = new Ollama({ model:
|
|
82
|
+
this.#model = new Ollama({ model: elSettings.model });
|
|
77
83
|
break;
|
|
78
84
|
}
|
|
79
85
|
};
|
|
@@ -224,7 +230,7 @@ this.#generateQdrantFilter();
|
|
|
224
230
|
this.#q3();
|
|
225
231
|
}
|
|
226
232
|
} catch (error) {
|
|
227
|
-
console.error("Error generating Qdrant filter
|
|
233
|
+
console.error("Error generating Qdrant filter:", error);
|
|
228
234
|
return null;
|
|
229
235
|
}
|
|
230
236
|
|
package/dist/bundle.cjs.js
CHANGED
|
@@ -4,6 +4,7 @@ var ExcelJS$1 = require('exceljs');
|
|
|
4
4
|
var googleGenai = require('@langchain/google-genai');
|
|
5
5
|
var ollama = require('@langchain/ollama');
|
|
6
6
|
var openai = require('@langchain/openai');
|
|
7
|
+
var messages = require('@langchain/core/messages');
|
|
7
8
|
|
|
8
9
|
function getDefaultExportFromCjs (x) {
|
|
9
10
|
return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
|
|
@@ -27864,6 +27865,9 @@ class aiContainer extends HTMLElement
|
|
|
27864
27865
|
#model;
|
|
27865
27866
|
//#elChat;
|
|
27866
27867
|
|
|
27868
|
+
#geminiApiKey = "";
|
|
27869
|
+
#openaiApiKey = "";
|
|
27870
|
+
|
|
27867
27871
|
constructor() {
|
|
27868
27872
|
super();
|
|
27869
27873
|
this.attachShadow({ mode: 'open' });
|
|
@@ -27908,26 +27912,28 @@ class aiContainer extends HTMLElement
|
|
|
27908
27912
|
});
|
|
27909
27913
|
};
|
|
27910
27914
|
|
|
27911
|
-
get target() {
|
|
27912
|
-
|
|
27913
|
-
|
|
27914
|
-
|
|
27915
|
-
|
|
27916
|
-
|
|
27915
|
+
get target() { return this.#target; };
|
|
27916
|
+
set target(v) { this.#target = v; };
|
|
27917
|
+
|
|
27918
|
+
get geminiApiKey() { return this.#geminiApiKey; };
|
|
27919
|
+
set geminiApiKey(v) { this.#geminiApiKey = v; };
|
|
27920
|
+
|
|
27921
|
+
get openaiApiKey() { return this.#openaiApiKey; };
|
|
27922
|
+
set openaiApiKey(v) { this.#openaiApiKey = v; };
|
|
27917
27923
|
|
|
27918
27924
|
#createModel = () => {
|
|
27919
|
-
const
|
|
27920
|
-
if (!
|
|
27925
|
+
const elSettings = this.shadowRoot.querySelector("nx-ai-settings");
|
|
27926
|
+
if (!elSettings) return;
|
|
27921
27927
|
|
|
27922
|
-
switch (
|
|
27928
|
+
switch (elSettings.server) {
|
|
27923
27929
|
case "gemini":
|
|
27924
|
-
this.#model = new googleGenai.ChatGoogleGenerativeAI({ model:
|
|
27930
|
+
this.#model = new googleGenai.ChatGoogleGenerativeAI({ model: elSettings.model, apiKey: this.geminiApiKey, temperature: 0,});
|
|
27925
27931
|
break;
|
|
27926
27932
|
case "openai":
|
|
27927
|
-
this.#model = new openai.ChatOpenAI({ model:
|
|
27933
|
+
this.#model = new openai.ChatOpenAI({ model: elSettings.model, apiKey: this.openaiApiKey });
|
|
27928
27934
|
break;
|
|
27929
27935
|
case "ollama":
|
|
27930
|
-
this.#model = new ollama.Ollama({ model:
|
|
27936
|
+
this.#model = new ollama.Ollama({ model: elSettings.model });
|
|
27931
27937
|
break;
|
|
27932
27938
|
}
|
|
27933
27939
|
};
|
|
@@ -27982,8 +27988,8 @@ class aiContainer extends HTMLElement
|
|
|
27982
27988
|
|
|
27983
27989
|
//try {
|
|
27984
27990
|
const response = await this.#model.invoke([
|
|
27985
|
-
new SystemMessage(systemMessage),
|
|
27986
|
-
new HumanMessage(prompt),
|
|
27991
|
+
new messages.SystemMessage(systemMessage),
|
|
27992
|
+
new messages.HumanMessage(prompt),
|
|
27987
27993
|
]);
|
|
27988
27994
|
|
|
27989
27995
|
let filterString = response.content.trim();
|
|
@@ -28077,7 +28083,7 @@ this.#generateQdrantFilter();
|
|
|
28077
28083
|
this.#q3();
|
|
28078
28084
|
}
|
|
28079
28085
|
} catch (error) {
|
|
28080
|
-
console.error("Error generating Qdrant filter
|
|
28086
|
+
console.error("Error generating Qdrant filter:", error);
|
|
28081
28087
|
return null;
|
|
28082
28088
|
}
|
|
28083
28089
|
|
package/dist/bundle.esm.js
CHANGED
|
@@ -2,6 +2,7 @@ import ExcelJS$1 from 'exceljs';
|
|
|
2
2
|
import { ChatGoogleGenerativeAI } from '@langchain/google-genai';
|
|
3
3
|
import { Ollama } from '@langchain/ollama';
|
|
4
4
|
import { ChatOpenAI } from '@langchain/openai';
|
|
5
|
+
import { SystemMessage, HumanMessage } from '@langchain/core/messages';
|
|
5
6
|
|
|
6
7
|
function getDefaultExportFromCjs (x) {
|
|
7
8
|
return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
|
|
@@ -27862,6 +27863,9 @@ class aiContainer extends HTMLElement
|
|
|
27862
27863
|
#model;
|
|
27863
27864
|
//#elChat;
|
|
27864
27865
|
|
|
27866
|
+
#geminiApiKey = "";
|
|
27867
|
+
#openaiApiKey = "";
|
|
27868
|
+
|
|
27865
27869
|
constructor() {
|
|
27866
27870
|
super();
|
|
27867
27871
|
this.attachShadow({ mode: 'open' });
|
|
@@ -27906,26 +27910,28 @@ class aiContainer extends HTMLElement
|
|
|
27906
27910
|
});
|
|
27907
27911
|
};
|
|
27908
27912
|
|
|
27909
|
-
get target() {
|
|
27910
|
-
|
|
27911
|
-
|
|
27912
|
-
|
|
27913
|
-
|
|
27914
|
-
|
|
27913
|
+
get target() { return this.#target; };
|
|
27914
|
+
set target(v) { this.#target = v; };
|
|
27915
|
+
|
|
27916
|
+
get geminiApiKey() { return this.#geminiApiKey; };
|
|
27917
|
+
set geminiApiKey(v) { this.#geminiApiKey = v; };
|
|
27918
|
+
|
|
27919
|
+
get openaiApiKey() { return this.#openaiApiKey; };
|
|
27920
|
+
set openaiApiKey(v) { this.#openaiApiKey = v; };
|
|
27915
27921
|
|
|
27916
27922
|
#createModel = () => {
|
|
27917
|
-
const
|
|
27918
|
-
if (!
|
|
27923
|
+
const elSettings = this.shadowRoot.querySelector("nx-ai-settings");
|
|
27924
|
+
if (!elSettings) return;
|
|
27919
27925
|
|
|
27920
|
-
switch (
|
|
27926
|
+
switch (elSettings.server) {
|
|
27921
27927
|
case "gemini":
|
|
27922
|
-
this.#model = new ChatGoogleGenerativeAI({ model:
|
|
27928
|
+
this.#model = new ChatGoogleGenerativeAI({ model: elSettings.model, apiKey: this.geminiApiKey, temperature: 0,});
|
|
27923
27929
|
break;
|
|
27924
27930
|
case "openai":
|
|
27925
|
-
this.#model = new ChatOpenAI({ model:
|
|
27931
|
+
this.#model = new ChatOpenAI({ model: elSettings.model, apiKey: this.openaiApiKey });
|
|
27926
27932
|
break;
|
|
27927
27933
|
case "ollama":
|
|
27928
|
-
this.#model = new Ollama({ model:
|
|
27934
|
+
this.#model = new Ollama({ model: elSettings.model });
|
|
27929
27935
|
break;
|
|
27930
27936
|
}
|
|
27931
27937
|
};
|
|
@@ -28075,7 +28081,7 @@ this.#generateQdrantFilter();
|
|
|
28075
28081
|
this.#q3();
|
|
28076
28082
|
}
|
|
28077
28083
|
} catch (error) {
|
|
28078
|
-
console.error("Error generating Qdrant filter
|
|
28084
|
+
console.error("Error generating Qdrant filter:", error);
|
|
28079
28085
|
return null;
|
|
28080
28086
|
}
|
|
28081
28087
|
|
package/package.json
CHANGED
package/src/ai/aiContainer.js
CHANGED
|
@@ -2,6 +2,7 @@ import ninegrid from "../index.js";
|
|
|
2
2
|
import { ChatGoogleGenerativeAI } from "@langchain/google-genai";
|
|
3
3
|
import { Ollama } from "@langchain/ollama";
|
|
4
4
|
import { ChatOpenAI } from '@langchain/openai';
|
|
5
|
+
import { HumanMessage, SystemMessage } from '@langchain/core/messages';
|
|
5
6
|
|
|
6
7
|
class aiContainer extends HTMLElement
|
|
7
8
|
{
|
|
@@ -10,6 +11,9 @@ class aiContainer extends HTMLElement
|
|
|
10
11
|
#model;
|
|
11
12
|
//#elChat;
|
|
12
13
|
|
|
14
|
+
#geminiApiKey = "";
|
|
15
|
+
#openaiApiKey = "";
|
|
16
|
+
|
|
13
17
|
constructor() {
|
|
14
18
|
super();
|
|
15
19
|
this.attachShadow({ mode: 'open' });
|
|
@@ -54,26 +58,28 @@ class aiContainer extends HTMLElement
|
|
|
54
58
|
});
|
|
55
59
|
};
|
|
56
60
|
|
|
57
|
-
get target() {
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
61
|
+
get target() { return this.#target; };
|
|
62
|
+
set target(v) { this.#target = v; };
|
|
63
|
+
|
|
64
|
+
get geminiApiKey() { return this.#geminiApiKey; };
|
|
65
|
+
set geminiApiKey(v) { this.#geminiApiKey = v; };
|
|
66
|
+
|
|
67
|
+
get openaiApiKey() { return this.#openaiApiKey; };
|
|
68
|
+
set openaiApiKey(v) { this.#openaiApiKey = v; };
|
|
63
69
|
|
|
64
70
|
#createModel = () => {
|
|
65
|
-
const
|
|
66
|
-
if (!
|
|
71
|
+
const elSettings = this.shadowRoot.querySelector("nx-ai-settings");
|
|
72
|
+
if (!elSettings) return;
|
|
67
73
|
|
|
68
|
-
switch (
|
|
74
|
+
switch (elSettings.server) {
|
|
69
75
|
case "gemini":
|
|
70
|
-
this.#model = new ChatGoogleGenerativeAI({ model:
|
|
76
|
+
this.#model = new ChatGoogleGenerativeAI({ model: elSettings.model, apiKey: this.geminiApiKey, temperature: 0,});
|
|
71
77
|
break;
|
|
72
78
|
case "openai":
|
|
73
|
-
this.#model = new ChatOpenAI({ model:
|
|
79
|
+
this.#model = new ChatOpenAI({ model: elSettings.model, apiKey: this.openaiApiKey });
|
|
74
80
|
break;
|
|
75
81
|
case "ollama":
|
|
76
|
-
this.#model = new Ollama({ model:
|
|
82
|
+
this.#model = new Ollama({ model: elSettings.model });
|
|
77
83
|
break;
|
|
78
84
|
}
|
|
79
85
|
};
|
|
@@ -224,7 +230,7 @@ this.#generateQdrantFilter();
|
|
|
224
230
|
this.#q3();
|
|
225
231
|
}
|
|
226
232
|
} catch (error) {
|
|
227
|
-
console.error("Error generating Qdrant filter
|
|
233
|
+
console.error("Error generating Qdrant filter:", error);
|
|
228
234
|
return null;
|
|
229
235
|
}
|
|
230
236
|
|