ninegrid2 6.547.0 → 6.549.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 +47 -3
- package/dist/bundle.cjs.js +38 -17
- package/dist/bundle.esm.js +38 -17
- package/package.json +1 -1
- package/src/ai/aiContainer.js +47 -3
package/dist/ai/aiContainer.js
CHANGED
|
@@ -124,6 +124,11 @@ class aiContainer extends HTMLElement
|
|
|
124
124
|
}
|
|
125
125
|
};
|
|
126
126
|
|
|
127
|
+
#extractJsonSnippet = (text) => {
|
|
128
|
+
const match = text.match(/```json([\s\S]*?)```/);
|
|
129
|
+
return match ? match[1].trim() : text;
|
|
130
|
+
};
|
|
131
|
+
|
|
127
132
|
|
|
128
133
|
#generateQdrantFilter = async () => {
|
|
129
134
|
|
|
@@ -168,9 +173,49 @@ class aiContainer extends HTMLElement
|
|
|
168
173
|
new HumanMessage(prompt),
|
|
169
174
|
]);
|
|
170
175
|
|
|
171
|
-
console.log(response);
|
|
176
|
+
//console.log(response);
|
|
177
|
+
|
|
178
|
+
/**
|
|
179
|
+
const elSettings = this.shadowRoot.querySelector("nx-ai-settings");
|
|
180
|
+
if (elSettings) {
|
|
181
|
+
switch (elSettings.server) {
|
|
182
|
+
case "ollama":
|
|
183
|
+
this.#model = new Ollama({
|
|
184
|
+
model: elSettings.model,
|
|
185
|
+
host: elSettings.ollamaUrl,
|
|
186
|
+
});
|
|
187
|
+
break;
|
|
188
|
+
}
|
|
189
|
+
} */
|
|
190
|
+
|
|
191
|
+
const elSettings = this.shadowRoot.querySelector("nx-ai-settings");
|
|
192
|
+
if (!elSettings) throw new Error("nx-ai-settings missing !!!");
|
|
193
|
+
|
|
194
|
+
console.log(response);
|
|
172
195
|
|
|
173
|
-
|
|
196
|
+
let filterString;
|
|
197
|
+
switch (elSettings.server) {
|
|
198
|
+
case "openai":
|
|
199
|
+
filterString = this.#extractJsonSnippet(response.content.trim());
|
|
200
|
+
break;
|
|
201
|
+
case "gemini":
|
|
202
|
+
filterString = this.#extractJsonSnippet(response.content.trim());
|
|
203
|
+
break;
|
|
204
|
+
case "ollama":
|
|
205
|
+
filterString = this.#extractJsonSnippet(response);
|
|
206
|
+
break;
|
|
207
|
+
default:
|
|
208
|
+
break;
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
console.log(filterString);
|
|
212
|
+
|
|
213
|
+
return JSON.parse(filterString);
|
|
214
|
+
|
|
215
|
+
|
|
216
|
+
|
|
217
|
+
|
|
218
|
+
//let filterString = response.content.trim();
|
|
174
219
|
if (filterString.startsWith("```json")) {
|
|
175
220
|
filterString = filterString.replace("```json", "");
|
|
176
221
|
const idx = filterString.indexOf("```");
|
|
@@ -360,7 +405,6 @@ class aiContainer extends HTMLElement
|
|
|
360
405
|
|
|
361
406
|
const elAiChat = this.shadowRoot.querySelector("nx-ai-chat");
|
|
362
407
|
|
|
363
|
-
|
|
364
408
|
elAiChat.add("me", question);
|
|
365
409
|
elAiChat.add("ing", question);
|
|
366
410
|
|
package/dist/bundle.cjs.js
CHANGED
|
@@ -54325,6 +54325,11 @@ class aiContainer extends HTMLElement
|
|
|
54325
54325
|
}
|
|
54326
54326
|
};
|
|
54327
54327
|
|
|
54328
|
+
#extractJsonSnippet = (text) => {
|
|
54329
|
+
const match = text.match(/```json([\s\S]*?)```/);
|
|
54330
|
+
return match ? match[1].trim() : text;
|
|
54331
|
+
};
|
|
54332
|
+
|
|
54328
54333
|
|
|
54329
54334
|
#generateQdrantFilter = async () => {
|
|
54330
54335
|
|
|
@@ -54369,25 +54374,42 @@ class aiContainer extends HTMLElement
|
|
|
54369
54374
|
new messages.HumanMessage(prompt),
|
|
54370
54375
|
]);
|
|
54371
54376
|
|
|
54372
|
-
console.log(response);
|
|
54377
|
+
//console.log(response);
|
|
54373
54378
|
|
|
54374
|
-
|
|
54375
|
-
|
|
54376
|
-
|
|
54377
|
-
|
|
54378
|
-
|
|
54379
|
-
|
|
54380
|
-
|
|
54379
|
+
/**
|
|
54380
|
+
const elSettings = this.shadowRoot.querySelector("nx-ai-settings");
|
|
54381
|
+
if (elSettings) {
|
|
54382
|
+
switch (elSettings.server) {
|
|
54383
|
+
case "ollama":
|
|
54384
|
+
this.#model = new Ollama({
|
|
54385
|
+
model: elSettings.model,
|
|
54386
|
+
host: elSettings.ollamaUrl,
|
|
54387
|
+
});
|
|
54388
|
+
break;
|
|
54381
54389
|
}
|
|
54382
|
-
}
|
|
54383
|
-
|
|
54384
|
-
|
|
54390
|
+
} */
|
|
54391
|
+
|
|
54392
|
+
const elSettings = this.shadowRoot.querySelector("nx-ai-settings");
|
|
54393
|
+
if (!elSettings) throw new Error("nx-ai-settings missing !!!");
|
|
54394
|
+
|
|
54395
|
+
console.log(response);
|
|
54396
|
+
|
|
54397
|
+
let filterString;
|
|
54398
|
+
switch (elSettings.server) {
|
|
54399
|
+
case "openai":
|
|
54400
|
+
filterString = this.#extractJsonSnippet(response.content.trim());
|
|
54401
|
+
break;
|
|
54402
|
+
case "gemini":
|
|
54403
|
+
filterString = this.#extractJsonSnippet(response.content.trim());
|
|
54404
|
+
break;
|
|
54405
|
+
case "ollama":
|
|
54406
|
+
filterString = this.#extractJsonSnippet(response);
|
|
54407
|
+
break;
|
|
54408
|
+
}
|
|
54385
54409
|
|
|
54386
|
-
|
|
54387
|
-
|
|
54388
|
-
|
|
54389
|
-
//try {
|
|
54390
|
-
return JSON.parse(filterString);
|
|
54410
|
+
console.log(filterString);
|
|
54411
|
+
|
|
54412
|
+
return JSON.parse(filterString);
|
|
54391
54413
|
//} catch (parseError) {
|
|
54392
54414
|
// console.error("Failed to parse filter string as JSON:", parseError);
|
|
54393
54415
|
// console.error("String that failed to parse:", filterString);
|
|
@@ -54536,7 +54558,6 @@ class aiContainer extends HTMLElement
|
|
|
54536
54558
|
|
|
54537
54559
|
const elAiChat = this.shadowRoot.querySelector("nx-ai-chat");
|
|
54538
54560
|
|
|
54539
|
-
|
|
54540
54561
|
elAiChat.add("me", question);
|
|
54541
54562
|
elAiChat.add("ing", question);
|
|
54542
54563
|
|
package/dist/bundle.esm.js
CHANGED
|
@@ -54323,6 +54323,11 @@ class aiContainer extends HTMLElement
|
|
|
54323
54323
|
}
|
|
54324
54324
|
};
|
|
54325
54325
|
|
|
54326
|
+
#extractJsonSnippet = (text) => {
|
|
54327
|
+
const match = text.match(/```json([\s\S]*?)```/);
|
|
54328
|
+
return match ? match[1].trim() : text;
|
|
54329
|
+
};
|
|
54330
|
+
|
|
54326
54331
|
|
|
54327
54332
|
#generateQdrantFilter = async () => {
|
|
54328
54333
|
|
|
@@ -54367,25 +54372,42 @@ class aiContainer extends HTMLElement
|
|
|
54367
54372
|
new HumanMessage(prompt),
|
|
54368
54373
|
]);
|
|
54369
54374
|
|
|
54370
|
-
console.log(response);
|
|
54375
|
+
//console.log(response);
|
|
54371
54376
|
|
|
54372
|
-
|
|
54373
|
-
|
|
54374
|
-
|
|
54375
|
-
|
|
54376
|
-
|
|
54377
|
-
|
|
54378
|
-
|
|
54377
|
+
/**
|
|
54378
|
+
const elSettings = this.shadowRoot.querySelector("nx-ai-settings");
|
|
54379
|
+
if (elSettings) {
|
|
54380
|
+
switch (elSettings.server) {
|
|
54381
|
+
case "ollama":
|
|
54382
|
+
this.#model = new Ollama({
|
|
54383
|
+
model: elSettings.model,
|
|
54384
|
+
host: elSettings.ollamaUrl,
|
|
54385
|
+
});
|
|
54386
|
+
break;
|
|
54379
54387
|
}
|
|
54380
|
-
}
|
|
54381
|
-
|
|
54382
|
-
|
|
54388
|
+
} */
|
|
54389
|
+
|
|
54390
|
+
const elSettings = this.shadowRoot.querySelector("nx-ai-settings");
|
|
54391
|
+
if (!elSettings) throw new Error("nx-ai-settings missing !!!");
|
|
54392
|
+
|
|
54393
|
+
console.log(response);
|
|
54394
|
+
|
|
54395
|
+
let filterString;
|
|
54396
|
+
switch (elSettings.server) {
|
|
54397
|
+
case "openai":
|
|
54398
|
+
filterString = this.#extractJsonSnippet(response.content.trim());
|
|
54399
|
+
break;
|
|
54400
|
+
case "gemini":
|
|
54401
|
+
filterString = this.#extractJsonSnippet(response.content.trim());
|
|
54402
|
+
break;
|
|
54403
|
+
case "ollama":
|
|
54404
|
+
filterString = this.#extractJsonSnippet(response);
|
|
54405
|
+
break;
|
|
54406
|
+
}
|
|
54383
54407
|
|
|
54384
|
-
|
|
54385
|
-
|
|
54386
|
-
|
|
54387
|
-
//try {
|
|
54388
|
-
return JSON.parse(filterString);
|
|
54408
|
+
console.log(filterString);
|
|
54409
|
+
|
|
54410
|
+
return JSON.parse(filterString);
|
|
54389
54411
|
//} catch (parseError) {
|
|
54390
54412
|
// console.error("Failed to parse filter string as JSON:", parseError);
|
|
54391
54413
|
// console.error("String that failed to parse:", filterString);
|
|
@@ -54534,7 +54556,6 @@ class aiContainer extends HTMLElement
|
|
|
54534
54556
|
|
|
54535
54557
|
const elAiChat = this.shadowRoot.querySelector("nx-ai-chat");
|
|
54536
54558
|
|
|
54537
|
-
|
|
54538
54559
|
elAiChat.add("me", question);
|
|
54539
54560
|
elAiChat.add("ing", question);
|
|
54540
54561
|
|
package/package.json
CHANGED
package/src/ai/aiContainer.js
CHANGED
|
@@ -124,6 +124,11 @@ class aiContainer extends HTMLElement
|
|
|
124
124
|
}
|
|
125
125
|
};
|
|
126
126
|
|
|
127
|
+
#extractJsonSnippet = (text) => {
|
|
128
|
+
const match = text.match(/```json([\s\S]*?)```/);
|
|
129
|
+
return match ? match[1].trim() : text;
|
|
130
|
+
};
|
|
131
|
+
|
|
127
132
|
|
|
128
133
|
#generateQdrantFilter = async () => {
|
|
129
134
|
|
|
@@ -168,9 +173,49 @@ class aiContainer extends HTMLElement
|
|
|
168
173
|
new HumanMessage(prompt),
|
|
169
174
|
]);
|
|
170
175
|
|
|
171
|
-
console.log(response);
|
|
176
|
+
//console.log(response);
|
|
177
|
+
|
|
178
|
+
/**
|
|
179
|
+
const elSettings = this.shadowRoot.querySelector("nx-ai-settings");
|
|
180
|
+
if (elSettings) {
|
|
181
|
+
switch (elSettings.server) {
|
|
182
|
+
case "ollama":
|
|
183
|
+
this.#model = new Ollama({
|
|
184
|
+
model: elSettings.model,
|
|
185
|
+
host: elSettings.ollamaUrl,
|
|
186
|
+
});
|
|
187
|
+
break;
|
|
188
|
+
}
|
|
189
|
+
} */
|
|
190
|
+
|
|
191
|
+
const elSettings = this.shadowRoot.querySelector("nx-ai-settings");
|
|
192
|
+
if (!elSettings) throw new Error("nx-ai-settings missing !!!");
|
|
193
|
+
|
|
194
|
+
console.log(response);
|
|
172
195
|
|
|
173
|
-
|
|
196
|
+
let filterString;
|
|
197
|
+
switch (elSettings.server) {
|
|
198
|
+
case "openai":
|
|
199
|
+
filterString = this.#extractJsonSnippet(response.content.trim());
|
|
200
|
+
break;
|
|
201
|
+
case "gemini":
|
|
202
|
+
filterString = this.#extractJsonSnippet(response.content.trim());
|
|
203
|
+
break;
|
|
204
|
+
case "ollama":
|
|
205
|
+
filterString = this.#extractJsonSnippet(response);
|
|
206
|
+
break;
|
|
207
|
+
default:
|
|
208
|
+
break;
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
console.log(filterString);
|
|
212
|
+
|
|
213
|
+
return JSON.parse(filterString);
|
|
214
|
+
|
|
215
|
+
|
|
216
|
+
|
|
217
|
+
|
|
218
|
+
//let filterString = response.content.trim();
|
|
174
219
|
if (filterString.startsWith("```json")) {
|
|
175
220
|
filterString = filterString.replace("```json", "");
|
|
176
221
|
const idx = filterString.indexOf("```");
|
|
@@ -360,7 +405,6 @@ class aiContainer extends HTMLElement
|
|
|
360
405
|
|
|
361
406
|
const elAiChat = this.shadowRoot.querySelector("nx-ai-chat");
|
|
362
407
|
|
|
363
|
-
|
|
364
408
|
elAiChat.add("me", question);
|
|
365
409
|
elAiChat.add("ing", question);
|
|
366
410
|
|