askbot-dragon 1.5.78-beta → 1.5.78

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 (46) hide show
  1. package/package.json +1 -4
  2. package/public/index.html +1 -3
  3. package/src/assets/image/default_avt_ui.png +0 -0
  4. package/src/assets/image/filtType/audio.png +0 -0
  5. package/src/assets/image/filtType/excel1.png +0 -0
  6. package/src/assets/image/filtType/general.png +0 -0
  7. package/src/assets/image/filtType/image1.png +0 -0
  8. package/src/assets/image/filtType/link.png +0 -0
  9. package/src/assets/image/filtType/md2.png +0 -0
  10. package/src/assets/image/filtType/mode.png +0 -0
  11. package/src/assets/image/filtType/news.png +0 -0
  12. package/src/assets/image/filtType/pdf1.png +0 -0
  13. package/src/assets/image/filtType/ppt1.png +0 -0
  14. package/src/assets/image/filtType/selfadd1.png +0 -0
  15. package/src/assets/image/filtType/txt1.png +0 -0
  16. package/src/assets/image/filtType/video.png +0 -0
  17. package/src/assets/image/filtType/wechat.png +0 -0
  18. package/src/assets/image/filtType/word1.png +0 -0
  19. package/src/assets/image/loading.gif +0 -0
  20. package/src/assets/js/common.js +241 -0
  21. package/src/components/ActionAlertIframe.vue +43 -1
  22. package/src/components/AnswerDocknowledge.vue +849 -275
  23. package/src/components/ConversationContainer.vue +354 -27
  24. package/src/components/MyEditor.vue +351 -0
  25. package/src/components/answerRadio.vue +115 -61
  26. package/src/components/assetDetails.vue +13 -5
  27. package/src/components/associationIntention.vue +2 -2
  28. package/src/components/chatContent.vue +1 -1
  29. package/src/components/formTemplate.vue +77 -111
  30. package/src/components/intelligentSummary.vue +228 -0
  31. package/src/components/pdfPosition.vue +23 -12
  32. package/src/components/previewDoc.vue +5 -0
  33. package/src/components/previewPdf.vue +675 -199
  34. package/src/components/welcomeKnowledgeFile.vue +341 -0
  35. package/src/components/welcomeLlmCard.vue +141 -0
  36. package/src/components/welcomeSuggest.vue +98 -0
  37. package/src/main.js +0 -3
  38. package/vue.config.js +0 -1
  39. package/src/components/utils/ckeditorImageUpload/command.js +0 -110
  40. package/src/components/utils/ckeditorImageUpload/editing.js +0 -12
  41. package/src/components/utils/ckeditorImageUpload/plugin-image.js +0 -12
  42. package/src/components/utils/ckeditorImageUpload/toolbar-ui.js +0 -41
  43. package/src/components/utils/ckeditorfileUpload/common.js +0 -182
  44. package/src/components/utils/ckeditorfileUpload/editing.js +0 -12
  45. package/src/components/utils/ckeditorfileUpload/plugin_file.js +0 -12
  46. package/src/components/utils/ckeditorfileUpload/toolbar_ui.js +0 -34
@@ -9,7 +9,7 @@
9
9
  <view class="user-detail">
10
10
  <Msgloading v-if="msg.speaker != 'user' && msg.type == 'msg_loading'"></Msgloading>
11
11
  <!-- 小程序富文本组件 -->
12
- <view v-if="msg.type == 'answer_rich_text'" class="media-body">
12
+ <view v-if="(msg.type == 'answer_rich_text' || msg.type == 'answer_rich_text_pro')" class="media-body">
13
13
  <!--<mp-html
14
14
  lazy-load
15
15
  scroll-table
@@ -63,13 +63,20 @@
63
63
  v-if="item.formField.type==='TEXTAREA'&& item.fieldId!=='workorder_description'"
64
64
  ></el-input>
65
65
  <div v-else-if="item.fieldId === 'workorder_description'">
66
- <ckeditor
66
+ <!-- <ckeditor
67
67
  :editor="ckeditor.editor"
68
68
  v-model="item.value"
69
69
  :config="{...ckeditor.editorConfig,placeholder:item.formField.extInfo && item.formField.extInfo.placeholder?item.formField.extInfo.placeholder:'请输入'}"
70
70
  @ready="(editor)=>currentEditor=editor"
71
71
  @focus="(zh,editor)=>currentEditor=editor"
72
- ></ckeditor>
72
+ ></ckeditor> -->
73
+ <MyEditor
74
+ v-model="item.value"
75
+ :placeholder="item.formField.extInfo && item.formField.extInfo.placeholder?item.formField.extInfo.placeholder:'请输入'"
76
+ @fileUploadCallback="desUploadImageAndFile"
77
+ :havToolbar="mainId !== '8b9bd566e3e64156ab764b19defc9d48' && mainId !== '0b73521f96e4486aaf6be42932bd7b07'">
78
+ </MyEditor>
79
+ <!-- @input="(value) =>{item.value = value}" -->
73
80
  <file-list-view :attachmentList="attachmentList" @attachDeleteAttch="attachDeleteAttch"></file-list-view>
74
81
  </div>
75
82
  <el-date-picker
@@ -345,13 +352,20 @@
345
352
  <i class="el-icon-warning-outline"></i>
346
353
  </span>
347
354
  </div>
348
- <ckeditor
355
+ <!-- <ckeditor
349
356
  :editor="ckeditor.editor"
350
357
  v-model="item.value"
351
358
  @ready="(editor)=>currentEditor=editor"
352
359
  @focus="(zh,editor)=>currentEditor=editor"
353
360
  :config="{...ckeditor.editorConfig,placeholder:item.formField.extInfo && item.formField.extInfo.placeholder?item.formField.extInfo.placeholder:'请输入'}"
354
- ></ckeditor>
361
+ ></ckeditor> -->
362
+ <MyEditor
363
+ v-model="item.value"
364
+ :placeholder="item.formField.extInfo && item.formField.extInfo.placeholder?item.formField.extInfo.placeholder:'请输入'"
365
+ @fileUploadCallback="desUploadImageAndFile"
366
+ :havToolbar="mainId !== '8b9bd566e3e64156ab764b19defc9d48' && mainId !== '0b73521f96e4486aaf6be42932bd7b07' "
367
+ >
368
+ </MyEditor>
355
369
  <file-list-view :attachmentList="attachmentList" @attachDeleteAttch="attachDeleteAttch"></file-list-view>
356
370
  </div>
357
371
  </div>
@@ -847,14 +861,9 @@
847
861
  <script>
848
862
  /* eslint-disable */
849
863
  import { forMatTime } from "./utils/format_date";
850
-
851
864
  let that
852
865
  import {multipartUpload,ossFileUrl} from "./utils/AliyunIssUtil";
853
- import {MyCustomUploadAdapterPlugin} from "./utils/ckeditor";
854
- // import MyimageUpload from './utils/ckeditorImageUpload/plugin-image'
855
- import MyFileUpload from './utils/ckeditorfileUpload/plugin_file'
856
- import CKEDITOR from 'ckeditor'
857
-
866
+ import MyEditor from './MyEditor'
858
867
  import myPopup from "./myPopup.vue";
859
868
  import Tree from '../components/tree'
860
869
  import selectPopup from '../components/popup'
@@ -944,21 +953,6 @@ export default {
944
953
  },
945
954
  hideUploadEdit:false,
946
955
  limitNum:1,
947
- ckeditor: {
948
- editor: CKEDITOR.ClassicEditor,
949
- editorConfig: {
950
- extraPlugins: [MyFileUpload,MyCustomUploadAdapterPlugin],
951
- toolbar: [
952
- 'MyFileUpload'
953
- ],
954
- askPluginListener:[
955
- {
956
- event: 'UPLOAD',
957
- process: this.desUploadImageAndFile,
958
- }
959
- ]
960
- },
961
- },
962
956
  refShowPicker:false,
963
957
  refTemplateList:{},
964
958
  refList:{},
@@ -1200,7 +1194,8 @@ export default {
1200
1194
  myPopup,
1201
1195
  Tree,
1202
1196
  selectPopup,
1203
- fileListView
1197
+ fileListView,
1198
+ MyEditor
1204
1199
  },
1205
1200
  mounted() {
1206
1201
 
@@ -1219,9 +1214,10 @@ export default {
1219
1214
  // }
1220
1215
  // })
1221
1216
  // }
1222
- if (this.mainId == '8b9bd566e3e64156ab764b19defc9d48' || this.mainId == '0b73521f96e4486aaf6be42932bd7b07'){
1223
- this.ckeditor.editorConfig.toolbar = []
1224
- }
1217
+ // if (this.mainId == '8b9bd566e3e64156ab764b19defc9d48' || this.mainId == '0b73521f96e4486aaf6be42932bd7b07'){
1218
+ // this.ckeditor.editorConfig.toolbar = []
1219
+
1220
+ // }
1225
1221
  if (this.mainId == '90df4764122240de939331d372546c28'){
1226
1222
  this.isBaiLi = true;
1227
1223
  }
@@ -1863,14 +1859,19 @@ export default {
1863
1859
  }
1864
1860
  }
1865
1861
  if (type === 'DATE_PICKER') {
1866
- if(this.formList.form.formFieldRelation[i].value!==null && this.formList.form.formFieldRelation[i].value!=='' ) {
1862
+ if(this.formList.form.formFieldRelation[i].value && this.formList.form.formFieldRelation[i].value!==null && this.formList.form.formFieldRelation[i].value!=='' ) {
1867
1863
  this.dateValue[this.formList.form.formFieldRelation[i].fieldId]=this.formatDate(this.formList.form.formFieldRelation[i].value)
1868
1864
  }
1869
1865
  }
1870
1866
  if (type === 'TIME_PICKER') {
1871
- if(this.formList.form.formFieldRelation[i].value!==''&& this.formList.form.formFieldRelation[i].value!==null)
1867
+ if(this.formList.form.formFieldRelation[i].value && this.formList.form.formFieldRelation[i].value!==''&& this.formList.form.formFieldRelation[i].value!==null)
1872
1868
  {
1873
- const dateTime = new Date(this.formList.form.formFieldRelation[i].value)
1869
+ // 判断是否是时间戳 时间戳为字符串转换为Number
1870
+ var regex = /^\d{13}$/;
1871
+ if (regex.test(this.formList.form.formFieldRelation[i].value)){
1872
+ this.formList.form.formFieldRelation[i].value = Number(this.formList.form.formFieldRelation[i].value)
1873
+ }
1874
+ const dateTime = new Date(this.formList.form.formFieldRelation[i].value);
1874
1875
  if (!this.formList.form.formFieldRelation[i].formField.extInfo.mold ||
1875
1876
  this.formList.form.formFieldRelation[i].formField.extInfo.mold == 'TIME' ||
1876
1877
  this.getMoldTime(this.formList.form.formFieldRelation[i].formField.formField) == 'TIME'){
@@ -1883,10 +1884,18 @@ export default {
1883
1884
  this.extInfoFieldValue[this.formList.form.formFieldRelation[i].fieldId] = this.formList.form.formFieldRelation[i].value;
1884
1885
  this.formList.form.formFieldRelation[i].value = new Date().getFullYear() + "-" + (new Date().getMonth() + 1) + "-" + new Date().getDate() + " " + this.formList.form.formFieldRelation[i].value;
1885
1886
  } else {
1886
- this.extInfoFieldValue[this.formList.form.formFieldRelation[i].fieldId] = this.formList.form.formFieldRelation[i].value
1887
+ if (regex.test(this.formList.form.formFieldRelation[i].value)){
1888
+ this.extInfoFieldValue[this.formList.form.formFieldRelation[i].fieldId] = dateTime
1889
+ } else {
1890
+ this.extInfoFieldValue[this.formList.form.formFieldRelation[i].fieldId] = this.formList.form.formFieldRelation[i].value
1891
+ }
1887
1892
  }
1888
1893
  } else {
1889
- this.extInfoFieldValue[this.formList.form.formFieldRelation[i].fieldId] = this.formList.form.formFieldRelation[i].value
1894
+ if (regex.test(this.formList.form.formFieldRelation[i].value)){
1895
+ this.extInfoFieldValue[this.formList.form.formFieldRelation[i].fieldId] = dateTime.Format('hh:mm')
1896
+ } else {
1897
+ this.extInfoFieldValue[this.formList.form.formFieldRelation[i].fieldId] = this.formList.form.formFieldRelation[i].value
1898
+ }
1890
1899
  }
1891
1900
  }
1892
1901
  else if (this.formList.form.formFieldRelation[i].formField.extInfo.mold == 'DATA_TIME' ||
@@ -2002,7 +2011,7 @@ export default {
2002
2011
  else if (type == 'TIME'){
2003
2012
  this.timePicker = false;
2004
2013
  this.extInfoFieldValue[this.timeDetailData.fieldId] = value;
2005
- this.timeDetailData.value = forMatTime(value)
2014
+ this.timeDetailData.value = value;
2006
2015
  }
2007
2016
  else if (type == 'DATE_TIME'){
2008
2017
  this.dateTimePicker = false;
@@ -2080,8 +2089,10 @@ export default {
2080
2089
  let textFlag = true
2081
2090
  let imageFlag = true
2082
2091
  let attachmentFlag = true
2092
+ let imageOrAttachment = true
2083
2093
  let errorText = ''
2084
2094
  let checkDescription = {
2095
+ checkImageOrAttachment:this.workOrderDestail.checkImageOrAttachment ? this.workOrderDestail.checkImageOrAttachment : false,
2085
2096
  checkText:this.workOrderDestail.checkText ? this.workOrderDestail.checkText : false,
2086
2097
  checkImage:this.workOrderDestail.checkImage ? this.workOrderDestail.checkImage : false,
2087
2098
  checkAttachment:this.workOrderDestail.checkAttachment ? this.workOrderDestail.checkAttachment : false,
@@ -2099,16 +2110,24 @@ export default {
2099
2110
  d = null
2100
2111
  }
2101
2112
  }
2113
+ if(checkDescription.checkImageOrAttachment) {
2114
+ if(!this.workOrderDestail.value.includes('img') && this.attachmentList.length == 0) {
2115
+ imageOrAttachment = false
2116
+ }
2117
+ }
2102
2118
  if (checkDescription.checkImage && !this.workOrderDestail.value.includes('img')) {
2103
2119
  imageFlag = false
2104
2120
  }
2105
- if (checkDescription.checkAttachment && this.attachments.length == 0) {
2121
+ if (checkDescription.checkAttachment && this.attachmentList.length == 0) {
2106
2122
  attachmentFlag = false
2107
2123
  }
2108
2124
  let text = this.isBaiLi ? '反馈描述' : '问题描述'
2109
2125
  if (!textFlag) {
2110
2126
  errorText = text + '必须要有文字'
2111
2127
  }
2128
+ if(!imageOrAttachment) {
2129
+ errorText = text + '必须要有图片或附件'
2130
+ }
2112
2131
  if (!imageFlag) {
2113
2132
  errorText = text + '必须要有图片'
2114
2133
  }
@@ -2130,7 +2149,7 @@ export default {
2130
2149
  } else {
2131
2150
  let d = document.createElement('div')
2132
2151
  d.innerHTML = this.workOrderDestail.value
2133
- if (checkDescription.required && !d.innerText && !this.workOrderDestail.value.includes('img') && this.attachments.length == 0) {
2152
+ if (checkDescription.required && !d.innerText && !this.workOrderDestail.value.includes('img') && this.attachmentList.length == 0) {
2134
2153
  let errorText = this.isBaiLi ? '反馈描述是必填的' : '问题描述是必填的'
2135
2154
  this.$message.error(errorText);
2136
2155
  return false
@@ -2230,8 +2249,8 @@ export default {
2230
2249
  }
2231
2250
  let extInfo = {
2232
2251
  extInfoFieldValue:this.extInfoFieldValue,
2233
- attachments:this.attachments,
2234
- attachmentList:this.attachmentList
2252
+ attachmentList:this.attachmentList,
2253
+ attachments: this.attachmentList.map(item =>{ return item.url})
2235
2254
  }
2236
2255
  this.$set(this.formShow,'extInfo',extInfo)
2237
2256
  let newForm = JSON.parse(JSON.stringify(this.formShow));
@@ -2250,7 +2269,7 @@ export default {
2250
2269
  newForm.form.formFieldRelation[i].value = new Date(newForm.form.formFieldRelation[i].value).Format('hh:mm')
2251
2270
  }
2252
2271
  }
2253
- console.debug('formShow',this.formShow,this.formShow.form,newForm.form)
2272
+ console.error('formShow',newForm)
2254
2273
  this.$emit('submitClick',newForm)
2255
2274
  this.disableds = true
2256
2275
  this.submitValue = '已提交'
@@ -2275,6 +2294,9 @@ export default {
2275
2294
  if (this.disableds){
2276
2295
  return
2277
2296
  }
2297
+ if (item.value === undefined || item.value === null){
2298
+ this.$set(item,'value',"")
2299
+ }
2278
2300
  this.timeDetailData = item
2279
2301
  if (type == 'DATE'){
2280
2302
  this.datePicker = true
@@ -2288,10 +2310,12 @@ export default {
2288
2310
  },
2289
2311
  //下拉的点击事件
2290
2312
  selectClick(id,type,item) {
2291
- console.debug('111',item)
2292
2313
  if (this.disableds){
2293
2314
  return
2294
2315
  }
2316
+ if (item.value === undefined || item.value === null){
2317
+ this.$set(item,'value',"")
2318
+ }
2295
2319
  this.selectDetail = item;
2296
2320
  this.defaultValue = []
2297
2321
  if(type == 'client') {
@@ -2967,76 +2991,8 @@ export default {
2967
2991
  }
2968
2992
  return flag
2969
2993
  },
2970
- getAttach (newVal) {
2971
- let d = document.createElement('div')
2972
- d.innerHTML = newVal
2973
- let uploadList = d.getElementsByClassName('ask-component-placeholder-container')
2974
- if (uploadList) {
2975
- for (let index = 0; index < uploadList.length; index++) {
2976
- if(!uploadList[index].childNodes[0] || !uploadList[index].childNodes[0].getAttribute) {
2977
- break
2978
- }
2979
- if (uploadList[index].childNodes[0].getAttribute('type') == 'upload' || uploadList[index].childNodes[0].getAttribute('type') == 'undefined') {
2980
- this.uploadImgQueue = true
2981
- let text = uploadList[index].innerText.replace('正在上传...', '')
2982
- let i = uploadList[index].childNodes[0].getAttribute('data')
2983
- if (newVal.includes(text + i)) {
2984
- uploadList[index].setAttribute('type', 'upload')
2985
- let ht = '<span class="ask-component-placeholder-container">' + uploadList[index].innerHTML + '</span>'
2986
- newVal = newVal.replace(ht, '')
2987
- this.uploadImgQueue = false
2988
- let time = setTimeout(() => {
2989
- this.currentEditor.model.change(writer => {
2990
- writer.setSelection(writer.createPositionAt(this.currentEditor.model.document.getRoot(), 'end'));
2991
- })
2992
- this.currentEditor.editing.view.focus();
2993
- clearTimeout(time)
2994
- }, 500)
2995
- }
2996
- }
2997
- if (uploadList[index].childNodes[0].getAttribute('type') == 'MyFile' || uploadList[index].childNodes[0].getAttribute('type') == 'FileUpload') {
2998
- let span = uploadList[index].getElementsByClassName('ask-component-placeholder-span')[0]
2999
- const text = span.innerText
3000
- let value = ''
3001
- let id = ''
3002
- if (typeof span.getAttribute('data') == 'string' && !span.getAttribute('data').includes('default')) {
3003
- id = span.getAttribute('data')
3004
- this.attachmentList.push({
3005
- name: text,
3006
- id: id,
3007
- url: '',
3008
- })
3009
- } else {
3010
- value = JSON.parse(span.getAttribute('data')).default
3011
- id = JSON.parse(span.getAttribute('data')).id
3012
- this.attachments.push(value)
3013
- this.attachmentList = this.attachmentList.filter(attach => {
3014
- return attach.id != id
3015
- })
3016
- this.attachmentList.push({
3017
- name: text,
3018
- url: value,
3019
- })
3020
- let time = setTimeout(() => {
3021
- this.currentEditor.model.change(writer => {
3022
- writer.setSelection(writer.createPositionAt(this.currentEditor.model.document.getRoot(), 'end'));
3023
- })
3024
- this.currentEditor.editing.view.focus();
3025
- clearTimeout(time)
3026
- }, 500)
3027
- }
3028
- uploadList[index].setAttribute('type', 'MyFile')
3029
- let ht = '<span class="ask-component-placeholder-container">' + uploadList[index].innerHTML + '</span>'
3030
- newVal = newVal.replace(ht, '')
3031
- span = null
3032
- }
3033
- }
3034
- }
3035
- d = null
3036
- return newVal
3037
- },
3038
2994
  attachDeleteAttch (index) {
3039
- this.attachments.splice(index, 1)
2995
+ // this.attachments.splice(index, 1)
3040
2996
  this.attachmentList.splice(index, 1)
3041
2997
  },
3042
2998
  attachDeleteFile(index,fieldId){
@@ -3070,7 +3026,6 @@ export default {
3070
3026
  handler(val){
3071
3027
  let newVal = ''
3072
3028
  newVal = val.replace(/ style=".*?"/g, '');
3073
- // newVal = this.getAttach(newVal)
3074
3029
  if (this.currentEditor){
3075
3030
  if (this.workOrderDestail){
3076
3031
  this.$nextTick(() =>{
@@ -3158,6 +3113,17 @@ export default {
3158
3113
  border-color:#E0E6F7;
3159
3114
  border-top-left-radius: 9px!important;
3160
3115
  border-top-right-radius: 9px!important;
3116
+ .ck-toolbar__items {
3117
+ .ck-button {
3118
+ color: #366AFF;
3119
+ svg {
3120
+ fill: #366AFF;
3121
+ width: 12px !important;
3122
+ height: 12px !important;
3123
+ margin-bottom: 2px;
3124
+ }
3125
+ }
3126
+ }
3161
3127
  }
3162
3128
  /deep/.ck.ck-editor__editable_inline{
3163
3129
  border-color:#E0E6F7;
@@ -0,0 +1,228 @@
1
+ <template>
2
+ <div class="intelligentSummary" :class="tagIds.length != 0 ? 'float_intelligentSummary' : ''" id="intelligentSummary">
3
+ <div class="summaryHeader">
4
+ <div class="left">
5
+ <i class="iconfont guoran-tongyichicun-write-29-jiqiren"></i>
6
+ <span>智能摘要</span>
7
+ </div>
8
+ <div class="right">
9
+ <div class="regenerationBtn" @click="regeneration">
10
+ <template v-if="!isLoading">重新生成</template>
11
+ <template v-else>
12
+ <img
13
+ height="20px"
14
+ width="20px"
15
+ src="../assets/image/loading.gif"
16
+ alt
17
+ srcset
18
+ style="margin-right: 6px"
19
+ />
20
+ <span>生成中</span>
21
+ </template>
22
+ </div>
23
+ <i class="iconfont guoran-tongyichicun-shouqi" @click="closeSummary"></i>
24
+ </div>
25
+ </div>
26
+ <div class="summaryContent">
27
+ <span>{{ typedContent }}</span>
28
+ </div>
29
+ <div class="intelligentBottom" v-if="recommendQuestions.length > 0">
30
+ <div class="intelligentQues"
31
+ v-for="(item,index) in recommendQuestions"
32
+ :key="index"
33
+ @click="recommendQues(item)"
34
+ >
35
+ {{ item }}
36
+ </div>
37
+ </div>
38
+ </div>
39
+ </template>
40
+
41
+ <script>
42
+ export default {
43
+ name: "intelligentSummary",
44
+ data(){
45
+ return{
46
+ summary:"",
47
+ recommendQuestions:[],
48
+ isLoading:false,
49
+ typedContent:"",
50
+ typingSpeed:20
51
+ }
52
+ },
53
+ props:{
54
+ knowledgeId:{
55
+ type:String
56
+ },
57
+ tagIds:{
58
+ type:Array,
59
+ default() {
60
+ return []
61
+ }
62
+ }
63
+ },
64
+ methods:{
65
+ getKnowledgeSummary() {
66
+ let url = "/knowledge-api/knowledge/detail/" + this.knowledgeId;
67
+ this.typedContent = "";
68
+ this.summary = "";
69
+ this.$http.get(url).then(res => {
70
+ console.log('res',res)
71
+ if (res.data.data){
72
+ this.summary = res.data.data.summary;
73
+ this.recommendQuestions = res.data.data.recommendQuestions ? res.data.data.recommendQuestions.splice(0,5) : [];
74
+ if (!this.summary){
75
+ this.regeneration();
76
+ } else {
77
+ this.typedContent = this.summary;
78
+ }
79
+ }
80
+ this.$nextTick(() => {
81
+ this.$emit('getSummarySuccess')
82
+ })
83
+ })
84
+ },
85
+ regeneration(){
86
+ let url = "/knowledge-api/knowledge/analyze/summary";
87
+ let obj = {
88
+ "mainId": sessionStorage.getItem('_mainId') || localStorage.getItem('_mainId'),
89
+ "userId": sessionStorage.getItem('_uid') || localStorage.getItem('_uid'),
90
+ "knowledgeId": this.knowledgeId,
91
+ "async": false
92
+ }
93
+ this.isLoading = true;
94
+ this.typedContent = "";
95
+ this.summary = "";
96
+ this.$http.post(url,obj).then(res => {
97
+ console.log('regeneration',res)
98
+ if (res.data.data){
99
+ this.summary = res.data.data.summary;
100
+ this.recommendQuestions = res.data.data.recommendQuestions ? res.data.data.recommendQuestions.splice(0,5) : [];
101
+ this.startTypingEffect();
102
+ } else {
103
+ this.$nextTick(() => {
104
+ this.$emit('getSummarySuccess')
105
+ })
106
+ }
107
+ this.isLoading = false;
108
+ })
109
+ },
110
+ closeSummary(){
111
+ this.$emit('closeSummary')
112
+ },
113
+ recommendQues(item){
114
+ this.$emit('recommendQues',item,this.knowledgeId)
115
+ },
116
+ startTypingEffect() {
117
+ let i = 0;
118
+ const interval = setInterval(() => {
119
+ if (i < this.summary.length) {
120
+ this.typedContent += this.summary.charAt(i);
121
+ i++;
122
+ } else {
123
+ clearInterval(interval);
124
+ setTimeout(() => {
125
+ this.$emit('getSummarySuccess')
126
+ },240)
127
+ }
128
+ }, this.typingSpeed);
129
+ },
130
+ },
131
+ mounted() {
132
+ this.getKnowledgeSummary();
133
+ }
134
+ };
135
+ </script>
136
+
137
+ <style scoped lang="less">
138
+ .intelligentSummary{
139
+ background-color: #ffffff;
140
+ border-radius: 20px;
141
+ border: 1px solid #366AFF;
142
+ margin-bottom: 20px;
143
+ .summaryHeader{
144
+ display: flex;
145
+ align-items: center;
146
+ justify-content: space-between;
147
+ padding: 14px 16px;
148
+ font-size: 14px;
149
+ .left{
150
+ //display: flex;
151
+ //align-items: center;
152
+ color: #366aff;
153
+ i{
154
+ padding-right: 6px;
155
+ }
156
+ }
157
+ .right{
158
+ display: flex;
159
+ align-items: center;
160
+ color: #366aff;
161
+ .regenerationBtn{
162
+ height: 26px;
163
+ background: #E9EFFF;
164
+ border-radius: 12px;
165
+ color: #366AFF;
166
+ display: flex;
167
+ align-items: center;
168
+ justify-content: center;
169
+ cursor: pointer;
170
+ padding: 0 10px;
171
+ margin-right: 10px;
172
+ font-size: 12px;
173
+ }
174
+ i{
175
+ cursor: pointer;
176
+ font-size: 14px;
177
+ }
178
+ }
179
+ }
180
+ .summaryContent{
181
+ line-height: 26px;
182
+ padding: 0 16px 16px 16px;
183
+ font-size: 14px;
184
+ text-align: left;
185
+ }
186
+ .intelligentBottom{
187
+ background: #F9FAFD;
188
+ padding: 0 20px;
189
+ border-bottom-left-radius: 20px;
190
+ border-bottom-right-radius: 20px;
191
+ display: flex;
192
+ align-items: center;
193
+ flex-wrap: wrap;
194
+ .intelligentQues{
195
+ height: 26px;
196
+ display: flex;
197
+ align-items: center;
198
+ justify-content: center;
199
+ padding: 0 8px;
200
+ background: #E5EBFF;
201
+ color: #366AFF;
202
+ border-radius: 10px;
203
+ margin-right: 5px;
204
+ margin-top: 5px;
205
+ margin-bottom: 5px;
206
+ font-size: 12px;
207
+ cursor: pointer;
208
+ white-space: nowrap;
209
+ }
210
+ }
211
+ ::-webkit-scrollbar{
212
+ background-color: transparent;
213
+ height: 6px;
214
+ }
215
+ }
216
+ .float_intelligentSummary {
217
+ position: absolute;
218
+ z-index: 999;
219
+ top: 60px;
220
+ left: 16px;
221
+ width: calc(100% - 32px);
222
+ box-shadow: 0 0 10px rgba(0,0,0,.12);
223
+ .summaryContent {
224
+ max-height: 30vh;
225
+ overflow-y: auto;
226
+ }
227
+ }
228
+ </style>