ninegrid2 6.503.0 → 6.505.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 +44 -16
- package/dist/bundle.cjs.js +44 -16
- package/dist/bundle.esm.js +44 -16
- package/package.json +1 -1
- package/src/ai/aiContainer.js +44 -16
package/dist/ai/aiContainer.js
CHANGED
|
@@ -4,6 +4,7 @@ class aiContainer extends HTMLElement
|
|
|
4
4
|
{
|
|
5
5
|
#target;
|
|
6
6
|
#ing = false;
|
|
7
|
+
#model;
|
|
7
8
|
//#elChat;
|
|
8
9
|
|
|
9
10
|
constructor() {
|
|
@@ -57,10 +58,27 @@ class aiContainer extends HTMLElement
|
|
|
57
58
|
this.#target = v;
|
|
58
59
|
}
|
|
59
60
|
|
|
61
|
+
#createModel = () => {
|
|
62
|
+
const el = this.shadowRoot.querySelector("nx-ai-settings");
|
|
63
|
+
if (!el) return;
|
|
64
|
+
|
|
65
|
+
switch (el.server) {
|
|
66
|
+
case "gemini":
|
|
67
|
+
this.#model = new ChatGoogleGenerativeAI({ model: settingsRef.current.model, apiKey: googleApiKey, temperature: 0,});
|
|
68
|
+
break;
|
|
69
|
+
case "openai":
|
|
70
|
+
this.#model = new ChatOpenAI({ model: settingsRef.current.model, apiKey });
|
|
71
|
+
break;
|
|
72
|
+
case "ollama":
|
|
73
|
+
this.#model = new Ollama({ model: settingsRef.current.model });
|
|
74
|
+
break;
|
|
75
|
+
}
|
|
76
|
+
};
|
|
77
|
+
|
|
60
78
|
#getColumnInfo = () => {
|
|
61
79
|
let colInfo = "";
|
|
62
80
|
|
|
63
|
-
console.log(this.#target, this.#target.tagName);
|
|
81
|
+
//console.log(this.#target, this.#target.tagName);
|
|
64
82
|
|
|
65
83
|
if (this.#target.tagName === "NINE-GRID") {
|
|
66
84
|
this.#target.columns.info().forEach(info => {
|
|
@@ -73,6 +91,7 @@ class aiContainer extends HTMLElement
|
|
|
73
91
|
|
|
74
92
|
#generateQdrantFilter = async (userInput) => {
|
|
75
93
|
|
|
94
|
+
const systemMessage = "You are a helpful assistant.";
|
|
76
95
|
// Qdrant 필터로 변환하기 위한 프롬프트 엔지니어링
|
|
77
96
|
// 중요: 실제 컬렉션의 payload 필드와 그 데이터 타입을 정확히 알려줘야 Gemini가 올바른 필터를 생성합니다.
|
|
78
97
|
const prompt = `
|
|
@@ -104,9 +123,9 @@ class aiContainer extends HTMLElement
|
|
|
104
123
|
Qdrant 필터 JSON:
|
|
105
124
|
`;
|
|
106
125
|
|
|
107
|
-
try {
|
|
108
|
-
const response = await
|
|
109
|
-
new SystemMessage(
|
|
126
|
+
//try {
|
|
127
|
+
const response = await this.#model.invoke([
|
|
128
|
+
new SystemMessage(systemMessage),
|
|
110
129
|
new HumanMessage(prompt),
|
|
111
130
|
]);
|
|
112
131
|
|
|
@@ -133,10 +152,11 @@ filterString = "a" + filterString;
|
|
|
133
152
|
// return null; // 파싱 실패 시 null 반환 또는 적절한 에러 처리
|
|
134
153
|
//}
|
|
135
154
|
|
|
136
|
-
} catch (error) {
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
155
|
+
//} catch (error) {
|
|
156
|
+
|
|
157
|
+
// console.error("Error generating Qdrant filter with Gemini:", error);
|
|
158
|
+
// return null;
|
|
159
|
+
//}
|
|
140
160
|
}
|
|
141
161
|
|
|
142
162
|
#q1 = () => {
|
|
@@ -188,15 +208,23 @@ this.#generateQdrantFilter();
|
|
|
188
208
|
this.shadowRoot.querySelector("nx-ai-chat").add("me", question);
|
|
189
209
|
this.shadowRoot.querySelector("nx-ai-chat").add("ing", question);
|
|
190
210
|
|
|
191
|
-
|
|
192
|
-
this.#
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
211
|
+
try {
|
|
212
|
+
this.#createModel();
|
|
213
|
+
|
|
214
|
+
if (this.shadowRoot.querySelector(".menu-filter").classList.contains("active")) {
|
|
215
|
+
this.#q1();
|
|
216
|
+
}
|
|
217
|
+
else if (this.shadowRoot.querySelector(".menu-general").classList.contains("active")) {
|
|
218
|
+
this.#q2();
|
|
219
|
+
}
|
|
220
|
+
else {
|
|
221
|
+
this.#q3();
|
|
222
|
+
}
|
|
223
|
+
} catch (error) {
|
|
224
|
+
console.error("Error generating Qdrant filter with Gemini:", error);
|
|
225
|
+
return null;
|
|
199
226
|
}
|
|
227
|
+
|
|
200
228
|
|
|
201
229
|
this.#ing = false;
|
|
202
230
|
}
|
package/dist/bundle.cjs.js
CHANGED
|
@@ -27858,6 +27858,7 @@ class aiContainer extends HTMLElement
|
|
|
27858
27858
|
{
|
|
27859
27859
|
#target;
|
|
27860
27860
|
#ing = false;
|
|
27861
|
+
#model;
|
|
27861
27862
|
//#elChat;
|
|
27862
27863
|
|
|
27863
27864
|
constructor() {
|
|
@@ -27911,10 +27912,27 @@ class aiContainer extends HTMLElement
|
|
|
27911
27912
|
this.#target = v;
|
|
27912
27913
|
}
|
|
27913
27914
|
|
|
27915
|
+
#createModel = () => {
|
|
27916
|
+
const el = this.shadowRoot.querySelector("nx-ai-settings");
|
|
27917
|
+
if (!el) return;
|
|
27918
|
+
|
|
27919
|
+
switch (el.server) {
|
|
27920
|
+
case "gemini":
|
|
27921
|
+
this.#model = new ChatGoogleGenerativeAI({ model: settingsRef.current.model, apiKey: googleApiKey, temperature: 0,});
|
|
27922
|
+
break;
|
|
27923
|
+
case "openai":
|
|
27924
|
+
this.#model = new ChatOpenAI({ model: settingsRef.current.model, apiKey });
|
|
27925
|
+
break;
|
|
27926
|
+
case "ollama":
|
|
27927
|
+
this.#model = new Ollama({ model: settingsRef.current.model });
|
|
27928
|
+
break;
|
|
27929
|
+
}
|
|
27930
|
+
};
|
|
27931
|
+
|
|
27914
27932
|
#getColumnInfo = () => {
|
|
27915
27933
|
let colInfo = "";
|
|
27916
27934
|
|
|
27917
|
-
console.log(this.#target, this.#target.tagName);
|
|
27935
|
+
//console.log(this.#target, this.#target.tagName);
|
|
27918
27936
|
|
|
27919
27937
|
if (this.#target.tagName === "NINE-GRID") {
|
|
27920
27938
|
this.#target.columns.info().forEach(info => {
|
|
@@ -27927,6 +27945,7 @@ class aiContainer extends HTMLElement
|
|
|
27927
27945
|
|
|
27928
27946
|
#generateQdrantFilter = async (userInput) => {
|
|
27929
27947
|
|
|
27948
|
+
const systemMessage = "You are a helpful assistant.";
|
|
27930
27949
|
// Qdrant 필터로 변환하기 위한 프롬프트 엔지니어링
|
|
27931
27950
|
// 중요: 실제 컬렉션의 payload 필드와 그 데이터 타입을 정확히 알려줘야 Gemini가 올바른 필터를 생성합니다.
|
|
27932
27951
|
const prompt = `
|
|
@@ -27958,9 +27977,9 @@ class aiContainer extends HTMLElement
|
|
|
27958
27977
|
Qdrant 필터 JSON:
|
|
27959
27978
|
`;
|
|
27960
27979
|
|
|
27961
|
-
try {
|
|
27962
|
-
const response = await
|
|
27963
|
-
new SystemMessage(
|
|
27980
|
+
//try {
|
|
27981
|
+
const response = await this.#model.invoke([
|
|
27982
|
+
new SystemMessage(systemMessage),
|
|
27964
27983
|
new HumanMessage(prompt),
|
|
27965
27984
|
]);
|
|
27966
27985
|
|
|
@@ -27987,10 +28006,11 @@ filterString = "a" + filterString;
|
|
|
27987
28006
|
// return null; // 파싱 실패 시 null 반환 또는 적절한 에러 처리
|
|
27988
28007
|
//}
|
|
27989
28008
|
|
|
27990
|
-
} catch (error) {
|
|
27991
|
-
|
|
27992
|
-
|
|
27993
|
-
|
|
28009
|
+
//} catch (error) {
|
|
28010
|
+
|
|
28011
|
+
// console.error("Error generating Qdrant filter with Gemini:", error);
|
|
28012
|
+
// return null;
|
|
28013
|
+
//}
|
|
27994
28014
|
}
|
|
27995
28015
|
|
|
27996
28016
|
#q1 = () => {
|
|
@@ -28041,15 +28061,23 @@ this.#generateQdrantFilter();
|
|
|
28041
28061
|
this.shadowRoot.querySelector("nx-ai-chat").add("me", question);
|
|
28042
28062
|
this.shadowRoot.querySelector("nx-ai-chat").add("ing", question);
|
|
28043
28063
|
|
|
28044
|
-
|
|
28045
|
-
this.#
|
|
28046
|
-
|
|
28047
|
-
|
|
28048
|
-
|
|
28049
|
-
|
|
28050
|
-
|
|
28051
|
-
|
|
28064
|
+
try {
|
|
28065
|
+
this.#createModel();
|
|
28066
|
+
|
|
28067
|
+
if (this.shadowRoot.querySelector(".menu-filter").classList.contains("active")) {
|
|
28068
|
+
this.#q1();
|
|
28069
|
+
}
|
|
28070
|
+
else if (this.shadowRoot.querySelector(".menu-general").classList.contains("active")) {
|
|
28071
|
+
this.#q2();
|
|
28072
|
+
}
|
|
28073
|
+
else {
|
|
28074
|
+
this.#q3();
|
|
28075
|
+
}
|
|
28076
|
+
} catch (error) {
|
|
28077
|
+
console.error("Error generating Qdrant filter with Gemini:", error);
|
|
28078
|
+
return null;
|
|
28052
28079
|
}
|
|
28080
|
+
|
|
28053
28081
|
|
|
28054
28082
|
this.#ing = false;
|
|
28055
28083
|
}
|
package/dist/bundle.esm.js
CHANGED
|
@@ -27856,6 +27856,7 @@ class aiContainer extends HTMLElement
|
|
|
27856
27856
|
{
|
|
27857
27857
|
#target;
|
|
27858
27858
|
#ing = false;
|
|
27859
|
+
#model;
|
|
27859
27860
|
//#elChat;
|
|
27860
27861
|
|
|
27861
27862
|
constructor() {
|
|
@@ -27909,10 +27910,27 @@ class aiContainer extends HTMLElement
|
|
|
27909
27910
|
this.#target = v;
|
|
27910
27911
|
}
|
|
27911
27912
|
|
|
27913
|
+
#createModel = () => {
|
|
27914
|
+
const el = this.shadowRoot.querySelector("nx-ai-settings");
|
|
27915
|
+
if (!el) return;
|
|
27916
|
+
|
|
27917
|
+
switch (el.server) {
|
|
27918
|
+
case "gemini":
|
|
27919
|
+
this.#model = new ChatGoogleGenerativeAI({ model: settingsRef.current.model, apiKey: googleApiKey, temperature: 0,});
|
|
27920
|
+
break;
|
|
27921
|
+
case "openai":
|
|
27922
|
+
this.#model = new ChatOpenAI({ model: settingsRef.current.model, apiKey });
|
|
27923
|
+
break;
|
|
27924
|
+
case "ollama":
|
|
27925
|
+
this.#model = new Ollama({ model: settingsRef.current.model });
|
|
27926
|
+
break;
|
|
27927
|
+
}
|
|
27928
|
+
};
|
|
27929
|
+
|
|
27912
27930
|
#getColumnInfo = () => {
|
|
27913
27931
|
let colInfo = "";
|
|
27914
27932
|
|
|
27915
|
-
console.log(this.#target, this.#target.tagName);
|
|
27933
|
+
//console.log(this.#target, this.#target.tagName);
|
|
27916
27934
|
|
|
27917
27935
|
if (this.#target.tagName === "NINE-GRID") {
|
|
27918
27936
|
this.#target.columns.info().forEach(info => {
|
|
@@ -27925,6 +27943,7 @@ class aiContainer extends HTMLElement
|
|
|
27925
27943
|
|
|
27926
27944
|
#generateQdrantFilter = async (userInput) => {
|
|
27927
27945
|
|
|
27946
|
+
const systemMessage = "You are a helpful assistant.";
|
|
27928
27947
|
// Qdrant 필터로 변환하기 위한 프롬프트 엔지니어링
|
|
27929
27948
|
// 중요: 실제 컬렉션의 payload 필드와 그 데이터 타입을 정확히 알려줘야 Gemini가 올바른 필터를 생성합니다.
|
|
27930
27949
|
const prompt = `
|
|
@@ -27956,9 +27975,9 @@ class aiContainer extends HTMLElement
|
|
|
27956
27975
|
Qdrant 필터 JSON:
|
|
27957
27976
|
`;
|
|
27958
27977
|
|
|
27959
|
-
try {
|
|
27960
|
-
const response = await
|
|
27961
|
-
new SystemMessage(
|
|
27978
|
+
//try {
|
|
27979
|
+
const response = await this.#model.invoke([
|
|
27980
|
+
new SystemMessage(systemMessage),
|
|
27962
27981
|
new HumanMessage(prompt),
|
|
27963
27982
|
]);
|
|
27964
27983
|
|
|
@@ -27985,10 +28004,11 @@ filterString = "a" + filterString;
|
|
|
27985
28004
|
// return null; // 파싱 실패 시 null 반환 또는 적절한 에러 처리
|
|
27986
28005
|
//}
|
|
27987
28006
|
|
|
27988
|
-
} catch (error) {
|
|
27989
|
-
|
|
27990
|
-
|
|
27991
|
-
|
|
28007
|
+
//} catch (error) {
|
|
28008
|
+
|
|
28009
|
+
// console.error("Error generating Qdrant filter with Gemini:", error);
|
|
28010
|
+
// return null;
|
|
28011
|
+
//}
|
|
27992
28012
|
}
|
|
27993
28013
|
|
|
27994
28014
|
#q1 = () => {
|
|
@@ -28039,15 +28059,23 @@ this.#generateQdrantFilter();
|
|
|
28039
28059
|
this.shadowRoot.querySelector("nx-ai-chat").add("me", question);
|
|
28040
28060
|
this.shadowRoot.querySelector("nx-ai-chat").add("ing", question);
|
|
28041
28061
|
|
|
28042
|
-
|
|
28043
|
-
this.#
|
|
28044
|
-
|
|
28045
|
-
|
|
28046
|
-
|
|
28047
|
-
|
|
28048
|
-
|
|
28049
|
-
|
|
28062
|
+
try {
|
|
28063
|
+
this.#createModel();
|
|
28064
|
+
|
|
28065
|
+
if (this.shadowRoot.querySelector(".menu-filter").classList.contains("active")) {
|
|
28066
|
+
this.#q1();
|
|
28067
|
+
}
|
|
28068
|
+
else if (this.shadowRoot.querySelector(".menu-general").classList.contains("active")) {
|
|
28069
|
+
this.#q2();
|
|
28070
|
+
}
|
|
28071
|
+
else {
|
|
28072
|
+
this.#q3();
|
|
28073
|
+
}
|
|
28074
|
+
} catch (error) {
|
|
28075
|
+
console.error("Error generating Qdrant filter with Gemini:", error);
|
|
28076
|
+
return null;
|
|
28050
28077
|
}
|
|
28078
|
+
|
|
28051
28079
|
|
|
28052
28080
|
this.#ing = false;
|
|
28053
28081
|
}
|
package/package.json
CHANGED
package/src/ai/aiContainer.js
CHANGED
|
@@ -4,6 +4,7 @@ class aiContainer extends HTMLElement
|
|
|
4
4
|
{
|
|
5
5
|
#target;
|
|
6
6
|
#ing = false;
|
|
7
|
+
#model;
|
|
7
8
|
//#elChat;
|
|
8
9
|
|
|
9
10
|
constructor() {
|
|
@@ -57,10 +58,27 @@ class aiContainer extends HTMLElement
|
|
|
57
58
|
this.#target = v;
|
|
58
59
|
}
|
|
59
60
|
|
|
61
|
+
#createModel = () => {
|
|
62
|
+
const el = this.shadowRoot.querySelector("nx-ai-settings");
|
|
63
|
+
if (!el) return;
|
|
64
|
+
|
|
65
|
+
switch (el.server) {
|
|
66
|
+
case "gemini":
|
|
67
|
+
this.#model = new ChatGoogleGenerativeAI({ model: settingsRef.current.model, apiKey: googleApiKey, temperature: 0,});
|
|
68
|
+
break;
|
|
69
|
+
case "openai":
|
|
70
|
+
this.#model = new ChatOpenAI({ model: settingsRef.current.model, apiKey });
|
|
71
|
+
break;
|
|
72
|
+
case "ollama":
|
|
73
|
+
this.#model = new Ollama({ model: settingsRef.current.model });
|
|
74
|
+
break;
|
|
75
|
+
}
|
|
76
|
+
};
|
|
77
|
+
|
|
60
78
|
#getColumnInfo = () => {
|
|
61
79
|
let colInfo = "";
|
|
62
80
|
|
|
63
|
-
console.log(this.#target, this.#target.tagName);
|
|
81
|
+
//console.log(this.#target, this.#target.tagName);
|
|
64
82
|
|
|
65
83
|
if (this.#target.tagName === "NINE-GRID") {
|
|
66
84
|
this.#target.columns.info().forEach(info => {
|
|
@@ -73,6 +91,7 @@ class aiContainer extends HTMLElement
|
|
|
73
91
|
|
|
74
92
|
#generateQdrantFilter = async (userInput) => {
|
|
75
93
|
|
|
94
|
+
const systemMessage = "You are a helpful assistant.";
|
|
76
95
|
// Qdrant 필터로 변환하기 위한 프롬프트 엔지니어링
|
|
77
96
|
// 중요: 실제 컬렉션의 payload 필드와 그 데이터 타입을 정확히 알려줘야 Gemini가 올바른 필터를 생성합니다.
|
|
78
97
|
const prompt = `
|
|
@@ -104,9 +123,9 @@ class aiContainer extends HTMLElement
|
|
|
104
123
|
Qdrant 필터 JSON:
|
|
105
124
|
`;
|
|
106
125
|
|
|
107
|
-
try {
|
|
108
|
-
const response = await
|
|
109
|
-
new SystemMessage(
|
|
126
|
+
//try {
|
|
127
|
+
const response = await this.#model.invoke([
|
|
128
|
+
new SystemMessage(systemMessage),
|
|
110
129
|
new HumanMessage(prompt),
|
|
111
130
|
]);
|
|
112
131
|
|
|
@@ -133,10 +152,11 @@ filterString = "a" + filterString;
|
|
|
133
152
|
// return null; // 파싱 실패 시 null 반환 또는 적절한 에러 처리
|
|
134
153
|
//}
|
|
135
154
|
|
|
136
|
-
} catch (error) {
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
155
|
+
//} catch (error) {
|
|
156
|
+
|
|
157
|
+
// console.error("Error generating Qdrant filter with Gemini:", error);
|
|
158
|
+
// return null;
|
|
159
|
+
//}
|
|
140
160
|
}
|
|
141
161
|
|
|
142
162
|
#q1 = () => {
|
|
@@ -188,15 +208,23 @@ this.#generateQdrantFilter();
|
|
|
188
208
|
this.shadowRoot.querySelector("nx-ai-chat").add("me", question);
|
|
189
209
|
this.shadowRoot.querySelector("nx-ai-chat").add("ing", question);
|
|
190
210
|
|
|
191
|
-
|
|
192
|
-
this.#
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
211
|
+
try {
|
|
212
|
+
this.#createModel();
|
|
213
|
+
|
|
214
|
+
if (this.shadowRoot.querySelector(".menu-filter").classList.contains("active")) {
|
|
215
|
+
this.#q1();
|
|
216
|
+
}
|
|
217
|
+
else if (this.shadowRoot.querySelector(".menu-general").classList.contains("active")) {
|
|
218
|
+
this.#q2();
|
|
219
|
+
}
|
|
220
|
+
else {
|
|
221
|
+
this.#q3();
|
|
222
|
+
}
|
|
223
|
+
} catch (error) {
|
|
224
|
+
console.error("Error generating Qdrant filter with Gemini:", error);
|
|
225
|
+
return null;
|
|
199
226
|
}
|
|
227
|
+
|
|
200
228
|
|
|
201
229
|
this.#ing = false;
|
|
202
230
|
}
|