ninegrid2 6.263.0 → 6.265.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/aiMessage.js +64 -57
- package/dist/bundle.cjs.js +63 -34
- package/dist/bundle.esm.js +63 -34
- package/package.json +1 -1
- package/src/ai/aiMessage.js +64 -57
package/dist/ai/aiMessage.js
CHANGED
|
@@ -1,48 +1,53 @@
|
|
|
1
1
|
import ninegrid from "../index.js";
|
|
2
2
|
|
|
3
|
-
class
|
|
3
|
+
class aiMessage extends HTMLElement
|
|
4
4
|
{
|
|
5
5
|
constructor() {
|
|
6
6
|
super();
|
|
7
7
|
this.attachShadow({ mode: 'open' });
|
|
8
8
|
}
|
|
9
|
+
|
|
10
|
+
connectedCallback() {
|
|
11
|
+
const message = this.getAttribute("message");
|
|
9
12
|
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
if (elem) elem.checked = true;
|
|
13
|
+
this.shadowRoot.innerHTML = `
|
|
14
|
+
<style>
|
|
15
|
+
@import "https://cdn.jsdelivr.net/npm/ninegrid@${ninegrid.version}/dist/css/aiMessage.css";
|
|
16
|
+
${ninegrid.getCustomPath(this,"aiMessage.css")}
|
|
17
|
+
</style>
|
|
16
18
|
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
19
|
+
<div class="chat-message">
|
|
20
|
+
${message}
|
|
21
|
+
</div>
|
|
20
22
|
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
23
|
+
<div class="chat-menu">
|
|
24
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="12" height="12" fill="currentColor" viewBox="0 0 16 16">
|
|
25
|
+
<path d="M11.742 10.344a6.5 6.5 0 1 0-1.397 1.398h-.001q.044.06.098.115l3.85 3.85a1 1 0 0 0 1.415-1.414l-3.85-3.85a1 1 0 0 0-.115-.1zM12 6.5a5.5 5.5 0 1 1-11 0 5.5 5.5 0 0 1 11 0"/>
|
|
26
|
+
</svg>
|
|
27
|
+
</div>
|
|
28
|
+
`;
|
|
25
29
|
|
|
26
|
-
|
|
27
|
-
return this.shadowRoot.querySelector(`#${this.server}Model`)?.value;
|
|
30
|
+
this.#init();
|
|
28
31
|
};
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
elem.value = v;
|
|
33
|
-
elem.dispatchEvent(new Event("change"));
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
/**
|
|
37
|
-
this.dispatchEvent(new CustomEvent("setting-change", {
|
|
38
|
-
detail: { server: this.server, model: this.model }
|
|
39
|
-
})); */
|
|
32
|
+
|
|
33
|
+
#init = () => {
|
|
34
|
+
|
|
40
35
|
};
|
|
36
|
+
}
|
|
41
37
|
|
|
42
|
-
|
|
38
|
+
class aiIngMessage extends HTMLElement
|
|
39
|
+
{
|
|
40
|
+
#message;
|
|
41
|
+
|
|
42
|
+
constructor() {
|
|
43
|
+
super();
|
|
44
|
+
this.attachShadow({ mode: 'open' });
|
|
45
|
+
}
|
|
43
46
|
|
|
44
47
|
connectedCallback() {
|
|
45
|
-
const message = this.getAttribute("message");
|
|
48
|
+
//const message = this.getAttribute("message");
|
|
49
|
+
|
|
50
|
+
this.#message = ".";
|
|
46
51
|
|
|
47
52
|
this.shadowRoot.innerHTML = `
|
|
48
53
|
<style>
|
|
@@ -50,43 +55,45 @@ class aiMyMessage extends HTMLElement
|
|
|
50
55
|
${ninegrid.getCustomPath(this,"aiMessage.css")}
|
|
51
56
|
</style>
|
|
52
57
|
|
|
53
|
-
<div class="
|
|
54
|
-
|
|
58
|
+
<div class="chat-message">
|
|
59
|
+
.
|
|
55
60
|
</div>
|
|
56
61
|
`;
|
|
57
62
|
|
|
58
63
|
this.#init();
|
|
59
64
|
};
|
|
60
65
|
|
|
61
|
-
|
|
62
|
-
|
|
63
66
|
#init = () => {
|
|
67
|
+
const interval = setInterval(() => {
|
|
68
|
+
this.#message = this.#message.length < 3 ? this.#message + "." : "";
|
|
69
|
+
this.shadowRoot.querySelector(".chat-message").innerHTML = this.#message;
|
|
70
|
+
}, 500);
|
|
71
|
+
};
|
|
72
|
+
}
|
|
64
73
|
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
const server = this.shadowRoot.querySelector('input[name="server"]:checked').value;
|
|
71
|
-
|
|
72
|
-
["openai","ollama"].forEach(v => {
|
|
73
|
-
this.shadowRoot.querySelectorAll('.' + v).forEach((elem) => {
|
|
74
|
-
elem.style.display = (server === v) ? "flex" : "none";
|
|
75
|
-
});
|
|
76
|
-
});
|
|
77
|
-
});
|
|
78
|
-
});
|
|
79
|
-
|
|
80
|
-
this.shadowRoot.querySelectorAll('#ollamaModel,#openaiModel,input[name="server"]').forEach(el => {
|
|
81
|
-
//console.log(el);
|
|
82
|
-
el.addEventListener("change", e => {
|
|
83
|
-
//console.log(e);
|
|
84
|
-
this.dispatchEvent(new CustomEvent(this.EVENT.MODEL_CHANGE, {
|
|
85
|
-
detail: { server: this.server, model: this.model }
|
|
86
|
-
}));
|
|
87
|
-
});
|
|
88
|
-
});
|
|
74
|
+
class aiMyMessage extends HTMLElement
|
|
75
|
+
{
|
|
76
|
+
constructor() {
|
|
77
|
+
super();
|
|
78
|
+
this.attachShadow({ mode: 'open' });
|
|
89
79
|
}
|
|
80
|
+
|
|
81
|
+
connectedCallback() {
|
|
82
|
+
const message = this.getAttribute("message");
|
|
83
|
+
|
|
84
|
+
this.shadowRoot.innerHTML = `
|
|
85
|
+
<style>
|
|
86
|
+
@import "https://cdn.jsdelivr.net/npm/ninegrid@${ninegrid.version}/dist/css/aiMessage.css";
|
|
87
|
+
${ninegrid.getCustomPath(this,"aiMessage.css")}
|
|
88
|
+
</style>
|
|
89
|
+
|
|
90
|
+
<div class="chat-message">
|
|
91
|
+
${message}
|
|
92
|
+
</div>
|
|
93
|
+
`;
|
|
94
|
+
};
|
|
90
95
|
}
|
|
91
96
|
|
|
97
|
+
customElements.define("nx-ai-message", aiMessage);
|
|
98
|
+
customElements.define("nx-ai-ing-message", aiIngMessage);
|
|
92
99
|
customElements.define("nx-ai-my-message", aiMyMessage);
|
package/dist/bundle.cjs.js
CHANGED
|
@@ -27282,49 +27282,54 @@ class aiSettings extends HTMLElement
|
|
|
27282
27282
|
|
|
27283
27283
|
customElements.define("nx-ai-settings", aiSettings);
|
|
27284
27284
|
|
|
27285
|
-
class
|
|
27285
|
+
class aiMessage extends HTMLElement
|
|
27286
27286
|
{
|
|
27287
27287
|
constructor() {
|
|
27288
27288
|
super();
|
|
27289
27289
|
this.attachShadow({ mode: 'open' });
|
|
27290
27290
|
}
|
|
27291
|
+
|
|
27292
|
+
connectedCallback() {
|
|
27293
|
+
const message = this.getAttribute("message");
|
|
27291
27294
|
|
|
27292
|
-
|
|
27293
|
-
|
|
27294
|
-
|
|
27295
|
-
|
|
27296
|
-
|
|
27297
|
-
if (elem) elem.checked = true;
|
|
27295
|
+
this.shadowRoot.innerHTML = `
|
|
27296
|
+
<style>
|
|
27297
|
+
@import "https://cdn.jsdelivr.net/npm/ninegrid@${ninegrid.version}/dist/css/aiMessage.css";
|
|
27298
|
+
${ninegrid.getCustomPath(this,"aiMessage.css")}
|
|
27299
|
+
</style>
|
|
27298
27300
|
|
|
27299
|
-
|
|
27300
|
-
|
|
27301
|
-
|
|
27301
|
+
<div class="chat-message">
|
|
27302
|
+
${message}
|
|
27303
|
+
</div>
|
|
27302
27304
|
|
|
27303
|
-
|
|
27304
|
-
|
|
27305
|
-
|
|
27306
|
-
|
|
27305
|
+
<div class="chat-menu">
|
|
27306
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="12" height="12" fill="currentColor" viewBox="0 0 16 16">
|
|
27307
|
+
<path d="M11.742 10.344a6.5 6.5 0 1 0-1.397 1.398h-.001q.044.06.098.115l3.85 3.85a1 1 0 0 0 1.415-1.414l-3.85-3.85a1 1 0 0 0-.115-.1zM12 6.5a5.5 5.5 0 1 1-11 0 5.5 5.5 0 0 1 11 0"/>
|
|
27308
|
+
</svg>
|
|
27309
|
+
</div>
|
|
27310
|
+
`;
|
|
27307
27311
|
|
|
27308
|
-
|
|
27309
|
-
return this.shadowRoot.querySelector(`#${this.server}Model`)?.value;
|
|
27312
|
+
this.#init();
|
|
27310
27313
|
};
|
|
27311
|
-
set model(v) {
|
|
27312
|
-
const elem = this.shadowRoot.querySelector(`#${this.server}Model`);
|
|
27313
|
-
if (elem) {
|
|
27314
|
-
elem.value = v;
|
|
27315
|
-
elem.dispatchEvent(new Event("change"));
|
|
27316
|
-
}
|
|
27317
27314
|
|
|
27318
|
-
|
|
27319
|
-
|
|
27320
|
-
detail: { server: this.server, model: this.model }
|
|
27321
|
-
})); */
|
|
27315
|
+
#init = () => {
|
|
27316
|
+
|
|
27322
27317
|
};
|
|
27318
|
+
}
|
|
27323
27319
|
|
|
27324
|
-
|
|
27320
|
+
class aiIngMessage extends HTMLElement
|
|
27321
|
+
{
|
|
27322
|
+
#message;
|
|
27323
|
+
|
|
27324
|
+
constructor() {
|
|
27325
|
+
super();
|
|
27326
|
+
this.attachShadow({ mode: 'open' });
|
|
27327
|
+
}
|
|
27325
27328
|
|
|
27326
27329
|
connectedCallback() {
|
|
27327
|
-
const message = this.getAttribute("message");
|
|
27330
|
+
//const message = this.getAttribute("message");
|
|
27331
|
+
|
|
27332
|
+
this.#message = ".";
|
|
27328
27333
|
|
|
27329
27334
|
this.shadowRoot.innerHTML = `
|
|
27330
27335
|
<style>
|
|
@@ -27332,23 +27337,47 @@ class aiMyMessage extends HTMLElement
|
|
|
27332
27337
|
${ninegrid.getCustomPath(this,"aiMessage.css")}
|
|
27333
27338
|
</style>
|
|
27334
27339
|
|
|
27335
|
-
<div class="
|
|
27336
|
-
|
|
27340
|
+
<div class="chat-message">
|
|
27341
|
+
.
|
|
27337
27342
|
</div>
|
|
27338
27343
|
`;
|
|
27339
27344
|
|
|
27340
27345
|
this.#init();
|
|
27341
27346
|
};
|
|
27342
27347
|
|
|
27343
|
-
|
|
27344
|
-
|
|
27345
27348
|
#init = () => {
|
|
27349
|
+
setInterval(() => {
|
|
27350
|
+
this.#message = this.#message.length < 3 ? this.#message + "." : "";
|
|
27351
|
+
this.shadowRoot.querySelector(".chat-message").innerHTML = this.#message;
|
|
27352
|
+
}, 500);
|
|
27353
|
+
};
|
|
27354
|
+
}
|
|
27346
27355
|
|
|
27347
|
-
|
|
27348
|
-
|
|
27356
|
+
class aiMyMessage extends HTMLElement
|
|
27357
|
+
{
|
|
27358
|
+
constructor() {
|
|
27359
|
+
super();
|
|
27360
|
+
this.attachShadow({ mode: 'open' });
|
|
27349
27361
|
}
|
|
27362
|
+
|
|
27363
|
+
connectedCallback() {
|
|
27364
|
+
const message = this.getAttribute("message");
|
|
27365
|
+
|
|
27366
|
+
this.shadowRoot.innerHTML = `
|
|
27367
|
+
<style>
|
|
27368
|
+
@import "https://cdn.jsdelivr.net/npm/ninegrid@${ninegrid.version}/dist/css/aiMessage.css";
|
|
27369
|
+
${ninegrid.getCustomPath(this,"aiMessage.css")}
|
|
27370
|
+
</style>
|
|
27371
|
+
|
|
27372
|
+
<div class="chat-message">
|
|
27373
|
+
${message}
|
|
27374
|
+
</div>
|
|
27375
|
+
`;
|
|
27376
|
+
};
|
|
27350
27377
|
}
|
|
27351
27378
|
|
|
27379
|
+
customElements.define("nx-ai-message", aiMessage);
|
|
27380
|
+
customElements.define("nx-ai-ing-message", aiIngMessage);
|
|
27352
27381
|
customElements.define("nx-ai-my-message", aiMyMessage);
|
|
27353
27382
|
|
|
27354
27383
|
//import $ from "https://cdn.jsdelivr.net/npm/jquery@3.6.0/dist/jquery.min.js";
|
package/dist/bundle.esm.js
CHANGED
|
@@ -27280,49 +27280,54 @@ class aiSettings extends HTMLElement
|
|
|
27280
27280
|
|
|
27281
27281
|
customElements.define("nx-ai-settings", aiSettings);
|
|
27282
27282
|
|
|
27283
|
-
class
|
|
27283
|
+
class aiMessage extends HTMLElement
|
|
27284
27284
|
{
|
|
27285
27285
|
constructor() {
|
|
27286
27286
|
super();
|
|
27287
27287
|
this.attachShadow({ mode: 'open' });
|
|
27288
27288
|
}
|
|
27289
|
+
|
|
27290
|
+
connectedCallback() {
|
|
27291
|
+
const message = this.getAttribute("message");
|
|
27289
27292
|
|
|
27290
|
-
|
|
27291
|
-
|
|
27292
|
-
|
|
27293
|
-
|
|
27294
|
-
|
|
27295
|
-
if (elem) elem.checked = true;
|
|
27293
|
+
this.shadowRoot.innerHTML = `
|
|
27294
|
+
<style>
|
|
27295
|
+
@import "https://cdn.jsdelivr.net/npm/ninegrid@${ninegrid.version}/dist/css/aiMessage.css";
|
|
27296
|
+
${ninegrid.getCustomPath(this,"aiMessage.css")}
|
|
27297
|
+
</style>
|
|
27296
27298
|
|
|
27297
|
-
|
|
27298
|
-
|
|
27299
|
-
|
|
27299
|
+
<div class="chat-message">
|
|
27300
|
+
${message}
|
|
27301
|
+
</div>
|
|
27300
27302
|
|
|
27301
|
-
|
|
27302
|
-
|
|
27303
|
-
|
|
27304
|
-
|
|
27303
|
+
<div class="chat-menu">
|
|
27304
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="12" height="12" fill="currentColor" viewBox="0 0 16 16">
|
|
27305
|
+
<path d="M11.742 10.344a6.5 6.5 0 1 0-1.397 1.398h-.001q.044.06.098.115l3.85 3.85a1 1 0 0 0 1.415-1.414l-3.85-3.85a1 1 0 0 0-.115-.1zM12 6.5a5.5 5.5 0 1 1-11 0 5.5 5.5 0 0 1 11 0"/>
|
|
27306
|
+
</svg>
|
|
27307
|
+
</div>
|
|
27308
|
+
`;
|
|
27305
27309
|
|
|
27306
|
-
|
|
27307
|
-
return this.shadowRoot.querySelector(`#${this.server}Model`)?.value;
|
|
27310
|
+
this.#init();
|
|
27308
27311
|
};
|
|
27309
|
-
set model(v) {
|
|
27310
|
-
const elem = this.shadowRoot.querySelector(`#${this.server}Model`);
|
|
27311
|
-
if (elem) {
|
|
27312
|
-
elem.value = v;
|
|
27313
|
-
elem.dispatchEvent(new Event("change"));
|
|
27314
|
-
}
|
|
27315
27312
|
|
|
27316
|
-
|
|
27317
|
-
|
|
27318
|
-
detail: { server: this.server, model: this.model }
|
|
27319
|
-
})); */
|
|
27313
|
+
#init = () => {
|
|
27314
|
+
|
|
27320
27315
|
};
|
|
27316
|
+
}
|
|
27321
27317
|
|
|
27322
|
-
|
|
27318
|
+
class aiIngMessage extends HTMLElement
|
|
27319
|
+
{
|
|
27320
|
+
#message;
|
|
27321
|
+
|
|
27322
|
+
constructor() {
|
|
27323
|
+
super();
|
|
27324
|
+
this.attachShadow({ mode: 'open' });
|
|
27325
|
+
}
|
|
27323
27326
|
|
|
27324
27327
|
connectedCallback() {
|
|
27325
|
-
const message = this.getAttribute("message");
|
|
27328
|
+
//const message = this.getAttribute("message");
|
|
27329
|
+
|
|
27330
|
+
this.#message = ".";
|
|
27326
27331
|
|
|
27327
27332
|
this.shadowRoot.innerHTML = `
|
|
27328
27333
|
<style>
|
|
@@ -27330,23 +27335,47 @@ class aiMyMessage extends HTMLElement
|
|
|
27330
27335
|
${ninegrid.getCustomPath(this,"aiMessage.css")}
|
|
27331
27336
|
</style>
|
|
27332
27337
|
|
|
27333
|
-
<div class="
|
|
27334
|
-
|
|
27338
|
+
<div class="chat-message">
|
|
27339
|
+
.
|
|
27335
27340
|
</div>
|
|
27336
27341
|
`;
|
|
27337
27342
|
|
|
27338
27343
|
this.#init();
|
|
27339
27344
|
};
|
|
27340
27345
|
|
|
27341
|
-
|
|
27342
|
-
|
|
27343
27346
|
#init = () => {
|
|
27347
|
+
setInterval(() => {
|
|
27348
|
+
this.#message = this.#message.length < 3 ? this.#message + "." : "";
|
|
27349
|
+
this.shadowRoot.querySelector(".chat-message").innerHTML = this.#message;
|
|
27350
|
+
}, 500);
|
|
27351
|
+
};
|
|
27352
|
+
}
|
|
27344
27353
|
|
|
27345
|
-
|
|
27346
|
-
|
|
27354
|
+
class aiMyMessage extends HTMLElement
|
|
27355
|
+
{
|
|
27356
|
+
constructor() {
|
|
27357
|
+
super();
|
|
27358
|
+
this.attachShadow({ mode: 'open' });
|
|
27347
27359
|
}
|
|
27360
|
+
|
|
27361
|
+
connectedCallback() {
|
|
27362
|
+
const message = this.getAttribute("message");
|
|
27363
|
+
|
|
27364
|
+
this.shadowRoot.innerHTML = `
|
|
27365
|
+
<style>
|
|
27366
|
+
@import "https://cdn.jsdelivr.net/npm/ninegrid@${ninegrid.version}/dist/css/aiMessage.css";
|
|
27367
|
+
${ninegrid.getCustomPath(this,"aiMessage.css")}
|
|
27368
|
+
</style>
|
|
27369
|
+
|
|
27370
|
+
<div class="chat-message">
|
|
27371
|
+
${message}
|
|
27372
|
+
</div>
|
|
27373
|
+
`;
|
|
27374
|
+
};
|
|
27348
27375
|
}
|
|
27349
27376
|
|
|
27377
|
+
customElements.define("nx-ai-message", aiMessage);
|
|
27378
|
+
customElements.define("nx-ai-ing-message", aiIngMessage);
|
|
27350
27379
|
customElements.define("nx-ai-my-message", aiMyMessage);
|
|
27351
27380
|
|
|
27352
27381
|
//import $ from "https://cdn.jsdelivr.net/npm/jquery@3.6.0/dist/jquery.min.js";
|
package/package.json
CHANGED
package/src/ai/aiMessage.js
CHANGED
|
@@ -1,48 +1,53 @@
|
|
|
1
1
|
import ninegrid from "../index.js";
|
|
2
2
|
|
|
3
|
-
class
|
|
3
|
+
class aiMessage extends HTMLElement
|
|
4
4
|
{
|
|
5
5
|
constructor() {
|
|
6
6
|
super();
|
|
7
7
|
this.attachShadow({ mode: 'open' });
|
|
8
8
|
}
|
|
9
|
+
|
|
10
|
+
connectedCallback() {
|
|
11
|
+
const message = this.getAttribute("message");
|
|
9
12
|
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
if (elem) elem.checked = true;
|
|
13
|
+
this.shadowRoot.innerHTML = `
|
|
14
|
+
<style>
|
|
15
|
+
@import "https://cdn.jsdelivr.net/npm/ninegrid@${ninegrid.version}/dist/css/aiMessage.css";
|
|
16
|
+
${ninegrid.getCustomPath(this,"aiMessage.css")}
|
|
17
|
+
</style>
|
|
16
18
|
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
19
|
+
<div class="chat-message">
|
|
20
|
+
${message}
|
|
21
|
+
</div>
|
|
20
22
|
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
23
|
+
<div class="chat-menu">
|
|
24
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="12" height="12" fill="currentColor" viewBox="0 0 16 16">
|
|
25
|
+
<path d="M11.742 10.344a6.5 6.5 0 1 0-1.397 1.398h-.001q.044.06.098.115l3.85 3.85a1 1 0 0 0 1.415-1.414l-3.85-3.85a1 1 0 0 0-.115-.1zM12 6.5a5.5 5.5 0 1 1-11 0 5.5 5.5 0 0 1 11 0"/>
|
|
26
|
+
</svg>
|
|
27
|
+
</div>
|
|
28
|
+
`;
|
|
25
29
|
|
|
26
|
-
|
|
27
|
-
return this.shadowRoot.querySelector(`#${this.server}Model`)?.value;
|
|
30
|
+
this.#init();
|
|
28
31
|
};
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
elem.value = v;
|
|
33
|
-
elem.dispatchEvent(new Event("change"));
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
/**
|
|
37
|
-
this.dispatchEvent(new CustomEvent("setting-change", {
|
|
38
|
-
detail: { server: this.server, model: this.model }
|
|
39
|
-
})); */
|
|
32
|
+
|
|
33
|
+
#init = () => {
|
|
34
|
+
|
|
40
35
|
};
|
|
36
|
+
}
|
|
41
37
|
|
|
42
|
-
|
|
38
|
+
class aiIngMessage extends HTMLElement
|
|
39
|
+
{
|
|
40
|
+
#message;
|
|
41
|
+
|
|
42
|
+
constructor() {
|
|
43
|
+
super();
|
|
44
|
+
this.attachShadow({ mode: 'open' });
|
|
45
|
+
}
|
|
43
46
|
|
|
44
47
|
connectedCallback() {
|
|
45
|
-
const message = this.getAttribute("message");
|
|
48
|
+
//const message = this.getAttribute("message");
|
|
49
|
+
|
|
50
|
+
this.#message = ".";
|
|
46
51
|
|
|
47
52
|
this.shadowRoot.innerHTML = `
|
|
48
53
|
<style>
|
|
@@ -50,43 +55,45 @@ class aiMyMessage extends HTMLElement
|
|
|
50
55
|
${ninegrid.getCustomPath(this,"aiMessage.css")}
|
|
51
56
|
</style>
|
|
52
57
|
|
|
53
|
-
<div class="
|
|
54
|
-
|
|
58
|
+
<div class="chat-message">
|
|
59
|
+
.
|
|
55
60
|
</div>
|
|
56
61
|
`;
|
|
57
62
|
|
|
58
63
|
this.#init();
|
|
59
64
|
};
|
|
60
65
|
|
|
61
|
-
|
|
62
|
-
|
|
63
66
|
#init = () => {
|
|
67
|
+
const interval = setInterval(() => {
|
|
68
|
+
this.#message = this.#message.length < 3 ? this.#message + "." : "";
|
|
69
|
+
this.shadowRoot.querySelector(".chat-message").innerHTML = this.#message;
|
|
70
|
+
}, 500);
|
|
71
|
+
};
|
|
72
|
+
}
|
|
64
73
|
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
const server = this.shadowRoot.querySelector('input[name="server"]:checked').value;
|
|
71
|
-
|
|
72
|
-
["openai","ollama"].forEach(v => {
|
|
73
|
-
this.shadowRoot.querySelectorAll('.' + v).forEach((elem) => {
|
|
74
|
-
elem.style.display = (server === v) ? "flex" : "none";
|
|
75
|
-
});
|
|
76
|
-
});
|
|
77
|
-
});
|
|
78
|
-
});
|
|
79
|
-
|
|
80
|
-
this.shadowRoot.querySelectorAll('#ollamaModel,#openaiModel,input[name="server"]').forEach(el => {
|
|
81
|
-
//console.log(el);
|
|
82
|
-
el.addEventListener("change", e => {
|
|
83
|
-
//console.log(e);
|
|
84
|
-
this.dispatchEvent(new CustomEvent(this.EVENT.MODEL_CHANGE, {
|
|
85
|
-
detail: { server: this.server, model: this.model }
|
|
86
|
-
}));
|
|
87
|
-
});
|
|
88
|
-
});
|
|
74
|
+
class aiMyMessage extends HTMLElement
|
|
75
|
+
{
|
|
76
|
+
constructor() {
|
|
77
|
+
super();
|
|
78
|
+
this.attachShadow({ mode: 'open' });
|
|
89
79
|
}
|
|
80
|
+
|
|
81
|
+
connectedCallback() {
|
|
82
|
+
const message = this.getAttribute("message");
|
|
83
|
+
|
|
84
|
+
this.shadowRoot.innerHTML = `
|
|
85
|
+
<style>
|
|
86
|
+
@import "https://cdn.jsdelivr.net/npm/ninegrid@${ninegrid.version}/dist/css/aiMessage.css";
|
|
87
|
+
${ninegrid.getCustomPath(this,"aiMessage.css")}
|
|
88
|
+
</style>
|
|
89
|
+
|
|
90
|
+
<div class="chat-message">
|
|
91
|
+
${message}
|
|
92
|
+
</div>
|
|
93
|
+
`;
|
|
94
|
+
};
|
|
90
95
|
}
|
|
91
96
|
|
|
97
|
+
customElements.define("nx-ai-message", aiMessage);
|
|
98
|
+
customElements.define("nx-ai-ing-message", aiIngMessage);
|
|
92
99
|
customElements.define("nx-ai-my-message", aiMyMessage);
|