|
|
|
|
@ -42,7 +42,8 @@ |
|
|
|
|
<el-input v-model="form.title" class="v-input" :disabled="generatedLoading"></el-input> |
|
|
|
|
</el-form-item> |
|
|
|
|
<el-form-item label="主题词" class="v-item-block" prop="keywords"> |
|
|
|
|
<el-tooltip class="item" effect="dark" content="输入多个关键字时,请使用中文逗号(,)隔开。" placement="top"> |
|
|
|
|
<el-tooltip class="item" effect="dark" content="输入多个关键字时,请使用中文逗号(,)隔开。" |
|
|
|
|
placement="top"> |
|
|
|
|
<i class="v-edit-tip el-icon-question"></i> |
|
|
|
|
</el-tooltip> |
|
|
|
|
<el-input v-model="form.keywords" type="textarea" :rows="2" class="v-textarea" resize="none" |
|
|
|
|
@ -104,6 +105,9 @@ |
|
|
|
|
import FileUpload from '@/components/FileUpload' |
|
|
|
|
import FileUpload1 from '@/components/FileUpload1' |
|
|
|
|
|
|
|
|
|
import htmlDocx from 'html-docx-js/dist/html-docx'; |
|
|
|
|
import FileSaver from 'file-saver'; |
|
|
|
|
|
|
|
|
|
import * as AiApi from '@/api/ai-api' |
|
|
|
|
|
|
|
|
|
const { |
|
|
|
|
@ -299,16 +303,15 @@ export default { |
|
|
|
|
}, |
|
|
|
|
mounted() { |
|
|
|
|
let params |
|
|
|
|
console.log(this.$route.params.data) |
|
|
|
|
|
|
|
|
|
if (this.$route.params.data) { |
|
|
|
|
params = this.$route.params.data |
|
|
|
|
localStorage.setItem('fileData', params); |
|
|
|
|
localStorage.setItem('fileData', JSON.stringify(params)); |
|
|
|
|
} else { |
|
|
|
|
params = localStorage.getItem('fileData') |
|
|
|
|
params = JSON.parse(localStorage.getItem('fileData')) |
|
|
|
|
} |
|
|
|
|
this.form.type = params.type |
|
|
|
|
this.form.subType = params.docType |
|
|
|
|
|
|
|
|
|
this.form.title = params.title |
|
|
|
|
this.form.keywords = params.keywords |
|
|
|
|
this.form.first = params.first |
|
|
|
|
@ -398,6 +401,7 @@ export default { |
|
|
|
|
}, |
|
|
|
|
/** 模型列表 值 */ |
|
|
|
|
getModelCascader(val) { |
|
|
|
|
this.thinkTimes = 0 |
|
|
|
|
let model = this.modelOptions.find((item, index) => { |
|
|
|
|
return item.value == val[0] |
|
|
|
|
}) |
|
|
|
|
@ -412,16 +416,14 @@ export default { |
|
|
|
|
this.editor = Object.seal(editor) // 一定要用 Object.seal() ,否则会报错 |
|
|
|
|
}, |
|
|
|
|
handleReferenceChange(file) { |
|
|
|
|
console.log(file) |
|
|
|
|
this.form.referenceDocumentId = file |
|
|
|
|
}, |
|
|
|
|
handleImitationChange(file) { |
|
|
|
|
console.log(file) |
|
|
|
|
this.form.imitationDocumentId = file |
|
|
|
|
}, |
|
|
|
|
/** 生成 公文 */ |
|
|
|
|
async generateDoc() { |
|
|
|
|
|
|
|
|
|
this.thinkState = false |
|
|
|
|
try { |
|
|
|
|
await this.$refs['formRef'].validate() |
|
|
|
|
this.generatedContent = ''; |
|
|
|
|
@ -432,11 +434,7 @@ export default { |
|
|
|
|
this.generatedLoading = true |
|
|
|
|
this.errorMessage = ''; |
|
|
|
|
// skType 1深度思考 2普通问答 |
|
|
|
|
if (this.skType == 1) { |
|
|
|
|
this.thinkStart = true |
|
|
|
|
} else { |
|
|
|
|
this.thinkStart = false |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
this.startTime = this.endTime = new Date(); |
|
|
|
|
this.thinkTimes = this.endTime.getTime() - this.startTime.getTime(); |
|
|
|
|
let versionId = this.modelOptions.find((item, index) => { |
|
|
|
|
@ -448,7 +446,6 @@ export default { |
|
|
|
|
}) |
|
|
|
|
|
|
|
|
|
let subType = this.typeList.find((item) => { |
|
|
|
|
console.log(item,this.form.subType) |
|
|
|
|
return item.value == this.form.subType |
|
|
|
|
}) |
|
|
|
|
|
|
|
|
|
@ -466,7 +463,6 @@ export default { |
|
|
|
|
referenceDocumentId: this.form.referenceDocumentId,//参考资料 |
|
|
|
|
imitationDocumentId: this.form.imitationDocumentId,//仿写资料 |
|
|
|
|
}; |
|
|
|
|
console.log(params) |
|
|
|
|
this.eventSource = await AiApi.chatStream(params); |
|
|
|
|
|
|
|
|
|
this.eventSource.onmessage = (event) => { |
|
|
|
|
@ -478,6 +474,7 @@ export default { |
|
|
|
|
this.editorState = true |
|
|
|
|
this.generatedEdit = this.generatedContent |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
this.closeConnection(); |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
@ -488,7 +485,6 @@ export default { |
|
|
|
|
|
|
|
|
|
// 处理思维链内容 |
|
|
|
|
if (delta.reasoning_content) { |
|
|
|
|
this.thinkState = true |
|
|
|
|
this.reasoningContent += delta.reasoning_content; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@ -499,7 +495,9 @@ export default { |
|
|
|
|
let deepTime = Math.abs(this.endTime.getTime() - this.startTime.getTime()); |
|
|
|
|
this.thinkTimes = (deepTime / 1000).toFixed(2) |
|
|
|
|
} |
|
|
|
|
this.thinkState = false |
|
|
|
|
if(this.skType==1){ |
|
|
|
|
this.thinkState = true |
|
|
|
|
}else{this.thinkState = false} |
|
|
|
|
this.generatedContent += delta.content; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|