askbot-dragon 1.6.24-beta → 1.6.26-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 +55 -58
  5. package/public/index.html +72 -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 -75
  13. package/src/assets/js/hammer.js +100 -100
  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 -199
  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 -177
  21. package/src/components/AiGuide.vue +466 -466
  22. package/src/components/AnswerDocknowledge.vue +597 -597
  23. package/src/components/AnswerVoice.vue +285 -285
  24. package/src/components/AskIFrame.vue +15 -15
  25. package/src/components/ConversationContainer.vue +5039 -4969
  26. package/src/components/FileType.vue +86 -86
  27. package/src/components/Message.vue +27 -27
  28. package/src/components/MyEditor.vue +345 -0
  29. package/src/components/actionSatisfaction.vue +107 -107
  30. package/src/components/actionSendToBot.vue +62 -62
  31. package/src/components/answerDissatisfaction.vue +62 -62
  32. package/src/components/answerRadio.vue +186 -132
  33. package/src/components/ask-components/DissatisfactionOptions.vue +57 -57
  34. package/src/components/ask-components/Msgloading.vue +37 -37
  35. package/src/components/ask-components/SatisfactionV2.vue +15 -15
  36. package/src/components/askVideo.vue +162 -162
  37. package/src/components/assetDetails.vue +370 -370
  38. package/src/components/assetMessage.vue +228 -228
  39. package/src/components/associationIntention.vue +355 -355
  40. package/src/components/attachmentPreview.vue +90 -90
  41. package/src/components/botActionSatisfactor.vue +68 -68
  42. package/src/components/chatContent.vue +513 -513
  43. package/src/components/feedBack.vue +136 -136
  44. package/src/components/fielListView.vue +351 -351
  45. package/src/components/file/AliyunOssComponents.vue +108 -108
  46. package/src/components/formTemplate.vue +3572 -3576
  47. package/src/components/kkview.vue +1138 -1138
  48. package/src/components/loadingProcess.vue +164 -164
  49. package/src/components/message/ActionAlertIframe.vue +112 -112
  50. package/src/components/message/ShopMessage.vue +164 -164
  51. package/src/components/message/TextMessage.vue +924 -924
  52. package/src/components/message/TicketMessage.vue +201 -201
  53. package/src/components/message/swiper/index.js +4 -4
  54. package/src/components/message/swiper/ticketSwiper.vue +503 -503
  55. package/src/components/message/swiper/ticketSwiperItem.vue +61 -61
  56. package/src/components/msgLoading.vue +231 -231
  57. package/src/components/myPopup.vue +70 -70
  58. package/src/components/newPdfPosition.vue +877 -877
  59. package/src/components/pdfPosition.vue +1508 -1508
  60. package/src/components/popup.vue +227 -227
  61. package/src/components/previewDoc.vue +242 -242
  62. package/src/components/previewPdf.vue +319 -319
  63. package/src/components/receiverMessagePlatform.vue +65 -65
  64. package/src/components/recommend.vue +80 -80
  65. package/src/components/selector/hOption.vue +20 -20
  66. package/src/components/selector/hSelector.vue +199 -199
  67. package/src/components/selector/hWrapper.vue +216 -216
  68. package/src/components/senderMessagePlatform.vue +50 -50
  69. package/src/components/source/BotMessage.vue +24 -24
  70. package/src/components/source/CustomMessage.vue +24 -24
  71. package/src/components/test.vue +260 -260
  72. package/src/components/tree.vue +294 -294
  73. package/src/components/utils/AliyunIssUtil.js +81 -81
  74. package/src/components/utils/ckeditor.js +174 -174
  75. package/src/components/utils/format_date.js +25 -25
  76. package/src/components/utils/index.js +6 -6
  77. package/src/components/utils/math_utils.js +29 -29
  78. package/src/components/voiceComponent.vue +119 -119
  79. package/src/components/welcomeKnowledgeFile.vue +263 -229
  80. package/src/components/welcomeLlmCard.vue +138 -138
  81. package/src/main.js +57 -60
  82. package/vue.config.js +54 -55
  83. package/src/components/utils/ckeditorImageUpload/command.js +0 -110
  84. package/src/components/utils/ckeditorImageUpload/editing.js +0 -12
  85. package/src/components/utils/ckeditorImageUpload/plugin-image.js +0 -12
  86. package/src/components/utils/ckeditorImageUpload/toolbar-ui.js +0 -41
  87. package/src/components/utils/ckeditorfileUpload/common.js +0 -182
  88. package/src/components/utils/ckeditorfileUpload/editing.js +0 -12
  89. package/src/components/utils/ckeditorfileUpload/plugin_file.js +0 -12
  90. package/src/components/utils/ckeditorfileUpload/toolbar_ui.js +0 -35
@@ -1,598 +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" :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
- }
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
+ }
598
598
  </style>