askbot-dragon 1.6.22-beta → 1.6.24-beta

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.
Files changed (90) hide show
  1. package/README.md +27 -27
  2. package/babel.config.js +6 -6
  3. package/dragon.iml +7 -7
  4. package/package.json +58 -59
  5. package/public/index.html +74 -74
  6. package/src/App.vue +31 -31
  7. package/src/api/index.js +1 -1
  8. package/src/api/mock.http +2 -2
  9. package/src/api/requestUrl.js +185 -185
  10. package/src/assets/js/AliyunlssUtil.js +92 -92
  11. package/src/assets/js/Base64Util.js +22 -22
  12. package/src/assets/js/common.js +75 -11
  13. package/src/assets/js/hammer.js +100 -89
  14. package/src/assets/js/script.js +36 -36
  15. package/src/assets/less/common.css +6773 -6773
  16. package/src/assets/less/converSationContainer/common.less +199 -192
  17. package/src/assets/less/converSationContainer/converSatonContainer.less +493 -493
  18. package/src/assets/less/iconfont.css +37 -37
  19. package/src/assets/less/ticketMessage.less +294 -294
  20. package/src/components/ActionAlertIframe.vue +177 -154
  21. package/src/components/AiGuide.vue +466 -468
  22. package/src/components/AnswerDocknowledge.vue +597 -556
  23. package/src/components/AnswerVoice.vue +285 -285
  24. package/src/components/AskIFrame.vue +15 -15
  25. package/src/components/ConversationContainer.vue +4969 -4820
  26. package/src/components/FileType.vue +86 -86
  27. package/src/components/Message.vue +27 -27
  28. package/src/components/actionSatisfaction.vue +107 -107
  29. package/src/components/actionSendToBot.vue +62 -62
  30. package/src/components/answerDissatisfaction.vue +62 -62
  31. package/src/components/answerRadio.vue +132 -132
  32. package/src/components/ask-components/DissatisfactionOptions.vue +57 -57
  33. package/src/components/ask-components/Msgloading.vue +37 -37
  34. package/src/components/ask-components/SatisfactionV2.vue +15 -15
  35. package/src/components/askVideo.vue +162 -142
  36. package/src/components/assetDetails.vue +370 -370
  37. package/src/components/assetMessage.vue +228 -228
  38. package/src/components/associationIntention.vue +355 -349
  39. package/src/components/attachmentPreview.vue +90 -90
  40. package/src/components/botActionSatisfactor.vue +68 -68
  41. package/src/components/chatContent.vue +513 -513
  42. package/src/components/feedBack.vue +136 -136
  43. package/src/components/fielListView.vue +351 -351
  44. package/src/components/file/AliyunOssComponents.vue +108 -108
  45. package/src/components/formTemplate.vue +3576 -3581
  46. package/src/components/kkview.vue +1138 -1138
  47. package/src/components/loadingProcess.vue +164 -164
  48. package/src/components/message/ActionAlertIframe.vue +112 -112
  49. package/src/components/message/ShopMessage.vue +164 -164
  50. package/src/components/message/TextMessage.vue +924 -924
  51. package/src/components/message/TicketMessage.vue +201 -201
  52. package/src/components/message/swiper/index.js +4 -4
  53. package/src/components/message/swiper/ticketSwiper.vue +503 -503
  54. package/src/components/message/swiper/ticketSwiperItem.vue +61 -61
  55. package/src/components/msgLoading.vue +231 -231
  56. package/src/components/myPopup.vue +70 -70
  57. package/src/components/newPdfPosition.vue +878 -0
  58. package/src/components/pdfPosition.vue +1508 -1328
  59. package/src/components/popup.vue +227 -227
  60. package/src/components/previewDoc.vue +242 -242
  61. package/src/components/previewPdf.vue +319 -302
  62. package/src/components/receiverMessagePlatform.vue +65 -65
  63. package/src/components/recommend.vue +80 -80
  64. package/src/components/selector/hOption.vue +20 -20
  65. package/src/components/selector/hSelector.vue +199 -199
  66. package/src/components/selector/hWrapper.vue +216 -216
  67. package/src/components/senderMessagePlatform.vue +50 -50
  68. package/src/components/source/BotMessage.vue +24 -24
  69. package/src/components/source/CustomMessage.vue +24 -24
  70. package/src/components/test.vue +260 -260
  71. package/src/components/tree.vue +294 -294
  72. package/src/components/utils/AliyunIssUtil.js +81 -81
  73. package/src/components/utils/ckeditor.js +174 -177
  74. package/src/components/utils/ckeditorImageUpload/command.js +109 -111
  75. package/src/components/utils/ckeditorImageUpload/editing.js +11 -11
  76. package/src/components/utils/ckeditorImageUpload/plugin-image.js +11 -11
  77. package/src/components/utils/ckeditorImageUpload/toolbar-ui.js +40 -40
  78. package/src/components/utils/ckeditorfileUpload/common.js +181 -174
  79. package/src/components/utils/ckeditorfileUpload/editing.js +11 -11
  80. package/src/components/utils/ckeditorfileUpload/plugin_file.js +11 -11
  81. package/src/components/utils/ckeditorfileUpload/toolbar_ui.js +35 -35
  82. package/src/components/utils/format_date.js +25 -25
  83. package/src/components/utils/index.js +6 -6
  84. package/src/components/utils/math_utils.js +29 -29
  85. package/src/components/voiceComponent.vue +119 -119
  86. package/src/components/welcomeKnowledgeFile.vue +230 -0
  87. package/src/components/welcomeLlmCard.vue +139 -0
  88. package/src/main.js +60 -60
  89. package/vue.config.js +55 -55
  90. package/src/assets/js/obsBrowser.js +0 -63
@@ -1,557 +1,598 @@
1
- <template>
2
- <div class="answer-docknowledge">
3
- <div :class="['answer-docknowledge-header',msg.content.isKnowledgeSummary ? 'bgc' : '']">
4
- <div v-if="msg.content.isKnowledgeSummary" class="tips">AI为您总结生成了以下摘要</div>
5
- <div v-if="msg.content.type == 0" class="answer-text">
6
- <template v-if="msg.content.renderType == 1">
7
- <p v-html="msg.content.text"></p>
8
- </template>
9
- <template v-else>
10
- {{ msg.content.text }}
11
- </template>
12
- </div>
13
- <div v-if="msg.content.type == 1" class="answer-text">
14
- <template v-if="msg.content.renderType == 1">
15
- <p v-html="msg.content.text"></p>
16
- </template>
17
- <template v-else>
18
- {{ msg.content.text }}
19
- </template>
20
- </div>
21
- <div v-if="msg.content.images && msg.content.images.length != 0" class="answer-kn-image-box">
22
- <img v-for="(imageItem, imageItemIndex) in msg.content.images" style='max-width: 230px;border-radius: 25px;margin-bottom: 15px' :src="imageItem.url" :key="imageItemIndex" alt="" @click="lookAttach(imageItem.url, imageItem, $event)">
23
- </div>
24
- </div>
25
- <div class="ad-list">
26
- <div v-for="(item, itemIndex) in msg.content.list" :style="{paddingBottom: itemIndex === msg.content.list.length - 1?0:'10px'}" :key="itemIndex" class="ad-list-cell">
27
- <div class="alc-title">
28
- <div class="alc-box">
29
- <div class="alc-source-left">
30
- <span class="source-form">出自</span>
31
- <img class="alc-title-icon" height="24px" width="24px" :src="item.src" alt="" srcset="">
32
- <span class="alc-title-from">{{ item.from }}</span>
33
- </div>
34
-
35
- </div>
36
- <div v-html="item.introduction" v-if="!srcContentTypeIMG(item)" class="alc-box-introduction">
37
- </div>
38
- <div v-else class="alc-box-introduction">
39
- <img :src="item.expiredUrl" alt="" @click="lookAttach(item.url, item, $event)">
40
- </div>
41
- <div v-if="item.previewImage" class="alc-box-introduction-previewImage">
42
- <img :src="item.previewImage" alt="" @click="lookAttach(item.previewImage, {url: item.previewImage}, $event)">
43
- </div>
44
- <div class="alc-updateTime">
45
- <div v-show="docSource[item.source]" class="upload-source">
46
- {{docSource[item.source]}}
47
- </div>
48
- <div v-show="item.url" class="alc-content-text">
49
- <span @click="lookAttach(item.url, item, $event)" class="aci-view">查看 ></span>
50
- </div>
51
- <!-- <div class="time">
52
- <span>更新时间:</span>
53
- {{ new Date(item.updateTime).Format('MM-dd hh:mm') }}
54
- </div> -->
55
- </div>
56
- <!-- <span v-if="isPC" class="alc-title-updateTime">最后更新时间: {{ item.updateTime }}</span>-->
57
- </div>
58
- <div class="alc-content" v-if="false">
59
- <div v-if="msg.content.type == 1" class="alc-content-text">{{ item.introduction }} <span
60
- @click="lookAttach(item.url, item, $event)" class="aci-view">查看原文 ></span>
61
- </div>
62
- <span v-if="!isPC" class="alc-title-updateTime">最后更新时间: {{ item.updateTime }}</span>
63
- <div v-if="false" class="alc-content-info">
64
- <div class="alcc-box">
65
- <span class="aci-owner">所有者: {{ item.owner }}</span>
66
- <span class="aci-enterprise">所属企业: {{ item.enterprise }}</span>
67
- <span class="aci-source">文件来源: {{ item.source }}</span>
68
- </div>
69
- </div>
70
- </div>
71
- </div>
72
- <div class="ad-loadmore" v-if="loadMoreFlag" @click="lazyLoadKnowledegList">
73
- 查看更多
74
- </div>
75
- </div>
76
- <previewPdf ref="previewPdf" :url="previewHref" :sourceFileType="sourceFileType" officePreviewType="pdf"></previewPdf>
77
- </div>
78
- </template>
79
-
80
- <script>
81
- /* eslint-disable */
82
- import previewPdf from "./previewPdf";
83
- import { isMobile } from "../assets/js/common";
84
- export default {
85
- name: "answerDocknowledge",
86
- components: { previewPdf },
87
- data() {
88
- return {
89
- isPC: true,
90
- previewHref: "",
91
- sourceFileType:'',
92
- docSource: {
93
- LOCAL_FILE: "来源于本地文件",
94
- CREATED_BY_ONESELF: "来源于自建知识",
95
- WECHAT: "来源于微信",
96
- AUTO_SYN_FROM_LOCAL_FILE: "自动同步于本地",
97
- YUQUE: "来源于语雀",
98
- CORP_LOCAL_FILE:'来源于企业知识库',
99
- FEISHU:'来源于飞书-云文档'
100
- },
101
- imageObj: {
102
- PDF: 'pdf1',
103
- pdf: 'pdf1',
104
- TXT: 'txt1',
105
- txt: 'txt1',
106
- selfadd: 'selfadd1',
107
- md: "md2",
108
- html: 'selfadd1',
109
- mode: "mode",
110
- general: 'general',
111
- word: "word1",
112
- Word: "word1",
113
- docx: "word1",
114
- doc: "word1",
115
- WORD: "word1",
116
- Excel: 'excel1',
117
- EXCEL: 'excel1',
118
- excel: 'excel1',
119
- PPT: 'ppt1',
120
- ppt: 'ppt1',
121
- pptx: 'ppt1',
122
- img: "image1",
123
- image: "image1",
124
- video: "video",
125
- audio: 'audio',
126
- link: "link",
127
- wechat: "wechat",
128
- mp4: "video",
129
- MP4: "video",
130
- xlsx: "excel1",
131
- SLSX: "excel1",
132
- xls: "excel1",
133
- XLS: "excel1",
134
- jpg: "image1",
135
- JPG: "image1",
136
- jpeg: "image1",
137
- JPEG: "image1",
138
- png: "image1",
139
- PNG: "image1",
140
- webp: "image1",
141
- WEBP: "image1",
142
- gif: "image1",
143
- GIF: "image1",
144
- svg: "image1",
145
- SVG: "image1",
146
- bmp: "image1",
147
- BMP: "image1",
148
- avi: "video",
149
- AVI: "video",
150
- mov: "video",
151
- MOV: "video",
152
- rmvb: "video",
153
- RMVB: "video",
154
- wav: "audio",
155
- WAV: "audio",
156
- mp3: "audio",
157
- MP3: "audio",
158
- yqhtml: "yqhtml",
159
- feishuhtml:"feishuhtml"
160
- },
161
- allKnowledgeList:[],
162
- loadMoreFlag:false
163
- }
164
- },
165
- props: ['msg','isAskLightning', 'isMessageRecord',"isApp"],
166
- beforeMounted() {
167
- },
168
- watch:{
169
- msg:{
170
- handler(n){
171
- console.log(n,'answerDocknowledge');
172
- n.content.list.forEach(element => {
173
- console.log(this.imageObj[element.format],1111);
174
- element.src = 'https://static.guoranbot.com/cdn-office-website/askbot_doc/' + this.imageObj[element.format] + '.png';
175
- if ((element.format === "txt" || element.format === "html") && element.source === "WECHAT") {
176
- element.src = 'https://static.guoranbot.com/cdn-office-website/askbot_doc/wechat.png';
177
- }
178
- });
179
- },
180
- deep:true,
181
- immediate:true
182
- }
183
- },
184
- created() {
185
- var system = {};
186
- system.pingtai = /(Win32|Win16|WinCE|Mac68K|MacIntel|MacIntel|MacPPC|Linux mips64)/i.test(navigator.platform);
187
- if (system.pingtai) {
188
- //电脑
189
- this.isPC = true;
190
- } else {
191
- //手机
192
- this.isPC = false;
193
- }
194
- // this.msg.content.list.forEach(element => {
195
- // console.log(this.imageObj[element.format],1111);
196
- // element.src = 'https://static.guoranbot.com/cdn-office-website/askbot_doc/' + this.imageObj[element.format] + '.png';
197
- // if ((element.format === "txt" || element.format === "html") && element.source === "WECHAT") {
198
- // element.src = 'https://static.guoranbot.com/cdn-office-website/askbot_doc/wechat.png';
199
- // }
200
- // });
201
- },
202
- mounted() {
203
- console.log(this.msg.content,'this.msg.content');
204
- // if(this.msg.content.type == 1) {
205
-
206
- // }
207
- if(this.msg.content.list && this.msg.content.list.length > 0) {
208
- this.loadMoreFlag = true
209
- this.allKnowledgeList = JSON.parse(JSON.stringify(this.msg.content.list))
210
- // console.log(this.allKnowledgeList.length, 'this.allKnowledgeList');
211
- this.msg.content.list = []
212
- this.lazyLoadKnowledegList()
213
- }
214
- },
215
- methods: {
216
- //预览图片
217
- lookAttach(url, item, event) {
218
- event.preventDefault();
219
- if (this.isAskLightning == 1 && !this.isApp){
220
- window.parent.postMessage({
221
- data: "bot_preview",
222
- item: JSON.stringify(item),
223
- url: url
224
- },"*");
225
- } else {
226
- // if (isMobile()) {
227
- // this.$refs.previewPdf.drawer = true;
228
- // this.$refs.previewPdf.previewShowPopup = false;
229
- // } else {
230
- // this.$refs.previewPdf.drawer = false;
231
- // }
232
- this.$refs.previewPdf.previewShowPopup = false;
233
- this.$refs.previewPdf.drawer = false;
234
- let index = url.lastIndexOf('?')
235
- let type = ''
236
- let httpUrl = '/knowledge-api/knowledge/getTemporaryCertificate'
237
- if (index !== -1) {
238
- url = url.substring(0, index)
239
- type = this.fileType(url)
240
- } else {
241
- type = this.fileType(url)
242
- }
243
- if (type === '' || type === 'OTHER') {
244
- httpUrl = httpUrl += '?needEncrypt=true'
245
- } else {
246
- httpUrl = httpUrl += '?needEncrypt=false'
247
- }
248
- this.$http.post(httpUrl, {
249
- "fileInOssPath":url
250
- }).then(res =>{
251
- if(res.data.code == '0') {
252
- this.previewHref = res.data.data;
253
- this.sourceFileType = url.substring(url.lastIndexOf('.'))
254
- let isOhmPc = sessionStorage.getItem('isOhmPc')
255
- if (isMobile() || isOhmPc == 'true'){
256
- this.$refs.previewPdf.drawer = true;
257
- this.$refs.previewPdf.previewShowPopup = true;
258
- } else {
259
- this.$refs.previewPdf.previewShowPopup = false;
260
- this.$refs.previewPdf.drawer = true;
261
- }
262
- this.$refs.previewPdf.fileType = type
263
- this.$refs.previewPdf.tagIds = item.tagIds
264
- this.$refs.previewPdf.isMessageRecord = this.isMessageRecord ? true : false
265
- if(item.tagIds && item.tagIds.length != 0) {
266
- this.$refs.previewPdf.loading = false
267
- return
268
- }
269
- this.$nextTick(() =>{
270
- if(item.source == 'CREATED_BY_ONESELF' || type === 'HTML') {
271
- this.$refs.previewPdf.getBolb(item)
272
- }
273
- this.$refs.previewPdf.loadIframe(item)
274
- })
275
- }
276
- })
277
- }
278
- },
279
- fileType (url) {
280
- const fileType = url.substring(url.lastIndexOf('.'));
281
- if (fileType === '.mp4' || fileType === '.MP4' || fileType === '.MOV' || fileType === '.MOVC' || fileType === '.mov' || fileType === '.movc' || fileType === '.mav' || fileType === '.MAV' || fileType == '.mp3' || fileType == '.MP3' || fileType === '.wav') {
282
- return 'VIDEO'
283
- } else if (fileType === '.html') {
284
- return 'HTML'
285
- } else {
286
- return 'OTHER'
287
- }
288
- },
289
- srcContentTypeIMG(item) {
290
- let url = item.url || '';
291
- const type = url.substring(url.lastIndexOf('.'));
292
- if(type === '.jpg' || type === '.jpeg' || type === '.png' || type === '.gif') {
293
- this.getSrc(item)
294
- return true
295
- } else {
296
- return false
297
- }
298
- },
299
- getSrc (item) {
300
- // let imgurl = ''
301
- this.$http.post(
302
- '/knowledge-api/temporary-certificate/or-origin?expired=30',
303
- item.url,
304
- {
305
- headers: {
306
- "Content-Type": "application/json",
307
- },
308
- }).then( res => {
309
- console.log(res,'=====');
310
- // imgurl = await res.bodyText
311
- this.$set(item,'expiredUrl',res.data ? res.data : res.bodyText)
312
- // return res.data
313
- })
314
- // return imgurl
315
- },
316
- lazyLoadKnowledegList() {
317
- if(this.allKnowledgeList.length !== 0) {
318
- let arr = this.allKnowledgeList.splice(0, 5)
319
- if(arr.length < 5) {
320
- this.loadMoreFlag = false
321
- this.msg.content.list = [...this.msg.content.list, ...arr]
322
- return
323
- }
324
- if(this.allKnowledgeList.length == 0) {
325
- this.loadMoreFlag = false
326
- }
327
- this.msg.content.list = [...this.msg.content.list, ...arr]
328
- return
329
- }
330
- }
331
- }
332
- }
333
- </script>
334
-
335
- <style scoped lang="less">
336
- .answer-docknowledge {
337
- min-width: 100px;
338
- .answer-docknowledge-header{
339
-
340
-
341
- .tips{
342
- width: 154px;
343
- height: 22px;
344
- background: #366AFF;
345
- border-radius: 5px;
346
- text-align: center;
347
- line-height: 22px;
348
- color: #fff;
349
- font-size: 12px;
350
- margin-bottom: 7px;
351
- }
352
- .answer-text {
353
- // font-size: 13px;
354
- text-align: left;
355
- line-height: 25px;
356
- padding: 0px 0px 12px 0px;
357
-
358
- .aci-view {
359
- // font-size: 13px;
360
- display: inline-block;
361
- // margin-left: 5px;
362
- color: #366aff;
363
- cursor: pointer;
364
- }
365
- }
366
- &.bgc{
367
- padding: 10px;
368
- background: #EEF1FF;
369
- border-radius: 10px;
370
- margin-bottom: 16px;
371
- .answer-text {
372
- padding: 0;
373
- }
374
- }
375
- }
376
-
377
- .ad-list {
378
- .ad-list-cell {
379
- border-top: solid 1px #EEEEEE;
380
- padding: 10px 0 10px;
381
-
382
- .alc-title {
383
- display: flex;
384
- flex-wrap: wrap;
385
- align-items: center;
386
- justify-content: space-between;
387
- line-height: 16px;
388
-
389
- .alc-box {
390
- display: flex;
391
- align-items: center;
392
- justify-content: space-between;
393
- // font-size: 12px;
394
- width: 100%;
395
- .alc-source-left{
396
- display: flex;
397
- align-items: center;
398
- .source-form{
399
- width: 34px;
400
- flex: none;
401
- color: #A9B3C6;
402
- }
403
- }
404
- .alc-content-text{
405
- width: 55px;
406
- flex: none;
407
- .aci-view{
408
- color: #366aff;
409
- cursor: pointer;
410
- }
411
- }
412
- .alc-title-from {
413
- line-height: 22px;
414
- word-break: break-all !important;
415
- text-align: left;
416
- flex: auto;
417
- display: flex;
418
- justify-content: flex-start;
419
- }
420
- }
421
- .alc-box-introduction{
422
- overflow: hidden;
423
- text-overflow: ellipsis;
424
- display: -webkit-box;
425
- -webkit-line-clamp:3;
426
- -webkit-box-orient:vertical;
427
- margin-top: 10px;
428
- color: #616161;
429
- // font-size: 12px;
430
- line-height: 24px;
431
- text-align: left;
432
- img {
433
- width: 50px;
434
- height: 50px;
435
- margin: 10px;
436
- cursor: pointer;
437
- }
438
- }
439
- .alc-box-introduction-previewImage {
440
- overflow: hidden;
441
- text-overflow: ellipsis;
442
- display: -webkit-box;
443
- -webkit-line-clamp:3;
444
- -webkit-box-orient:vertical;
445
- margin-top: 10px;
446
- color: #616161;
447
- // font-size: 12px;
448
- line-height: 24px;
449
- text-align: left;
450
- img {
451
- max-width: 300px;
452
- width: 100%;
453
- max-height: 150px;
454
- margin: 10px;
455
- cursor: pointer;
456
- }
457
- }
458
- .alc-updateTime{
459
- display: flex;
460
- align-items: center;
461
- justify-content: space-between;
462
- font-size: 13px;
463
- width: 100%;
464
- margin-top: 10px;
465
- .upload-source{
466
- flex: none;
467
- height: 18px;
468
- line-height: 18px;
469
- background: #E9F9F8;
470
- border: 1px solid #AFF2CD;
471
- border-radius: 2px;
472
- display: flex;
473
- align-items: center;
474
- justify-content: center;
475
- padding: 0 8px;
476
- color: #00C2BB;
477
- }
478
- .time{
479
- color: #999999;
480
- margin-left: 10px;
481
- }
482
- .alc-content-text {
483
- color: #366aff;
484
- cursor: pointer;
485
- }
486
- }
487
- .alc-title-icon {
488
- margin: 0 2px;
489
- width: 18px;
490
- height: 18px;
491
- flex: none;
492
- }
493
-
494
- .alc-title-updateTime {
495
- text-align: right;
496
- color: #999999;
497
- // font-size: 13px;
498
- }
499
- }
500
-
501
- .alc-content {
502
- .alc-title-updateTime {
503
- margin-top: 6px;
504
- display: block;
505
- text-align: right;
506
- color: #999999;
507
- // font-size: 13px;
508
- }
509
-
510
- .alc-content-text {
511
- margin-bottom: 6px;
512
- width: 55px;
513
- flex: none;
514
- .aci-view {
515
- display: inline-block;
516
- margin-left: 30px;
517
- color: #366aff;
518
- cursor: pointer;
519
- }
520
- }
521
-
522
- .alc-content-info {
523
- display: flex;
524
- flex-wrap: wrap;
525
- justify-content: space-between;
526
-
527
- .alcc-box {
528
- display: flex;
529
- flex-wrap: wrap;
530
- color: #999999;
531
-
532
- .aci-owner {
533
- margin-right: 20px;
534
- }
535
-
536
- .aci-enterprise {
537
- margin-right: 20px;
538
- }
539
- }
540
- }
541
- }
542
- }
543
- .ad-loadmore {
544
- width: 100%;
545
- height: 40px;
546
- display: flex;
547
- align-items: center;
548
- justify-content: center;
549
- // background: #FFFFFF;
550
- color: #366AFF;
551
- font-size: 14px;
552
- margin-top: 8px;
553
- cursor: pointer;
554
- }
555
- }
556
- }
1
+ <template>
2
+ <div class="answer-docknowledge">
3
+ <div :class="['answer-docknowledge-header',msg.content.isKnowledgeSummary ? 'bgc' : '']">
4
+ <div v-if="msg.content.isKnowledgeSummary" class="tips">AI为您总结生成了以下摘要</div>
5
+ <div v-if="msg.content.type == 0" class="answer-text">
6
+ <template v-if="msg.content.renderType == 1">
7
+ <p v-html="msg.content.text"></p>
8
+ </template>
9
+ <template v-else>
10
+ {{ msg.content.text }}
11
+ </template>
12
+ </div>
13
+ <div v-if="msg.content.type == 1" class="answer-text">
14
+ <template v-if="msg.content.renderType == 1">
15
+ <p v-html="msg.content.text"></p>
16
+ </template>
17
+ <template v-else>
18
+ {{ msg.content.text }}
19
+ </template>
20
+ </div>
21
+ <div v-if="msg.content.images && msg.content.images.length != 0" class="answer-kn-image-box">
22
+ <img v-for="(imageItem, imageItemIndex) in msg.content.images" style='max-width: 230px;border-radius: 25px;margin-bottom: 15px' :src="imageItem.url" :key="imageItemIndex" alt="" @click="lookAttach(imageItem.url, imageItem, $event)">
23
+ </div>
24
+ </div>
25
+ <div class="ad-list">
26
+ <div v-for="(item, itemIndex) in msg.content.list" :style="{paddingBottom: itemIndex === msg.content.list.length - 1?0:'10px'}" :key="itemIndex" class="ad-list-cell">
27
+ <div class="alc-title">
28
+ <div class="alc-box">
29
+ <div class="alc-source-left">
30
+ <span class="source-form">出自</span>
31
+ <img class="alc-title-icon" height="24px" width="24px" :src="item.src" alt="" srcset="">
32
+ <span class="alc-title-from">{{ item.from }}</span>
33
+ </div>
34
+
35
+ </div>
36
+ <div v-html="item.introduction" v-if="!srcContentTypeIMG(item)" class="alc-box-introduction">
37
+ </div>
38
+ <div v-else class="alc-box-introduction">
39
+ <img :src="item.expiredUrl" alt="" @click="lookAttach(item.url, item, $event)">
40
+ </div>
41
+ <div v-if="item.previewImage" class="alc-box-introduction-previewImage">
42
+ <img :src="item.previewImage" alt="" @click="lookAttach(item.previewImage, {url: item.previewImage}, $event)">
43
+ </div>
44
+ <div class="alc-updateTime">
45
+ <div v-show="docSource[item.source]" class="upload-source">
46
+ {{docSource[item.source]}}
47
+ </div>
48
+ <div v-show="item.url" class="alc-content-text">
49
+ <span @click="lookAttach(item.url, item, $event)" class="aci-view">查看 ></span>
50
+ </div>
51
+ <!-- <div class="time">
52
+ <span>更新时间:</span>
53
+ {{ new Date(item.updateTime).Format('MM-dd hh:mm') }}
54
+ </div> -->
55
+ </div>
56
+ <!-- <span v-if="isPC" class="alc-title-updateTime">最后更新时间: {{ item.updateTime }}</span>-->
57
+ </div>
58
+ <div class="alc-content" v-if="false">
59
+ <div v-if="msg.content.type == 1" class="alc-content-text">{{ item.introduction }} <span
60
+ @click="lookAttach(item.url, item, $event)" class="aci-view">查看原文 ></span>
61
+ </div>
62
+ <span v-if="!isPC" class="alc-title-updateTime">最后更新时间: {{ item.updateTime }}</span>
63
+ <div v-if="false" class="alc-content-info">
64
+ <div class="alcc-box">
65
+ <span class="aci-owner">所有者: {{ item.owner }}</span>
66
+ <span class="aci-enterprise">所属企业: {{ item.enterprise }}</span>
67
+ <span class="aci-source">文件来源: {{ item.source }}</span>
68
+ </div>
69
+ </div>
70
+ </div>
71
+ </div>
72
+ <div class="ad-loadmore" v-if="loadMoreFlag" @click="lazyLoadKnowledegList">
73
+ 查看更多
74
+ </div>
75
+ </div>
76
+ <previewPdf ref="previewPdf" :url="previewHref" :watermark="watermark" :sourceFileType="sourceFileType" officePreviewType="pdf"></previewPdf>
77
+ </div>
78
+ </template>
79
+
80
+ <script>
81
+ /* eslint-disable */
82
+ import previewPdf from "./previewPdf";
83
+ import { isMobile } from "../assets/js/common";
84
+ export default {
85
+ name: "answerDocknowledge",
86
+ components: { previewPdf },
87
+ data() {
88
+ return {
89
+ isPC: true,
90
+ previewHref: "",
91
+ sourceFileType:'',
92
+ docSource: {
93
+ LOCAL_FILE: "来源于本地文件",
94
+ CREATED_BY_ONESELF: "来源于自建知识",
95
+ WECHAT: "来源于微信",
96
+ AUTO_SYN_FROM_LOCAL_FILE: "自动同步于本地",
97
+ YUQUE: "来源于语雀",
98
+ CORP_LOCAL_FILE:'来源于企业知识库',
99
+ FEISHU:'来源于飞书-云文档'
100
+ },
101
+ imageObj: {
102
+ PDF: 'pdf1',
103
+ pdf: 'pdf1',
104
+ TXT: 'txt1',
105
+ txt: 'txt1',
106
+ selfadd: 'selfadd1',
107
+ md: "md2",
108
+ html: 'selfadd1',
109
+ mode: "mode",
110
+ general: 'general',
111
+ word: "word1",
112
+ Word: "word1",
113
+ docx: "word1",
114
+ doc: "word1",
115
+ WORD: "word1",
116
+ Excel: 'excel1',
117
+ EXCEL: 'excel1',
118
+ excel: 'excel1',
119
+ PPT: 'ppt1',
120
+ ppt: 'ppt1',
121
+ pptx: 'ppt1',
122
+ img: "image1",
123
+ image: "image1",
124
+ video: "video",
125
+ audio: 'audio',
126
+ link: "link",
127
+ wechat: "wechat",
128
+ mp4: "video",
129
+ MP4: "video",
130
+ xlsx: "excel1",
131
+ SLSX: "excel1",
132
+ xls: "excel1",
133
+ XLS: "excel1",
134
+ jpg: "image1",
135
+ JPG: "image1",
136
+ jpeg: "image1",
137
+ JPEG: "image1",
138
+ png: "image1",
139
+ PNG: "image1",
140
+ webp: "image1",
141
+ WEBP: "image1",
142
+ gif: "image1",
143
+ GIF: "image1",
144
+ svg: "image1",
145
+ SVG: "image1",
146
+ bmp: "image1",
147
+ BMP: "image1",
148
+ avi: "video",
149
+ AVI: "video",
150
+ mov: "video",
151
+ MOV: "video",
152
+ rmvb: "video",
153
+ RMVB: "video",
154
+ wav: "audio",
155
+ WAV: "audio",
156
+ mp3: "audio",
157
+ MP3: "audio",
158
+ yqhtml: "yqhtml",
159
+ feishuhtml:"feishuhtml"
160
+ },
161
+ watermark: {
162
+ textWatermarkValue:'',
163
+ visitorWatermarkValue:'',
164
+ source:""
165
+ },
166
+ allKnowledgeList:[],
167
+ loadMoreFlag:false
168
+ }
169
+ },
170
+ props: ['msg','isAskLightning', 'isMessageRecord',"isApp"],
171
+ beforeMounted() {
172
+ },
173
+ watch:{
174
+ msg:{
175
+ handler(n){
176
+ console.log(n,'answerDocknowledge');
177
+ n.content.list.forEach(element => {
178
+ console.log(this.imageObj[element.format],1111);
179
+ element.src = 'https://static.guoranbot.com/cdn-office-website/askbot_doc/' + this.imageObj[element.format] + '.png';
180
+ if ((element.format === "txt" || element.format === "html") && element.source === "WECHAT") {
181
+ element.src = 'https://static.guoranbot.com/cdn-office-website/askbot_doc/wechat.png';
182
+ }
183
+ });
184
+ },
185
+ deep:true,
186
+ immediate:true
187
+ }
188
+ },
189
+ created() {
190
+ var system = {};
191
+ system.pingtai = /(Win32|Win16|WinCE|Mac68K|MacIntel|MacIntel|MacPPC|Linux mips64)/i.test(navigator.platform);
192
+ if (system.pingtai) {
193
+ //电脑
194
+ this.isPC = true;
195
+ } else {
196
+ //手机
197
+ this.isPC = false;
198
+ }
199
+ // this.msg.content.list.forEach(element => {
200
+ // console.log(this.imageObj[element.format],1111);
201
+ // element.src = 'https://static.guoranbot.com/cdn-office-website/askbot_doc/' + this.imageObj[element.format] + '.png';
202
+ // if ((element.format === "txt" || element.format === "html") && element.source === "WECHAT") {
203
+ // element.src = 'https://static.guoranbot.com/cdn-office-website/askbot_doc/wechat.png';
204
+ // }
205
+ // });
206
+ },
207
+ mounted() {
208
+ console.log(this.msg.content,'this.msg.content');
209
+ // if(this.msg.content.type == 1) {
210
+
211
+ // }
212
+ if(this.msg.content.list && this.msg.content.list.length > 0) {
213
+ this.loadMoreFlag = true
214
+ this.allKnowledgeList = JSON.parse(JSON.stringify(this.msg.content.list))
215
+ // console.log(this.allKnowledgeList.length, 'this.allKnowledgeList');
216
+ this.msg.content.list = []
217
+ this.lazyLoadKnowledegList()
218
+ }
219
+ },
220
+ methods: {
221
+ //预览图片
222
+ lookAttach(url, item, event) {
223
+ // console.log(item.knowledgeId);
224
+ // this.$http.get("/knowledge-api/internal/knowledgeBaseStructure/" + "642ffbccde420e2772f7787b")
225
+ // debugger
226
+ event.preventDefault();
227
+ if (this.isAskLightning == 1 && !this.isApp){
228
+ window.parent.postMessage({
229
+ data: "bot_preview",
230
+ item: JSON.stringify(item),
231
+ url: url
232
+ },"*");
233
+ } else {
234
+ // if (isMobile()) {
235
+ // this.$refs.previewPdf.drawer = true;
236
+ // this.$refs.previewPdf.previewShowPopup = false;
237
+ // } else {
238
+ // this.$refs.previewPdf.drawer = false;
239
+ // }
240
+ this.$refs.previewPdf.previewShowPopup = false;
241
+ this.$refs.previewPdf.drawer = false;
242
+ let index = url.lastIndexOf('?')
243
+ let type = ''
244
+ let httpUrl = '/knowledge-api/knowledge/getTemporaryCertificate'
245
+ if (index !== -1) {
246
+ url = url.substring(0, index)
247
+ type = this.fileType(url)
248
+ } else {
249
+ type = this.fileType(url)
250
+ }
251
+ if (type === '' || type === 'OTHER') {
252
+ httpUrl = httpUrl += '?needEncrypt=true'
253
+ } else {
254
+ httpUrl = httpUrl += '?needEncrypt=false'
255
+ }
256
+ this.$http.post(httpUrl, {
257
+ "fileInOssPath":url
258
+ }).then(async res =>{
259
+ if(res.data.code == '0') {
260
+ this.watermark = await this.getknowledgeBaseStructure(item.knowledgeId);
261
+ this.watermark.source = item.source;
262
+ this.previewHref = res.data.data;
263
+ this.sourceFileType = url.substring(url.lastIndexOf('.'))
264
+ let isOhmPc = sessionStorage.getItem('isOhmPc')
265
+ if (isMobile() || isOhmPc == 'true'){
266
+ this.$refs.previewPdf.drawer = true;
267
+ this.$refs.previewPdf.previewShowPopup = true;
268
+ } else {
269
+ this.$refs.previewPdf.previewShowPopup = false;
270
+ this.$refs.previewPdf.drawer = true;
271
+ }
272
+ this.$refs.previewPdf.fileType = type
273
+ this.$refs.previewPdf.tagIds = item.tagIds
274
+ this.$refs.previewPdf.isMessageRecord = this.isMessageRecord ? true : false ;
275
+ let index = url.indexOf("?");
276
+ let newFileInOssPath = url;
277
+ if (index !== -1){
278
+ newFileInOssPath = url.substring(0, url.indexOf("?"))
279
+ }
280
+ let fileName = newFileInOssPath.substring(newFileInOssPath.lastIndexOf('.'))
281
+ if (fileName === '.doc' || fileName === '.docx' || fileName === '.txt'|| fileName === '.html'){
282
+ this.$refs.previewPdf.fileName = fileName;
283
+ } else {
284
+ this.$refs.previewPdf.fileName = '';
285
+ }
286
+ if(item.tagIds && item.tagIds.length != 0) {
287
+ this.$refs.previewPdf.loading = false
288
+ return
289
+ }
290
+ this.$nextTick(() =>{
291
+ if(item.source == 'CREATED_BY_ONESELF' || type === 'HTML') {
292
+ this.$refs.previewPdf.getBolb(item)
293
+ }
294
+ this.$refs.previewPdf.loadIframe(item)
295
+ })
296
+ }
297
+ })
298
+ }
299
+ },
300
+ fileType (url) {
301
+ const fileType = url.substring(url.lastIndexOf('.'));
302
+ if (fileType === '.mp4' || fileType === '.MP4' || fileType === '.MOV' || fileType === '.MOVC' || fileType === '.mov' || fileType === '.movc' || fileType === '.mav' || fileType === '.MAV' || fileType == '.mp3' || fileType == '.MP3' || fileType === '.wav') {
303
+ return 'VIDEO'
304
+ } else if (fileType === '.html') {
305
+ return 'HTML'
306
+ } else {
307
+ return 'OTHER'
308
+ }
309
+ },
310
+ srcContentTypeIMG(item) {
311
+ let url = item.url || '';
312
+ const type = url.substring(url.lastIndexOf('.'));
313
+ if(type === '.jpg' || type === '.jpeg' || type === '.png' || type === '.gif') {
314
+ this.getSrc(item)
315
+ return true
316
+ } else {
317
+ return false
318
+ }
319
+ },
320
+ getSrc (item) {
321
+ // let imgurl = ''
322
+ this.$http.post(
323
+ '/knowledge-api/temporary-certificate/or-origin?expired=30',
324
+ item.url,
325
+ {
326
+ headers: {
327
+ "Content-Type": "application/json",
328
+ },
329
+ }).then( res => {
330
+ console.log(res,'=====');
331
+ // imgurl = await res.bodyText
332
+ this.$set(item,'expiredUrl',res.data ? res.data : res.bodyText)
333
+ // return res.data
334
+ })
335
+ // return imgurl
336
+ },
337
+ async getknowledgeBaseStructure(knowledgeId) {
338
+ let watermark = {
339
+ textWatermarkValue:'',
340
+ visitorWatermarkValue:''
341
+ }
342
+ await this.$http.get("/knowledge-api/internal/knowledgeBaseStructure/" + knowledgeId).then( async res =>{
343
+ if(res.data) {
344
+ watermark.textWatermarkValue = await res.data.textWatermarkValue
345
+ if(res.data.visitorWatermark) {
346
+ let userInfo = sessionStorage.getItem('userInfo') || localStorage.getItem('userInfo')
347
+ if(userInfo && userInfo !== 'null') {
348
+ watermark.visitorWatermarkValue = JSON.parse(userInfo).realName
349
+ }
350
+ }
351
+ }
352
+ })
353
+ return watermark
354
+ },
355
+ lazyLoadKnowledegList() {
356
+ if(this.allKnowledgeList.length !== 0) {
357
+ let arr = this.allKnowledgeList.splice(0, 5)
358
+ if(arr.length < 5) {
359
+ this.loadMoreFlag = false
360
+ this.msg.content.list = [...this.msg.content.list, ...arr]
361
+ return
362
+ }
363
+ if(this.allKnowledgeList.length == 0) {
364
+ this.loadMoreFlag = false
365
+ }
366
+ this.msg.content.list = [...this.msg.content.list, ...arr]
367
+ return
368
+ }
369
+ }
370
+ }
371
+ }
372
+ </script>
373
+
374
+ <style scoped lang="less">
375
+ .answer-docknowledge {
376
+ min-width: 100px;
377
+ .answer-docknowledge-header{
378
+
379
+
380
+ .tips{
381
+ width: 154px;
382
+ height: 22px;
383
+ background: #366AFF;
384
+ border-radius: 5px;
385
+ text-align: center;
386
+ line-height: 22px;
387
+ color: #fff;
388
+ font-size: 12px;
389
+ margin-bottom: 7px;
390
+ }
391
+ .answer-text {
392
+ // font-size: 13px;
393
+ text-align: left;
394
+ line-height: 25px;
395
+ padding: 0px 0px 12px 0px;
396
+
397
+ .aci-view {
398
+ // font-size: 13px;
399
+ display: inline-block;
400
+ // margin-left: 5px;
401
+ color: #366aff;
402
+ cursor: pointer;
403
+ }
404
+ }
405
+ &.bgc{
406
+ padding: 10px;
407
+ background: #EEF1FF;
408
+ border-radius: 10px;
409
+ margin-bottom: 16px;
410
+ .answer-text {
411
+ padding: 0;
412
+ }
413
+ }
414
+ }
415
+
416
+ .ad-list {
417
+ .ad-list-cell {
418
+ border-top: solid 1px #EEEEEE;
419
+ padding: 10px 0 10px;
420
+
421
+ .alc-title {
422
+ display: flex;
423
+ flex-wrap: wrap;
424
+ align-items: center;
425
+ justify-content: space-between;
426
+ line-height: 16px;
427
+
428
+ .alc-box {
429
+ display: flex;
430
+ align-items: center;
431
+ justify-content: space-between;
432
+ // font-size: 12px;
433
+ width: 100%;
434
+ .alc-source-left{
435
+ display: flex;
436
+ align-items: center;
437
+ .source-form{
438
+ width: 34px;
439
+ flex: none;
440
+ color: #A9B3C6;
441
+ }
442
+ }
443
+ .alc-content-text{
444
+ width: 55px;
445
+ flex: none;
446
+ .aci-view{
447
+ color: #366aff;
448
+ cursor: pointer;
449
+ }
450
+ }
451
+ .alc-title-from {
452
+ line-height: 22px;
453
+ word-break: break-all !important;
454
+ text-align: left;
455
+ flex: auto;
456
+ display: flex;
457
+ justify-content: flex-start;
458
+ }
459
+ }
460
+ .alc-box-introduction{
461
+ overflow: hidden;
462
+ text-overflow: ellipsis;
463
+ display: -webkit-box;
464
+ -webkit-line-clamp:3;
465
+ -webkit-box-orient:vertical;
466
+ margin-top: 10px;
467
+ color: #616161;
468
+ // font-size: 12px;
469
+ line-height: 24px;
470
+ text-align: left;
471
+ img {
472
+ width: 50px;
473
+ height: 50px;
474
+ margin: 10px;
475
+ cursor: pointer;
476
+ }
477
+ }
478
+ .alc-box-introduction-previewImage {
479
+ width: 100%;
480
+ display: block;
481
+ overflow: hidden;
482
+ text-overflow: ellipsis;
483
+ display: -webkit-box;
484
+ -webkit-line-clamp:3;
485
+ -webkit-box-orient:vertical;
486
+ margin-top: 10px;
487
+ color: #616161;
488
+ // font-size: 12px;
489
+ line-height: 24px;
490
+ text-align: left;
491
+ img {
492
+ max-width: 300px;
493
+ width: 100%;
494
+ max-height: 150px;
495
+ margin: 10px;
496
+ cursor: pointer;
497
+ }
498
+ }
499
+ .alc-updateTime{
500
+ display: flex;
501
+ align-items: center;
502
+ justify-content: space-between;
503
+ font-size: 13px;
504
+ width: 100%;
505
+ margin-top: 10px;
506
+ .upload-source{
507
+ flex: none;
508
+ height: 18px;
509
+ line-height: 18px;
510
+ background: #E9F9F8;
511
+ border: 1px solid #AFF2CD;
512
+ border-radius: 2px;
513
+ display: flex;
514
+ align-items: center;
515
+ justify-content: center;
516
+ padding: 0 8px;
517
+ color: #00C2BB;
518
+ }
519
+ .time{
520
+ color: #999999;
521
+ margin-left: 10px;
522
+ }
523
+ .alc-content-text {
524
+ color: #366aff;
525
+ cursor: pointer;
526
+ }
527
+ }
528
+ .alc-title-icon {
529
+ margin: 0 2px;
530
+ width: 18px;
531
+ height: 18px;
532
+ flex: none;
533
+ }
534
+
535
+ .alc-title-updateTime {
536
+ text-align: right;
537
+ color: #999999;
538
+ // font-size: 13px;
539
+ }
540
+ }
541
+
542
+ .alc-content {
543
+ .alc-title-updateTime {
544
+ margin-top: 6px;
545
+ display: block;
546
+ text-align: right;
547
+ color: #999999;
548
+ // font-size: 13px;
549
+ }
550
+
551
+ .alc-content-text {
552
+ margin-bottom: 6px;
553
+ width: 55px;
554
+ flex: none;
555
+ .aci-view {
556
+ display: inline-block;
557
+ margin-left: 30px;
558
+ color: #366aff;
559
+ cursor: pointer;
560
+ }
561
+ }
562
+
563
+ .alc-content-info {
564
+ display: flex;
565
+ flex-wrap: wrap;
566
+ justify-content: space-between;
567
+
568
+ .alcc-box {
569
+ display: flex;
570
+ flex-wrap: wrap;
571
+ color: #999999;
572
+
573
+ .aci-owner {
574
+ margin-right: 20px;
575
+ }
576
+
577
+ .aci-enterprise {
578
+ margin-right: 20px;
579
+ }
580
+ }
581
+ }
582
+ }
583
+ }
584
+ .ad-loadmore {
585
+ width: 100%;
586
+ height: 40px;
587
+ display: flex;
588
+ align-items: center;
589
+ justify-content: center;
590
+ // background: #FFFFFF;
591
+ color: #366AFF;
592
+ font-size: 14px;
593
+ margin-top: 8px;
594
+ cursor: pointer;
595
+ }
596
+ }
597
+ }
557
598
  </style>