ts-glitter 13.8.1 → 13.8.3
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/lowcode/Entry.js +1 -1
- package/lowcode/Entry.ts +1 -2
- package/lowcode/cms-plugin/ai-message.js +230 -155
- package/lowcode/cms-plugin/ai-message.ts +401 -309
- package/lowcode/dialog/image-preview.js +7 -5
- package/lowcode/dialog/image-preview.ts +16 -8
- package/lowcode/glitterBundle/module/html-generate.js +26 -12
- package/lowcode/glitterBundle/module/html-generate.ts +26 -13
- package/lowcode/jspage/editor.js +30 -32
- package/lowcode/jspage/editor.ts +563 -541
- package/lowcode/jspage/main.js +1 -3
- package/lowcode/jspage/main.ts +1 -4
- package/lowcode/official_view_component/official/component.js +2 -2
- package/lowcode/official_view_component/official/component.ts +2 -2
- package/package.json +1 -1
- package/src/api-public/controllers/ai-chat.js +4 -1
- package/src/api-public/controllers/ai-chat.js.map +1 -1
- package/src/api-public/controllers/ai-chat.ts +4 -2
- package/src/api-public/services/ai-robot.d.ts +16 -0
- package/src/api-public/services/ai-robot.js +119 -23
- package/src/api-public/services/ai-robot.js.map +1 -1
- package/src/api-public/services/ai-robot.ts +145 -51
- package/src/api-public/services/chat.js +5 -2
- package/src/api-public/services/chat.js.map +1 -1
- package/src/api-public/services/chat.ts +4 -1
package/lowcode/Entry.js
CHANGED
|
@@ -59,7 +59,7 @@ export class Entry {
|
|
|
59
59
|
}
|
|
60
60
|
window.renderClock = (_a = window.renderClock) !== null && _a !== void 0 ? _a : clockF();
|
|
61
61
|
console.log(`Entry-time:`, window.renderClock.stop());
|
|
62
|
-
glitter.share.editerVersion = "V_13.8.
|
|
62
|
+
glitter.share.editerVersion = "V_13.8.3";
|
|
63
63
|
glitter.share.start = (new Date());
|
|
64
64
|
const vm = {
|
|
65
65
|
appConfig: [],
|
package/lowcode/Entry.ts
CHANGED
|
@@ -9,7 +9,6 @@ import {ShareDialog} from "./glitterBundle/dialog/ShareDialog.js";
|
|
|
9
9
|
|
|
10
10
|
export class Entry {
|
|
11
11
|
public static onCreate(glitter: Glitter) {
|
|
12
|
-
|
|
13
12
|
glitter.share.top_inset = 0
|
|
14
13
|
glitter.share.bottom_inset = 0
|
|
15
14
|
glitter.share.reload_code_hash = function () {
|
|
@@ -60,7 +59,7 @@ export class Entry {
|
|
|
60
59
|
}
|
|
61
60
|
(window as any).renderClock = (window as any).renderClock ?? clockF();
|
|
62
61
|
console.log(`Entry-time:`, (window as any).renderClock.stop());
|
|
63
|
-
glitter.share.editerVersion = "V_13.8.
|
|
62
|
+
glitter.share.editerVersion = "V_13.8.3";
|
|
64
63
|
glitter.share.start = (new Date());
|
|
65
64
|
const vm: {
|
|
66
65
|
appConfig: any;
|
|
@@ -24,7 +24,30 @@ export class AiMessage {
|
|
|
24
24
|
id: gvc.glitter.getUUID(),
|
|
25
25
|
};
|
|
26
26
|
return gvc.bindView(() => {
|
|
27
|
-
AiMessage.toggle = (vis) => {
|
|
27
|
+
AiMessage.toggle = (vis, option) => {
|
|
28
|
+
if (!option) {
|
|
29
|
+
AiMessage.ai_support = [
|
|
30
|
+
{
|
|
31
|
+
key: 'writer',
|
|
32
|
+
label: '文案寫手',
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
key: 'order_analysis',
|
|
36
|
+
label: '訂單分析',
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
key: 'design',
|
|
40
|
+
label: '圖片生成',
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
key: 'operation_guide',
|
|
44
|
+
label: '操作引導',
|
|
45
|
+
}
|
|
46
|
+
];
|
|
47
|
+
}
|
|
48
|
+
else {
|
|
49
|
+
AiMessage.ai_support = option;
|
|
50
|
+
}
|
|
28
51
|
vm.visible = vis;
|
|
29
52
|
$(document.querySelector('.ai-left')).addClass(`scroll-out`);
|
|
30
53
|
setTimeout(() => {
|
|
@@ -38,39 +61,42 @@ export class AiMessage {
|
|
|
38
61
|
return ``;
|
|
39
62
|
}
|
|
40
63
|
return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
|
|
41
|
-
resolve(html
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
64
|
+
resolve(html `
|
|
65
|
+
<div
|
|
66
|
+
class="position-fixed start-0 top-0 vw-100 vh-100"
|
|
67
|
+
style="background: rgba(0,0,0,0.5);z-index:999;"
|
|
68
|
+
onclick="${gvc.event(() => {
|
|
45
69
|
AiMessage.toggle(false);
|
|
46
70
|
})}"
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
71
|
+
>
|
|
72
|
+
<div
|
|
73
|
+
class="position-fixed vh-100 top-0 scroll-in bg-white ai-left"
|
|
74
|
+
style="top:0px;width: 500px;height: 100vh;max-width: 100vw;"
|
|
75
|
+
onclick="${gvc.event((e, event) => {
|
|
52
76
|
event.stopPropagation();
|
|
53
77
|
})}"
|
|
54
|
-
|
|
55
|
-
|
|
78
|
+
>
|
|
79
|
+
${AiMessage.detail({
|
|
56
80
|
gvc: gvc,
|
|
57
81
|
user_id: cf.userID,
|
|
58
82
|
containerHeight: $('body').height() + 10 + 'px',
|
|
59
83
|
document: document,
|
|
60
|
-
goBack: () => {
|
|
84
|
+
goBack: () => {
|
|
85
|
+
},
|
|
61
86
|
close: () => {
|
|
62
87
|
AiMessage.toggle(false);
|
|
63
88
|
},
|
|
64
89
|
})}
|
|
65
|
-
|
|
66
|
-
|
|
90
|
+
</div>
|
|
91
|
+
</div>`);
|
|
67
92
|
}));
|
|
68
93
|
},
|
|
69
94
|
divCreate: {
|
|
70
95
|
elem: 'div',
|
|
71
96
|
style: `z-index:99999;bottom:0px;left:0px;`,
|
|
72
97
|
},
|
|
73
|
-
onCreate: () => __awaiter(this, void 0, void 0, function* () {
|
|
98
|
+
onCreate: () => __awaiter(this, void 0, void 0, function* () {
|
|
99
|
+
}),
|
|
74
100
|
};
|
|
75
101
|
});
|
|
76
102
|
}
|
|
@@ -149,21 +175,23 @@ export class AiMessage {
|
|
|
149
175
|
if (chatRoom.who === 'manager') {
|
|
150
176
|
chatRoom.user_data = AiMessage.config;
|
|
151
177
|
}
|
|
152
|
-
resolve(html
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
<
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
178
|
+
resolve(html `
|
|
179
|
+
<div
|
|
180
|
+
class="navbar d-flex align-items-center justify-content-between w-100 p-3 ${AiMessage.config.hideBar ? `d-none` : ``}"
|
|
181
|
+
style="background: ${AiMessage.config.color};"
|
|
182
|
+
>
|
|
183
|
+
<div class="d-flex align-items-center pe-3 w-100"
|
|
184
|
+
style="gap:10px;display: flex;align-items: center;">
|
|
185
|
+
<img
|
|
186
|
+
src="https://d3jnmi1tfjgtti.cloudfront.net/file/234285319/size1440_s*px$_sas0s9s0s1sesas0_1697354801736-Glitterlogo.png"
|
|
187
|
+
class="rounded-circle border"
|
|
188
|
+
style="background: white;border-radius: 50%;width: 40px;height: 40px;"
|
|
189
|
+
width="40"
|
|
190
|
+
alt="Albert Flores"
|
|
191
|
+
/>
|
|
192
|
+
<div class="d-flex flex-column px-1 text-white">
|
|
193
|
+
<h6 class="mb-0 text-white d-flex">AI 智能助手</h6>
|
|
194
|
+
${gvc.bindView(() => {
|
|
167
195
|
return {
|
|
168
196
|
bind: 'ai_points_count',
|
|
169
197
|
view: () => {
|
|
@@ -172,53 +200,44 @@ export class AiMessage {
|
|
|
172
200
|
}));
|
|
173
201
|
},
|
|
174
202
|
divCreate: {
|
|
175
|
-
class: `fw-500 d-flex`,
|
|
203
|
+
class: `fw-500 d-flex`,
|
|
204
|
+
style: `font-size:13px;`
|
|
176
205
|
}
|
|
177
206
|
};
|
|
178
207
|
})}
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
208
|
+
</div>
|
|
209
|
+
<div class="flex-fill" style="flex: 1;"></div>
|
|
210
|
+
<i
|
|
211
|
+
class="fa-regular fa-circle-xmark text-white fs-3 ${cf.close ? `` : `d-none`}"
|
|
212
|
+
onclick="${gvc.event(() => {
|
|
184
213
|
cf.close && cf.close();
|
|
185
214
|
})}"
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
html
|
|
215
|
+
></i>
|
|
216
|
+
</div>
|
|
217
|
+
</div>` +
|
|
218
|
+
html `
|
|
219
|
+
<div class="d-flex align-items-center p-2 shadow border-bottom"
|
|
220
|
+
style="gap:10px;">
|
|
190
221
|
${(() => {
|
|
191
|
-
const list =
|
|
192
|
-
{
|
|
193
|
-
key: 'writer',
|
|
194
|
-
label: '文案寫手',
|
|
195
|
-
},
|
|
196
|
-
{
|
|
197
|
-
key: 'order_analysis',
|
|
198
|
-
label: '訂單分析',
|
|
199
|
-
},
|
|
200
|
-
{
|
|
201
|
-
key: 'operation_guide',
|
|
202
|
-
label: '操作引導',
|
|
203
|
-
},
|
|
204
|
-
];
|
|
222
|
+
const list = AiMessage.ai_support;
|
|
205
223
|
return list
|
|
206
224
|
.map((dd) => {
|
|
207
225
|
if (AiMessage.vm.select_bt === dd.key) {
|
|
208
|
-
return html
|
|
209
|
-
|
|
210
|
-
|
|
226
|
+
return html `
|
|
227
|
+
<div class="d-flex align-items-center justify-content-center fw-bold px-2 py-2 fw-500 select-label-ai-message fs-6">
|
|
228
|
+
${dd.label}
|
|
229
|
+
</div>`;
|
|
211
230
|
}
|
|
212
231
|
else {
|
|
213
|
-
return html
|
|
214
|
-
|
|
215
|
-
|
|
232
|
+
return html `
|
|
233
|
+
<div class="d-flex align-items-center justify-content-center fw-bold px-2 py-2 fw-500 select-btn-ai-message fs-6"
|
|
234
|
+
onclick="${gvc.event(() => {
|
|
216
235
|
AiMessage.vm.select_bt = dd.key;
|
|
217
236
|
refresh();
|
|
218
237
|
})}"
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
238
|
+
>
|
|
239
|
+
${dd.label}
|
|
240
|
+
</div>`;
|
|
222
241
|
}
|
|
223
242
|
})
|
|
224
243
|
.join('');
|
|
@@ -273,57 +292,76 @@ export class AiMessage {
|
|
|
273
292
|
return markdownString.replace(/\n/g, '<br>');
|
|
274
293
|
}
|
|
275
294
|
function add_line(dd, index) {
|
|
295
|
+
dd.message.text = dd.message.text || '';
|
|
276
296
|
if (dd.user_id == 'manager') {
|
|
277
297
|
dd.user_data = AiMessage.config;
|
|
278
298
|
}
|
|
279
299
|
const replacedString = markdownToHTML(dd.message.text);
|
|
300
|
+
const width = (document.body.clientWidth < 768) ? document.body.clientWidth - 120 : 348;
|
|
280
301
|
if (cf.user_id !== dd.user_id) {
|
|
281
|
-
return html `
|
|
282
|
-
<
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
<div
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
302
|
+
return html `
|
|
303
|
+
<div class="mt-auto d-flex align-items-start ${vm.data[index + 1] && vm.data[index + 1].user_id === dd.user_id ? `mb-1` : `mb-3`}">
|
|
304
|
+
<img
|
|
305
|
+
src="https://d3jnmi1tfjgtti.cloudfront.net/file/234285319/size1440_s*px$_sas0s9s0s1sesas0_1697354801736-Glitterlogo.png"
|
|
306
|
+
class="rounded-circle border"
|
|
307
|
+
width="40"
|
|
308
|
+
style="background: white;border-radius: 50%;width: 40px;height: 40px;"
|
|
309
|
+
/>
|
|
310
|
+
<div class="ps-2 ms-1" style="max-width: ${width}px;">
|
|
311
|
+
<div
|
|
312
|
+
class="p-3 mb-1"
|
|
313
|
+
style="background:#eeeef1;border-top-right-radius: .5rem; border-bottom-right-radius: .5rem; border-bottom-left-radius: .5rem;white-space: normal;"
|
|
314
|
+
>
|
|
315
|
+
${replacedString}
|
|
316
|
+
${dd.message.image ? `<img style="cursor: pointer;width:${width - 40}px;height: ${width - 40}px;"
|
|
317
|
+
src="${dd.message.image}"
|
|
318
|
+
alt="image"
|
|
319
|
+
onclick="${gvc.event(() => {
|
|
320
|
+
gvc.glitter.openDiaLog(new URL('./dialog/image-preview.js', gvc.glitter.root_path).href, 'preview', dd.message.image);
|
|
321
|
+
})}">` : ``}
|
|
322
|
+
<div class="w-100 d-flex align-items-center justify-content-end text-muted fs-sm mt-2 ${!(dd.message.usage) ? `d-none` : ``}"
|
|
323
|
+
style="letter-spacing: 1.2px;">
|
|
324
|
+
${dd.message.usage ? `消耗『${dd.message.usage.toLocaleString()}』點 AI Points` : ``}
|
|
325
|
+
</div>
|
|
326
|
+
</div>
|
|
327
|
+
<div class="fs-sm d-flex text-muted time-tt ${vm.data[index + 1] && vm.data[index + 1].user_id === dd.user_id ? `d-none` : ``}">
|
|
328
|
+
${gvc.glitter.ut.dateFormat(new Date(dd.created_time), 'MM-dd hh:mm')}
|
|
329
|
+
</div>
|
|
298
330
|
</div>
|
|
299
|
-
</div
|
|
300
|
-
</div>`;
|
|
331
|
+
</div>`;
|
|
301
332
|
}
|
|
302
333
|
else {
|
|
303
|
-
return html `
|
|
304
|
-
<div class="
|
|
305
|
-
<div
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
334
|
+
return html `
|
|
335
|
+
<div class="d-flex align-items-start justify-content-end ${vm.data[index + 1] && vm.data[index + 1].user_id === dd.user_id ? `mb-1` : `mb-3`}">
|
|
336
|
+
<div class="pe-2 me-1" style="max-width: ${width}px;">
|
|
337
|
+
<div
|
|
338
|
+
class=" text-light p-3 mb-1"
|
|
339
|
+
style="background:#575757;border-top-left-radius: .5rem; border-bottom-right-radius: .5rem; border-bottom-left-radius: .5rem;white-space: normal;"
|
|
340
|
+
>
|
|
341
|
+
${replacedString}
|
|
342
|
+
${dd.message.image ? `<img style="cursor: pointer;width:${width - 40}px;height: ${width - 40}px;"
|
|
343
|
+
src="${dd.message.image}"
|
|
344
|
+
alt="image"
|
|
345
|
+
onclick="${gvc.event(() => {
|
|
346
|
+
gvc.glitter.openDiaLog(new URL('./dialog/image-preview.js', gvc.glitter.root_path).href, 'preview', dd.message.image);
|
|
347
|
+
})}">` : ``}
|
|
348
|
+
</div>
|
|
349
|
+
<div
|
|
350
|
+
class="fw-500 d-flex justify-content-end align-items-center time-tt fs-sm text-muted ${vm.data[index + 1] &&
|
|
313
351
|
vm.data[index + 1].user_id === dd.user_id
|
|
314
352
|
? `d-none`
|
|
315
353
|
: ``}"
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
354
|
+
style="gap:5px;"
|
|
355
|
+
>
|
|
356
|
+
<span> ${gvc.glitter.ut.dateFormat(new Date(dd.created_time), 'MM/dd hh:mm')}</span>
|
|
357
|
+
${vm.last_read.find((d2) => {
|
|
320
358
|
return d2.user_id !== cf.user_id && new Date(d2.last_read).getTime() >= new Date(dd.created_time).getTime();
|
|
321
359
|
})
|
|
322
360
|
? `已讀`
|
|
323
361
|
: ``}
|
|
362
|
+
</div>
|
|
324
363
|
</div>
|
|
325
|
-
</div
|
|
326
|
-
</div>`;
|
|
364
|
+
</div>`;
|
|
327
365
|
}
|
|
328
366
|
}
|
|
329
367
|
function connect() {
|
|
@@ -393,12 +431,13 @@ export class AiMessage {
|
|
|
393
431
|
bind: viewId,
|
|
394
432
|
view: () => {
|
|
395
433
|
if (vm.loading) {
|
|
396
|
-
return html
|
|
397
|
-
<div class="
|
|
398
|
-
<
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
434
|
+
return html `
|
|
435
|
+
<div class="d-flex align-items-center justify-content-center w-100 flex-column pt-3">
|
|
436
|
+
<div class="spinner-border" role="status">
|
|
437
|
+
<span class="sr-only"></span>
|
|
438
|
+
</div>
|
|
439
|
+
<span class="mt-2">AI 就位中...</span>
|
|
440
|
+
</div>`;
|
|
402
441
|
}
|
|
403
442
|
return html `
|
|
404
443
|
${gvc.bindView(() => {
|
|
@@ -424,6 +463,10 @@ export class AiMessage {
|
|
|
424
463
|
key: 'operation_guide',
|
|
425
464
|
text: '您好!我是AI後台引導員,能協助你使用平台,如果有任何不了解的地方請直接詢問我。',
|
|
426
465
|
},
|
|
466
|
+
{
|
|
467
|
+
key: 'design',
|
|
468
|
+
text: '您好!我是AI設計師,能協助你生成任何行銷或商品圖面。',
|
|
469
|
+
}
|
|
427
470
|
].find((dd) => {
|
|
428
471
|
return dd.key === AiMessage.vm.select_bt;
|
|
429
472
|
})) === null || _a === void 0 ? void 0 : _a.text,
|
|
@@ -486,16 +529,20 @@ export class AiMessage {
|
|
|
486
529
|
view: () => {
|
|
487
530
|
var _a;
|
|
488
531
|
if (vm.ai_loading) {
|
|
489
|
-
return html `
|
|
490
|
-
<div class="
|
|
491
|
-
<div class="
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
532
|
+
return html `
|
|
533
|
+
<div class="d-flex align-items-center justify-content-center ai-waiting flex-fill mx-2">
|
|
534
|
+
<div class="w-100 py-2 bt_ffb40_stroke d-flex align-items-center justify-content-center"
|
|
535
|
+
style="gap: 8px;">
|
|
536
|
+
<div class="spinner-border"
|
|
537
|
+
style="width:20px;height: 20px;"></div>
|
|
538
|
+
AI 解答中
|
|
539
|
+
</div>
|
|
540
|
+
</div>`;
|
|
495
541
|
}
|
|
496
542
|
else {
|
|
497
543
|
return html `
|
|
498
|
-
<div class="d-flex px-2"
|
|
544
|
+
<div class="d-flex px-2"
|
|
545
|
+
style="overflow-x: auto;gap:5px;">
|
|
499
546
|
${(_a = [
|
|
500
547
|
{
|
|
501
548
|
key: 'writer',
|
|
@@ -528,14 +575,20 @@ export class AiMessage {
|
|
|
528
575
|
'如何設定網站佈景主題?',
|
|
529
576
|
],
|
|
530
577
|
},
|
|
578
|
+
{
|
|
579
|
+
key: 'design',
|
|
580
|
+
data: ['家具電商平台宣傳圖,現代極簡主義,背景保持乾淨整潔',
|
|
581
|
+
'服飾店宣傳圖,模特背著名牌包,腳穿高跟鞋']
|
|
582
|
+
}
|
|
531
583
|
]
|
|
532
584
|
.find((dd) => {
|
|
533
585
|
return dd.key === AiMessage.vm.select_bt;
|
|
534
586
|
})) === null || _a === void 0 ? void 0 : _a.data.map((dd) => {
|
|
535
|
-
return html
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
587
|
+
return html `
|
|
588
|
+
<div
|
|
589
|
+
class="insignia insignia-secondary bgf6"
|
|
590
|
+
style="white-space: nowrap;cursor: pointer;"
|
|
591
|
+
onclick="${gvc.event(() => {
|
|
539
592
|
vm.ai_loading = true;
|
|
540
593
|
gvc.notifyDataChange('footer-ai');
|
|
541
594
|
Chat.postMessage({
|
|
@@ -549,14 +602,19 @@ export class AiMessage {
|
|
|
549
602
|
vm.message = '';
|
|
550
603
|
});
|
|
551
604
|
})}"
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
605
|
+
>
|
|
606
|
+
${dd}
|
|
607
|
+
</div>`;
|
|
555
608
|
}).join('')}
|
|
556
609
|
</div>
|
|
557
|
-
<div class="px-2 d-flex align-items-center w-100 border-0 px-2"
|
|
610
|
+
<div class="px-2 d-flex align-items-center w-100 border-0 px-2"
|
|
611
|
+
style="background: white;border-radius: 0px;">
|
|
558
612
|
${BgWidget.customButton({
|
|
559
|
-
button: {
|
|
613
|
+
button: {
|
|
614
|
+
color: 'snow',
|
|
615
|
+
size: 'sm',
|
|
616
|
+
style: 'min-height: 40px;'
|
|
617
|
+
},
|
|
560
618
|
icon: { name: 'fa-regular fa-broom-wide text-dark' },
|
|
561
619
|
text: { name: '重置' },
|
|
562
620
|
event: gvc.event(() => {
|
|
@@ -578,8 +636,9 @@ export class AiMessage {
|
|
|
578
636
|
}),
|
|
579
637
|
})}
|
|
580
638
|
${[
|
|
581
|
-
html
|
|
582
|
-
|
|
639
|
+
html `
|
|
640
|
+
<div class="position-relative w-100 mx-2">
|
|
641
|
+
${gvc.bindView(() => {
|
|
583
642
|
return {
|
|
584
643
|
bind: textAreaId,
|
|
585
644
|
view: () => {
|
|
@@ -612,12 +671,13 @@ export class AiMessage {
|
|
|
612
671
|
},
|
|
613
672
|
};
|
|
614
673
|
})}
|
|
615
|
-
|
|
616
|
-
html `
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
674
|
+
</div>`,
|
|
675
|
+
html `
|
|
676
|
+
<button
|
|
677
|
+
type="button"
|
|
678
|
+
class="btn btn-icon btn-lg d-sm-inline-flex ms-1 send-action"
|
|
679
|
+
style="height: 36px;background: ${AiMessage.config.color};"
|
|
680
|
+
onclick="${gvc.event(() => {
|
|
621
681
|
if (vm.message) {
|
|
622
682
|
vm.ai_loading = true;
|
|
623
683
|
gvc.notifyDataChange('footer-ai');
|
|
@@ -638,9 +698,9 @@ export class AiMessage {
|
|
|
638
698
|
else {
|
|
639
699
|
}
|
|
640
700
|
})}"
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
701
|
+
>
|
|
702
|
+
<i class="fa-regular fa-paper-plane-top"></i>
|
|
703
|
+
</button>`,
|
|
644
704
|
].join('')}
|
|
645
705
|
</div>
|
|
646
706
|
`;
|
|
@@ -651,13 +711,15 @@ export class AiMessage {
|
|
|
651
711
|
class: `d-flex flex-column w-100 position-fixed bottom-0 position-lg-absolute py-2 border-top bg-white`,
|
|
652
712
|
style: `gap:8px;${(parseInt(gvc.glitter.share.bottom_inset, 10)) ? `padding-bottom:${parseInt(gvc.glitter.share.bottom_inset, 10) + 10}px !important;` : ``}`,
|
|
653
713
|
},
|
|
654
|
-
onCreate: () => {
|
|
714
|
+
onCreate: () => {
|
|
715
|
+
},
|
|
655
716
|
};
|
|
656
717
|
})}
|
|
657
718
|
`;
|
|
658
719
|
},
|
|
659
720
|
divCreate: {},
|
|
660
|
-
onCreate: () => {
|
|
721
|
+
onCreate: () => {
|
|
722
|
+
},
|
|
661
723
|
onDestroy: () => {
|
|
662
724
|
vm.close = true;
|
|
663
725
|
socket.close();
|
|
@@ -680,13 +742,18 @@ export class AiMessage {
|
|
|
680
742
|
var _a, _b;
|
|
681
743
|
return html `
|
|
682
744
|
<div class=" card rounded-3">
|
|
683
|
-
<div class="p-3 rounded-top"
|
|
684
|
-
|
|
685
|
-
<
|
|
745
|
+
<div class="p-3 rounded-top"
|
|
746
|
+
style="width: 100%;white-space: normal;background: ${AiMessage.config.color};">
|
|
747
|
+
<div class="text-white fw-bold" style=" font-size: 20px;">
|
|
748
|
+
${(_a = AiMessage.config.title) !== null && _a !== void 0 ? _a : ''}
|
|
749
|
+
</div>
|
|
750
|
+
<p class=" text-white mt-2 mb-4"
|
|
751
|
+
style=" font-size: 16px;line-height: 22px;font-weight: 300;">
|
|
752
|
+
${((_b = AiMessage.config.content) !== null && _b !== void 0 ? _b : '').replace(/\n/g, `<br>`)}</p>
|
|
686
753
|
<button
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
754
|
+
class="btn w-100 rounded"
|
|
755
|
+
style=" background-color: rgba(0, 0, 0, 0.2);"
|
|
756
|
+
onclick="${gvc.event(() => {
|
|
690
757
|
goToChat('');
|
|
691
758
|
})}"
|
|
692
759
|
>
|
|
@@ -704,26 +771,32 @@ export class AiMessage {
|
|
|
704
771
|
const returnHtml = [];
|
|
705
772
|
const robot = (yield ApiUser.getPublicConfig('robot_auto_reply', 'manager')).response.value.question;
|
|
706
773
|
if (robot.length > 0) {
|
|
707
|
-
returnHtml.push(html `
|
|
708
|
-
<div class="
|
|
709
|
-
|
|
774
|
+
returnHtml.push(html `
|
|
775
|
+
<div class=" fw-bold"
|
|
776
|
+
style=" height: 60px;display: flex;align-items: center;justify-content: center;font-size: 16px;">
|
|
777
|
+
<div class="" style="color: black;">即時解答</div>
|
|
778
|
+
</div>`);
|
|
710
779
|
}
|
|
711
780
|
robot.map((dd) => {
|
|
712
|
-
returnHtml.push(html
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
781
|
+
returnHtml.push(html `
|
|
782
|
+
<div
|
|
783
|
+
class="rounded-3 w-100 d-flex px-3 btn-white-primary py-2 fw-500"
|
|
784
|
+
style=" "
|
|
785
|
+
onclick="${gvc.event(() => {
|
|
716
786
|
goToChat(dd.ask);
|
|
717
787
|
})}"
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
788
|
+
>
|
|
789
|
+
<div style="white-space: normal;" class="flex-fill">${dd.ask}</div>
|
|
790
|
+
<i class="fa-solid fa-paper-plane-top" style="font-size:18px;"
|
|
791
|
+
aria-hidden="true"></i>
|
|
792
|
+
</div>`);
|
|
722
793
|
});
|
|
723
794
|
resolve(returnHtml.join('') &&
|
|
724
|
-
html `
|
|
725
|
-
|
|
726
|
-
|
|
795
|
+
html `
|
|
796
|
+
<div class="px-3 pb-3"
|
|
797
|
+
style=" display: flex;flex-direction: column;align-items: center;justify-content: center;gap:10px;font-size: 16px;">
|
|
798
|
+
${returnHtml.join('')}
|
|
799
|
+
</div>`);
|
|
727
800
|
}));
|
|
728
801
|
},
|
|
729
802
|
divCreate: {
|
|
@@ -754,5 +827,7 @@ AiMessage.vm = {
|
|
|
754
827
|
select_bt: 'writer',
|
|
755
828
|
};
|
|
756
829
|
AiMessage.id = `dsmdklweew3`;
|
|
757
|
-
AiMessage.toggle = (visible) => {
|
|
830
|
+
AiMessage.toggle = (visible) => {
|
|
831
|
+
};
|
|
832
|
+
AiMessage.ai_support = [];
|
|
758
833
|
window.glitter.setModule(import.meta.url, AiMessage);
|