ninegrid2 6.565.0 → 6.567.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 +11 -27
- package/dist/ai/aiSettings.js +16 -0
- package/dist/bundle.cjs.js +27 -27
- package/dist/bundle.esm.js +27 -27
- package/package.json +1 -1
- package/src/ai/aiContainer.js +11 -27
- package/src/ai/aiSettings.js +16 -0
package/dist/ai/aiContainer.js
CHANGED
|
@@ -16,8 +16,7 @@ class aiContainer extends HTMLElement
|
|
|
16
16
|
#qdrantClient;
|
|
17
17
|
//#elChat;
|
|
18
18
|
|
|
19
|
-
|
|
20
|
-
#openaiApiKey = "";
|
|
19
|
+
settings; /** nx-ai-settings element */
|
|
21
20
|
|
|
22
21
|
constructor() {
|
|
23
22
|
super();
|
|
@@ -65,38 +64,24 @@ class aiContainer extends HTMLElement
|
|
|
65
64
|
get target() { return this.#target; };
|
|
66
65
|
set target(v) { this.#target = v; };
|
|
67
66
|
|
|
68
|
-
get geminiApiKey() { return this.#geminiApiKey; };
|
|
69
|
-
set geminiApiKey(v) { this.#geminiApiKey = v; };
|
|
70
|
-
|
|
71
|
-
get openaiApiKey() { return this.#openaiApiKey; };
|
|
72
|
-
set openaiApiKey(v) { this.#openaiApiKey = v; };
|
|
73
|
-
|
|
74
|
-
get ollamaUrl() { return this.shadowRoot.querySelector("nx-ai-settings").shadowRoot.querySelector("#ollamaUrl").value; };
|
|
75
|
-
set ollamaUrl(v) { this.shadowRoot.querySelector("nx-ai-settings").shadowRoot.querySelector("#ollamaUrl").value = v; };
|
|
76
|
-
|
|
77
|
-
get qdrantUrl() { return this.shadowRoot.querySelector("nx-ai-settings").shadowRoot.querySelector("#qdrantUrl").value; };
|
|
78
|
-
set qdrantUrl(v) { this.shadowRoot.querySelector("nx-ai-settings").shadowRoot.querySelector("#qdrantUrl").value = v; };
|
|
79
|
-
|
|
80
67
|
#createModel = () => {
|
|
81
|
-
const elSettings = this.shadowRoot.querySelector("nx-ai-settings");
|
|
82
|
-
if (!elSettings) return;
|
|
83
68
|
|
|
84
|
-
switch (
|
|
69
|
+
switch (this.settings.server) {
|
|
85
70
|
case "gemini":
|
|
86
|
-
this.#model = new ChatGoogleGenerativeAI({ model:
|
|
71
|
+
this.#model = new ChatGoogleGenerativeAI({ model: this.settings.model, apiKey: this.settings.geminiApiKey, temperature: 0,});
|
|
87
72
|
break;
|
|
88
73
|
case "openai":
|
|
89
|
-
this.#model = new ChatOpenAI({ model:
|
|
74
|
+
this.#model = new ChatOpenAI({ model: this.settings.model, apiKey: this.settings.openaiApiKey, temperature: 0, });
|
|
90
75
|
break;
|
|
91
76
|
case "ollama":
|
|
92
77
|
this.#model = new Ollama({
|
|
93
|
-
model:
|
|
94
|
-
host:
|
|
78
|
+
model: this.settings.model,
|
|
79
|
+
host: this.settings.ollamaUrl,
|
|
95
80
|
});
|
|
96
81
|
break;
|
|
97
82
|
}
|
|
98
83
|
|
|
99
|
-
this.#qdrantClient = new QdrantClient({ url:
|
|
84
|
+
this.#qdrantClient = new QdrantClient({ url: this.settings.qdrantUrl });
|
|
100
85
|
};
|
|
101
86
|
|
|
102
87
|
#getColumnInfo = () => {
|
|
@@ -178,13 +163,10 @@ class aiContainer extends HTMLElement
|
|
|
178
163
|
new HumanMessage(prompt),
|
|
179
164
|
]);
|
|
180
165
|
|
|
181
|
-
const elSettings = this.shadowRoot.querySelector("nx-ai-settings");
|
|
182
|
-
if (!elSettings) throw new Error("nx-ai-settings missing !!!");
|
|
183
|
-
|
|
184
166
|
console.log(response);
|
|
185
167
|
|
|
186
168
|
let filterString;
|
|
187
|
-
switch (
|
|
169
|
+
switch (this.settings.server) {
|
|
188
170
|
case "openai":
|
|
189
171
|
filterString = this.#extractJsonSnippet(response.content.trim());
|
|
190
172
|
break;
|
|
@@ -331,6 +313,8 @@ class aiContainer extends HTMLElement
|
|
|
331
313
|
|
|
332
314
|
#init = (info) => {
|
|
333
315
|
|
|
316
|
+
this.settings = this.shadowRoot.querySelector("nx-ai-settings");
|
|
317
|
+
|
|
334
318
|
//this.#elChat = this.shadowRoot.querySelector("nx-ai-chat");
|
|
335
319
|
|
|
336
320
|
this.shadowRoot.querySelector("textarea").addEventListener("keydown", this.#keydownHandler);
|
|
@@ -403,7 +387,7 @@ class aiContainer extends HTMLElement
|
|
|
403
387
|
if (clickedIcon) clickedIcon.classList.add("active");
|
|
404
388
|
|
|
405
389
|
// `.menu-setting`이 클릭되었는지 확인 후 `nx-ai-settings` 토글
|
|
406
|
-
this.
|
|
390
|
+
this.settings.classList.toggle("expand", !!e.target.closest(".menu-setting"));
|
|
407
391
|
};
|
|
408
392
|
}
|
|
409
393
|
|
package/dist/ai/aiSettings.js
CHANGED
|
@@ -9,12 +9,28 @@ class aiSettings extends HTMLElement
|
|
|
9
9
|
this.attachShadow({ mode: 'open' });
|
|
10
10
|
}
|
|
11
11
|
|
|
12
|
+
get geminiApiKey() { return this.shadowRoot.querySelector("#geminiApiKey").value; };
|
|
13
|
+
set geminiApiKey(v) { this.shadowRoot.querySelector("#geminiApiKey").value = v; };
|
|
14
|
+
|
|
15
|
+
get openaiApiKey() { this.shadowRoot.querySelector("#openaiApiKey").value };
|
|
16
|
+
set openaiApiKey(v) { this.shadowRoot.querySelector("#openaiApiKey").value = v; };
|
|
17
|
+
|
|
18
|
+
get ollamaUrl() { return this.shadowRoot.querySelector("#ollamaUrl").value; };
|
|
19
|
+
set ollamaUrl(v) { this.shadowRoot.querySelector("#ollamaUrl").value = v; };
|
|
20
|
+
|
|
21
|
+
get qdrantUrl() { return this.shadowRoot.querySelector("#qdrantUrl").value; };
|
|
22
|
+
set qdrantUrl(v) { this.shadowRoot.querySelector("#qdrantUrl").value = v; };
|
|
23
|
+
|
|
12
24
|
get server() {
|
|
13
25
|
return this.shadowRoot.querySelector('input[name="server"]:checked')?.value;
|
|
14
26
|
};
|
|
15
27
|
set server(v) {
|
|
16
28
|
const elem = this.shadowRoot.querySelector(`input[name="server"][value="${v}"]`);
|
|
17
29
|
if (elem) elem.checked = true;
|
|
30
|
+
|
|
31
|
+
this.shadowRoot.querySelectorAll('input[name="server"]').forEach(el => {
|
|
32
|
+
el.dispatchEvent(new Event("change"));
|
|
33
|
+
});
|
|
18
34
|
};
|
|
19
35
|
|
|
20
36
|
get model() {
|
package/dist/bundle.cjs.js
CHANGED
|
@@ -27525,12 +27525,28 @@ class aiSettings extends HTMLElement
|
|
|
27525
27525
|
this.attachShadow({ mode: 'open' });
|
|
27526
27526
|
}
|
|
27527
27527
|
|
|
27528
|
+
get geminiApiKey() { return this.shadowRoot.querySelector("#geminiApiKey").value; };
|
|
27529
|
+
set geminiApiKey(v) { this.shadowRoot.querySelector("#geminiApiKey").value = v; };
|
|
27530
|
+
|
|
27531
|
+
get openaiApiKey() { this.shadowRoot.querySelector("#openaiApiKey").value; };
|
|
27532
|
+
set openaiApiKey(v) { this.shadowRoot.querySelector("#openaiApiKey").value = v; };
|
|
27533
|
+
|
|
27534
|
+
get ollamaUrl() { return this.shadowRoot.querySelector("#ollamaUrl").value; };
|
|
27535
|
+
set ollamaUrl(v) { this.shadowRoot.querySelector("#ollamaUrl").value = v; };
|
|
27536
|
+
|
|
27537
|
+
get qdrantUrl() { return this.shadowRoot.querySelector("#qdrantUrl").value; };
|
|
27538
|
+
set qdrantUrl(v) { this.shadowRoot.querySelector("#qdrantUrl").value = v; };
|
|
27539
|
+
|
|
27528
27540
|
get server() {
|
|
27529
27541
|
return this.shadowRoot.querySelector('input[name="server"]:checked')?.value;
|
|
27530
27542
|
};
|
|
27531
27543
|
set server(v) {
|
|
27532
27544
|
const elem = this.shadowRoot.querySelector(`input[name="server"][value="${v}"]`);
|
|
27533
27545
|
if (elem) elem.checked = true;
|
|
27546
|
+
|
|
27547
|
+
this.shadowRoot.querySelectorAll('input[name="server"]').forEach(el => {
|
|
27548
|
+
el.dispatchEvent(new Event("change"));
|
|
27549
|
+
});
|
|
27534
27550
|
};
|
|
27535
27551
|
|
|
27536
27552
|
get model() {
|
|
@@ -54174,8 +54190,7 @@ class aiContainer extends HTMLElement
|
|
|
54174
54190
|
#qdrantClient;
|
|
54175
54191
|
//#elChat;
|
|
54176
54192
|
|
|
54177
|
-
|
|
54178
|
-
#openaiApiKey = "";
|
|
54193
|
+
settings; /** nx-ai-settings element */
|
|
54179
54194
|
|
|
54180
54195
|
constructor() {
|
|
54181
54196
|
super();
|
|
@@ -54223,38 +54238,24 @@ class aiContainer extends HTMLElement
|
|
|
54223
54238
|
get target() { return this.#target; };
|
|
54224
54239
|
set target(v) { this.#target = v; };
|
|
54225
54240
|
|
|
54226
|
-
get geminiApiKey() { return this.#geminiApiKey; };
|
|
54227
|
-
set geminiApiKey(v) { this.#geminiApiKey = v; };
|
|
54228
|
-
|
|
54229
|
-
get openaiApiKey() { return this.#openaiApiKey; };
|
|
54230
|
-
set openaiApiKey(v) { this.#openaiApiKey = v; };
|
|
54231
|
-
|
|
54232
|
-
get ollamaUrl() { return this.shadowRoot.querySelector("nx-ai-settings").shadowRoot.querySelector("#ollamaUrl").value; };
|
|
54233
|
-
set ollamaUrl(v) { this.shadowRoot.querySelector("nx-ai-settings").shadowRoot.querySelector("#ollamaUrl").value = v; };
|
|
54234
|
-
|
|
54235
|
-
get qdrantUrl() { return this.shadowRoot.querySelector("nx-ai-settings").shadowRoot.querySelector("#qdrantUrl").value; };
|
|
54236
|
-
set qdrantUrl(v) { this.shadowRoot.querySelector("nx-ai-settings").shadowRoot.querySelector("#qdrantUrl").value = v; };
|
|
54237
|
-
|
|
54238
54241
|
#createModel = () => {
|
|
54239
|
-
const elSettings = this.shadowRoot.querySelector("nx-ai-settings");
|
|
54240
|
-
if (!elSettings) return;
|
|
54241
54242
|
|
|
54242
|
-
switch (
|
|
54243
|
+
switch (this.settings.server) {
|
|
54243
54244
|
case "gemini":
|
|
54244
|
-
this.#model = new googleGenai.ChatGoogleGenerativeAI({ model:
|
|
54245
|
+
this.#model = new googleGenai.ChatGoogleGenerativeAI({ model: this.settings.model, apiKey: this.settings.geminiApiKey, temperature: 0,});
|
|
54245
54246
|
break;
|
|
54246
54247
|
case "openai":
|
|
54247
|
-
this.#model = new openai.ChatOpenAI({ model:
|
|
54248
|
+
this.#model = new openai.ChatOpenAI({ model: this.settings.model, apiKey: this.settings.openaiApiKey, temperature: 0, });
|
|
54248
54249
|
break;
|
|
54249
54250
|
case "ollama":
|
|
54250
54251
|
this.#model = new ollama.Ollama({
|
|
54251
|
-
model:
|
|
54252
|
-
host:
|
|
54252
|
+
model: this.settings.model,
|
|
54253
|
+
host: this.settings.ollamaUrl,
|
|
54253
54254
|
});
|
|
54254
54255
|
break;
|
|
54255
54256
|
}
|
|
54256
54257
|
|
|
54257
|
-
this.#qdrantClient = new QdrantClient({ url:
|
|
54258
|
+
this.#qdrantClient = new QdrantClient({ url: this.settings.qdrantUrl });
|
|
54258
54259
|
};
|
|
54259
54260
|
|
|
54260
54261
|
#getColumnInfo = () => {
|
|
@@ -54336,13 +54337,10 @@ class aiContainer extends HTMLElement
|
|
|
54336
54337
|
new messages.HumanMessage(prompt),
|
|
54337
54338
|
]);
|
|
54338
54339
|
|
|
54339
|
-
const elSettings = this.shadowRoot.querySelector("nx-ai-settings");
|
|
54340
|
-
if (!elSettings) throw new Error("nx-ai-settings missing !!!");
|
|
54341
|
-
|
|
54342
54340
|
console.log(response);
|
|
54343
54341
|
|
|
54344
54342
|
let filterString;
|
|
54345
|
-
switch (
|
|
54343
|
+
switch (this.settings.server) {
|
|
54346
54344
|
case "openai":
|
|
54347
54345
|
filterString = this.#extractJsonSnippet(response.content.trim());
|
|
54348
54346
|
break;
|
|
@@ -54463,6 +54461,8 @@ class aiContainer extends HTMLElement
|
|
|
54463
54461
|
|
|
54464
54462
|
#init = (info) => {
|
|
54465
54463
|
|
|
54464
|
+
this.settings = this.shadowRoot.querySelector("nx-ai-settings");
|
|
54465
|
+
|
|
54466
54466
|
//this.#elChat = this.shadowRoot.querySelector("nx-ai-chat");
|
|
54467
54467
|
|
|
54468
54468
|
this.shadowRoot.querySelector("textarea").addEventListener("keydown", this.#keydownHandler);
|
|
@@ -54534,7 +54534,7 @@ class aiContainer extends HTMLElement
|
|
|
54534
54534
|
if (clickedIcon) clickedIcon.classList.add("active");
|
|
54535
54535
|
|
|
54536
54536
|
// `.menu-setting`이 클릭되었는지 확인 후 `nx-ai-settings` 토글
|
|
54537
|
-
this.
|
|
54537
|
+
this.settings.classList.toggle("expand", !!e.target.closest(".menu-setting"));
|
|
54538
54538
|
};
|
|
54539
54539
|
}
|
|
54540
54540
|
|
package/dist/bundle.esm.js
CHANGED
|
@@ -27523,12 +27523,28 @@ class aiSettings extends HTMLElement
|
|
|
27523
27523
|
this.attachShadow({ mode: 'open' });
|
|
27524
27524
|
}
|
|
27525
27525
|
|
|
27526
|
+
get geminiApiKey() { return this.shadowRoot.querySelector("#geminiApiKey").value; };
|
|
27527
|
+
set geminiApiKey(v) { this.shadowRoot.querySelector("#geminiApiKey").value = v; };
|
|
27528
|
+
|
|
27529
|
+
get openaiApiKey() { this.shadowRoot.querySelector("#openaiApiKey").value; };
|
|
27530
|
+
set openaiApiKey(v) { this.shadowRoot.querySelector("#openaiApiKey").value = v; };
|
|
27531
|
+
|
|
27532
|
+
get ollamaUrl() { return this.shadowRoot.querySelector("#ollamaUrl").value; };
|
|
27533
|
+
set ollamaUrl(v) { this.shadowRoot.querySelector("#ollamaUrl").value = v; };
|
|
27534
|
+
|
|
27535
|
+
get qdrantUrl() { return this.shadowRoot.querySelector("#qdrantUrl").value; };
|
|
27536
|
+
set qdrantUrl(v) { this.shadowRoot.querySelector("#qdrantUrl").value = v; };
|
|
27537
|
+
|
|
27526
27538
|
get server() {
|
|
27527
27539
|
return this.shadowRoot.querySelector('input[name="server"]:checked')?.value;
|
|
27528
27540
|
};
|
|
27529
27541
|
set server(v) {
|
|
27530
27542
|
const elem = this.shadowRoot.querySelector(`input[name="server"][value="${v}"]`);
|
|
27531
27543
|
if (elem) elem.checked = true;
|
|
27544
|
+
|
|
27545
|
+
this.shadowRoot.querySelectorAll('input[name="server"]').forEach(el => {
|
|
27546
|
+
el.dispatchEvent(new Event("change"));
|
|
27547
|
+
});
|
|
27532
27548
|
};
|
|
27533
27549
|
|
|
27534
27550
|
get model() {
|
|
@@ -54172,8 +54188,7 @@ class aiContainer extends HTMLElement
|
|
|
54172
54188
|
#qdrantClient;
|
|
54173
54189
|
//#elChat;
|
|
54174
54190
|
|
|
54175
|
-
|
|
54176
|
-
#openaiApiKey = "";
|
|
54191
|
+
settings; /** nx-ai-settings element */
|
|
54177
54192
|
|
|
54178
54193
|
constructor() {
|
|
54179
54194
|
super();
|
|
@@ -54221,38 +54236,24 @@ class aiContainer extends HTMLElement
|
|
|
54221
54236
|
get target() { return this.#target; };
|
|
54222
54237
|
set target(v) { this.#target = v; };
|
|
54223
54238
|
|
|
54224
|
-
get geminiApiKey() { return this.#geminiApiKey; };
|
|
54225
|
-
set geminiApiKey(v) { this.#geminiApiKey = v; };
|
|
54226
|
-
|
|
54227
|
-
get openaiApiKey() { return this.#openaiApiKey; };
|
|
54228
|
-
set openaiApiKey(v) { this.#openaiApiKey = v; };
|
|
54229
|
-
|
|
54230
|
-
get ollamaUrl() { return this.shadowRoot.querySelector("nx-ai-settings").shadowRoot.querySelector("#ollamaUrl").value; };
|
|
54231
|
-
set ollamaUrl(v) { this.shadowRoot.querySelector("nx-ai-settings").shadowRoot.querySelector("#ollamaUrl").value = v; };
|
|
54232
|
-
|
|
54233
|
-
get qdrantUrl() { return this.shadowRoot.querySelector("nx-ai-settings").shadowRoot.querySelector("#qdrantUrl").value; };
|
|
54234
|
-
set qdrantUrl(v) { this.shadowRoot.querySelector("nx-ai-settings").shadowRoot.querySelector("#qdrantUrl").value = v; };
|
|
54235
|
-
|
|
54236
54239
|
#createModel = () => {
|
|
54237
|
-
const elSettings = this.shadowRoot.querySelector("nx-ai-settings");
|
|
54238
|
-
if (!elSettings) return;
|
|
54239
54240
|
|
|
54240
|
-
switch (
|
|
54241
|
+
switch (this.settings.server) {
|
|
54241
54242
|
case "gemini":
|
|
54242
|
-
this.#model = new ChatGoogleGenerativeAI({ model:
|
|
54243
|
+
this.#model = new ChatGoogleGenerativeAI({ model: this.settings.model, apiKey: this.settings.geminiApiKey, temperature: 0,});
|
|
54243
54244
|
break;
|
|
54244
54245
|
case "openai":
|
|
54245
|
-
this.#model = new ChatOpenAI({ model:
|
|
54246
|
+
this.#model = new ChatOpenAI({ model: this.settings.model, apiKey: this.settings.openaiApiKey, temperature: 0, });
|
|
54246
54247
|
break;
|
|
54247
54248
|
case "ollama":
|
|
54248
54249
|
this.#model = new Ollama({
|
|
54249
|
-
model:
|
|
54250
|
-
host:
|
|
54250
|
+
model: this.settings.model,
|
|
54251
|
+
host: this.settings.ollamaUrl,
|
|
54251
54252
|
});
|
|
54252
54253
|
break;
|
|
54253
54254
|
}
|
|
54254
54255
|
|
|
54255
|
-
this.#qdrantClient = new QdrantClient({ url:
|
|
54256
|
+
this.#qdrantClient = new QdrantClient({ url: this.settings.qdrantUrl });
|
|
54256
54257
|
};
|
|
54257
54258
|
|
|
54258
54259
|
#getColumnInfo = () => {
|
|
@@ -54334,13 +54335,10 @@ class aiContainer extends HTMLElement
|
|
|
54334
54335
|
new HumanMessage(prompt),
|
|
54335
54336
|
]);
|
|
54336
54337
|
|
|
54337
|
-
const elSettings = this.shadowRoot.querySelector("nx-ai-settings");
|
|
54338
|
-
if (!elSettings) throw new Error("nx-ai-settings missing !!!");
|
|
54339
|
-
|
|
54340
54338
|
console.log(response);
|
|
54341
54339
|
|
|
54342
54340
|
let filterString;
|
|
54343
|
-
switch (
|
|
54341
|
+
switch (this.settings.server) {
|
|
54344
54342
|
case "openai":
|
|
54345
54343
|
filterString = this.#extractJsonSnippet(response.content.trim());
|
|
54346
54344
|
break;
|
|
@@ -54461,6 +54459,8 @@ class aiContainer extends HTMLElement
|
|
|
54461
54459
|
|
|
54462
54460
|
#init = (info) => {
|
|
54463
54461
|
|
|
54462
|
+
this.settings = this.shadowRoot.querySelector("nx-ai-settings");
|
|
54463
|
+
|
|
54464
54464
|
//this.#elChat = this.shadowRoot.querySelector("nx-ai-chat");
|
|
54465
54465
|
|
|
54466
54466
|
this.shadowRoot.querySelector("textarea").addEventListener("keydown", this.#keydownHandler);
|
|
@@ -54532,7 +54532,7 @@ class aiContainer extends HTMLElement
|
|
|
54532
54532
|
if (clickedIcon) clickedIcon.classList.add("active");
|
|
54533
54533
|
|
|
54534
54534
|
// `.menu-setting`이 클릭되었는지 확인 후 `nx-ai-settings` 토글
|
|
54535
|
-
this.
|
|
54535
|
+
this.settings.classList.toggle("expand", !!e.target.closest(".menu-setting"));
|
|
54536
54536
|
};
|
|
54537
54537
|
}
|
|
54538
54538
|
|
package/package.json
CHANGED
package/src/ai/aiContainer.js
CHANGED
|
@@ -16,8 +16,7 @@ class aiContainer extends HTMLElement
|
|
|
16
16
|
#qdrantClient;
|
|
17
17
|
//#elChat;
|
|
18
18
|
|
|
19
|
-
|
|
20
|
-
#openaiApiKey = "";
|
|
19
|
+
settings; /** nx-ai-settings element */
|
|
21
20
|
|
|
22
21
|
constructor() {
|
|
23
22
|
super();
|
|
@@ -65,38 +64,24 @@ class aiContainer extends HTMLElement
|
|
|
65
64
|
get target() { return this.#target; };
|
|
66
65
|
set target(v) { this.#target = v; };
|
|
67
66
|
|
|
68
|
-
get geminiApiKey() { return this.#geminiApiKey; };
|
|
69
|
-
set geminiApiKey(v) { this.#geminiApiKey = v; };
|
|
70
|
-
|
|
71
|
-
get openaiApiKey() { return this.#openaiApiKey; };
|
|
72
|
-
set openaiApiKey(v) { this.#openaiApiKey = v; };
|
|
73
|
-
|
|
74
|
-
get ollamaUrl() { return this.shadowRoot.querySelector("nx-ai-settings").shadowRoot.querySelector("#ollamaUrl").value; };
|
|
75
|
-
set ollamaUrl(v) { this.shadowRoot.querySelector("nx-ai-settings").shadowRoot.querySelector("#ollamaUrl").value = v; };
|
|
76
|
-
|
|
77
|
-
get qdrantUrl() { return this.shadowRoot.querySelector("nx-ai-settings").shadowRoot.querySelector("#qdrantUrl").value; };
|
|
78
|
-
set qdrantUrl(v) { this.shadowRoot.querySelector("nx-ai-settings").shadowRoot.querySelector("#qdrantUrl").value = v; };
|
|
79
|
-
|
|
80
67
|
#createModel = () => {
|
|
81
|
-
const elSettings = this.shadowRoot.querySelector("nx-ai-settings");
|
|
82
|
-
if (!elSettings) return;
|
|
83
68
|
|
|
84
|
-
switch (
|
|
69
|
+
switch (this.settings.server) {
|
|
85
70
|
case "gemini":
|
|
86
|
-
this.#model = new ChatGoogleGenerativeAI({ model:
|
|
71
|
+
this.#model = new ChatGoogleGenerativeAI({ model: this.settings.model, apiKey: this.settings.geminiApiKey, temperature: 0,});
|
|
87
72
|
break;
|
|
88
73
|
case "openai":
|
|
89
|
-
this.#model = new ChatOpenAI({ model:
|
|
74
|
+
this.#model = new ChatOpenAI({ model: this.settings.model, apiKey: this.settings.openaiApiKey, temperature: 0, });
|
|
90
75
|
break;
|
|
91
76
|
case "ollama":
|
|
92
77
|
this.#model = new Ollama({
|
|
93
|
-
model:
|
|
94
|
-
host:
|
|
78
|
+
model: this.settings.model,
|
|
79
|
+
host: this.settings.ollamaUrl,
|
|
95
80
|
});
|
|
96
81
|
break;
|
|
97
82
|
}
|
|
98
83
|
|
|
99
|
-
this.#qdrantClient = new QdrantClient({ url:
|
|
84
|
+
this.#qdrantClient = new QdrantClient({ url: this.settings.qdrantUrl });
|
|
100
85
|
};
|
|
101
86
|
|
|
102
87
|
#getColumnInfo = () => {
|
|
@@ -178,13 +163,10 @@ class aiContainer extends HTMLElement
|
|
|
178
163
|
new HumanMessage(prompt),
|
|
179
164
|
]);
|
|
180
165
|
|
|
181
|
-
const elSettings = this.shadowRoot.querySelector("nx-ai-settings");
|
|
182
|
-
if (!elSettings) throw new Error("nx-ai-settings missing !!!");
|
|
183
|
-
|
|
184
166
|
console.log(response);
|
|
185
167
|
|
|
186
168
|
let filterString;
|
|
187
|
-
switch (
|
|
169
|
+
switch (this.settings.server) {
|
|
188
170
|
case "openai":
|
|
189
171
|
filterString = this.#extractJsonSnippet(response.content.trim());
|
|
190
172
|
break;
|
|
@@ -331,6 +313,8 @@ class aiContainer extends HTMLElement
|
|
|
331
313
|
|
|
332
314
|
#init = (info) => {
|
|
333
315
|
|
|
316
|
+
this.settings = this.shadowRoot.querySelector("nx-ai-settings");
|
|
317
|
+
|
|
334
318
|
//this.#elChat = this.shadowRoot.querySelector("nx-ai-chat");
|
|
335
319
|
|
|
336
320
|
this.shadowRoot.querySelector("textarea").addEventListener("keydown", this.#keydownHandler);
|
|
@@ -403,7 +387,7 @@ class aiContainer extends HTMLElement
|
|
|
403
387
|
if (clickedIcon) clickedIcon.classList.add("active");
|
|
404
388
|
|
|
405
389
|
// `.menu-setting`이 클릭되었는지 확인 후 `nx-ai-settings` 토글
|
|
406
|
-
this.
|
|
390
|
+
this.settings.classList.toggle("expand", !!e.target.closest(".menu-setting"));
|
|
407
391
|
};
|
|
408
392
|
}
|
|
409
393
|
|
package/src/ai/aiSettings.js
CHANGED
|
@@ -9,12 +9,28 @@ class aiSettings extends HTMLElement
|
|
|
9
9
|
this.attachShadow({ mode: 'open' });
|
|
10
10
|
}
|
|
11
11
|
|
|
12
|
+
get geminiApiKey() { return this.shadowRoot.querySelector("#geminiApiKey").value; };
|
|
13
|
+
set geminiApiKey(v) { this.shadowRoot.querySelector("#geminiApiKey").value = v; };
|
|
14
|
+
|
|
15
|
+
get openaiApiKey() { this.shadowRoot.querySelector("#openaiApiKey").value };
|
|
16
|
+
set openaiApiKey(v) { this.shadowRoot.querySelector("#openaiApiKey").value = v; };
|
|
17
|
+
|
|
18
|
+
get ollamaUrl() { return this.shadowRoot.querySelector("#ollamaUrl").value; };
|
|
19
|
+
set ollamaUrl(v) { this.shadowRoot.querySelector("#ollamaUrl").value = v; };
|
|
20
|
+
|
|
21
|
+
get qdrantUrl() { return this.shadowRoot.querySelector("#qdrantUrl").value; };
|
|
22
|
+
set qdrantUrl(v) { this.shadowRoot.querySelector("#qdrantUrl").value = v; };
|
|
23
|
+
|
|
12
24
|
get server() {
|
|
13
25
|
return this.shadowRoot.querySelector('input[name="server"]:checked')?.value;
|
|
14
26
|
};
|
|
15
27
|
set server(v) {
|
|
16
28
|
const elem = this.shadowRoot.querySelector(`input[name="server"][value="${v}"]`);
|
|
17
29
|
if (elem) elem.checked = true;
|
|
30
|
+
|
|
31
|
+
this.shadowRoot.querySelectorAll('input[name="server"]').forEach(el => {
|
|
32
|
+
el.dispatchEvent(new Event("change"));
|
|
33
|
+
});
|
|
18
34
|
};
|
|
19
35
|
|
|
20
36
|
get model() {
|