main
han 5 months ago
parent 9c6e199097
commit 4e11ae587a
  1. 2
      package.json
  2. 5
      src/assets/styles/v-layout.scss
  3. 4
      src/views/components/v-editor/index1.vue
  4. 1
      src/views/pages/AI-Document-Correction/dialog.vue
  5. 1
      src/views/pages/AI-Document-Writing/dialog.vue
  6. 90
      src/views/pages/AI-Marketing-Writing/dialog.vue

@ -46,8 +46,6 @@
"@ckeditor/ckeditor5-html-support": "^45.1.0",
"@ckeditor/ckeditor5-vue2": "^3.0.1",
"@riophae/vue-treeselect": "0.4.0",
"@wangeditor/editor": "^5.1.23",
"@wangeditor/editor-for-vue": "^1.0.2",
"aieditor": "^1.3.8",
"axios": "0.27.2",
"benz-amr-recorder": "^1.1.5",

@ -745,6 +745,7 @@ body {
}
/* 页面 框架 ==========================================*/
.aie-container .aie-resize-wrapper img{width: 100%!important;}
.ai-pages {
position: relative;
height: 100%;
@ -872,9 +873,9 @@ body {
.ai-editor_html {
font-size: 16px;
height: calc(100% - 90px);
img{margin: 20px;}
padding: 30px 0;
h1,h2,h3{margin-top: 20px; margin-bottom: 15px;}
p {
line-height: 1.75;
margin-bottom: 20px;

@ -39,6 +39,10 @@ export default {
items: ["Bold", "Italic", "Underline", "Strike", "code", "comment"],
},
})
},methods:{
getAiEditor(){
return this.aiEditor.getMarkdown()
}
}
}
</script>

@ -559,4 +559,3 @@ export default {
}
</script>
<style src="@wangeditor/editor/dist/css/style.css"></style>

@ -290,7 +290,6 @@ export default {
}
</script>
<style src="@wangeditor/editor/dist/css/style.css"></style>
<style>
s {
text-decoration: none;

@ -14,18 +14,20 @@
<el-skeleton :rows="1" animated/>
</div>
<div v-else class="complete row flex-align-center">
<div class="col"><i class="el-icon-circle-check"></i>文章已生成
</div>
<div class="col"><i class="el-icon-circle-check"></i>文章已生成</div>
<el-button type="primary" @click="insertEditor"
v-if="isComplete">插入
</el-button>
</div>
<div class="ai-editor_html v-overflow-y" ref="generatedContent" v-html="formattedText"></div>
<div class="ai-editor_html v-overflow-y" ref="generatedContent" v-html="rawTextChunks"></div>
<div class="ai-editor__tips" v-if="isComplete"><i class="el-icon-warning-outline"></i>内容由AI生成请注意甄别真实性
</div>
</div>
</div>
<VEditor :content="EditorText"></VEditor>
<VEditor :content="EditorText" ref="vEditor"></VEditor>
<div class="v-edit-tool" v-if="!isGenerating">
<div class="v-edit-tool-item down" @click="downLoadDoc"><i class="iconfont icon-down"></i></div>
</div>
</div>
<!-- 对话右侧 -->
<div class="ai-edit-right m-r-large" :class="showPage?'show':'hide'">
@ -107,10 +109,20 @@
</el-form>
</div>
<div class="ai-ecode-bot">
<el-button :disabled="!isComplete" type="primary" size="small" style="width: 100%;"
@click="generateContent">
<i class="iconfont icon-generate ai-icon-small"></i> 重新生成
</el-button>
<el-row :gutter="20">
<el-col :span="12">
<el-button :disabled="!isComplete" type="primary" size="small" style="width: 100%;"
@click="generateContent">
<i class="iconfont icon-generate ai-icon-small"></i> 重新生成
</el-button>
</el-col>
<el-col :span="12">
<el-button :disabled="!isComplete" type="primary" size="small" style="width: 100%;"
@click="generateContent">
<i class="el-icon-download ai-icon-small"></i> MarkDown下载
</el-button>
</el-col>
</el-row>
</div>
</div>
</div>
@ -178,13 +190,18 @@
>
<div class="ai-knowledge-dialog">
<div class="knowledge-search">
<div class="row flex-align-center flex-justify-end text-right" v-if="!searchState" @click="searchState=true"><i class="el-icon-search m-r-mimi"></i>搜索
<div class="row flex-align-center flex-justify-end text-right" v-if="!searchState" @click="searchState=true">
<i class="el-icon-search m-r-mimi"></i>搜索
<el-divider direction="vertical"></el-divider>
</div>
<div v-else>
<el-input placeholder="请输入内容" v-model="input2">
<template slot="prepend"><el-button slot="append" icon="el-icon-arrow-left" @click="searchState=false"></el-button></template>
<template slot="append"> <el-button slot="append" icon="el-icon-search"></el-button></template>
<template slot="prepend">
<el-button slot="append" icon="el-icon-arrow-left" @click="searchState=false"></el-button>
</template>
<template slot="append">
<el-button slot="append" icon="el-icon-search"></el-button>
</template>
</el-input>
</div>
</div>
@ -227,7 +244,7 @@
<script>
import FileUpload from '@/components/FileUpload2'
import VEditor from "@/views/components/v-editor/index.vue";
import VEditor from "@/views/components/v-editor/index1.vue";
import * as AiApi from '@/api/ai-api'
import MarkdownIt from "markdown-it";
import {getUrlContent} from '@/api/ai-api'
@ -250,9 +267,8 @@ export default {
};
return {
buffer: "",
partialHTML: "",
md: new MarkdownIt(),
rawTextChunks: [],
rawTextChunks: "",
EditorText: "",
validate: validateUrl,
showPage: true,//
@ -281,11 +297,7 @@ export default {
searchState: false
}
},
computed: {
formattedText() {
return this.rawTextChunks.join('');
}
},
computed: {},
mounted() {
if (this.$route.params.prompt) {
this.form.prompt = this.$route.params.prompt
@ -293,13 +305,18 @@ export default {
} else {
this.form.prompt = localStorage.getItem('prompt')
}
this.isComplete = true
//this.generateContent();
//this.isComplete = true
this.generateContent();
},
methods: {
downLoadDoc(){
console.log(this.$refs,this.$refs['vEditor'].getAiEditor())
},
insertEditor() {
this.isGenerating = false
this.EditorText = this.partialHTML
this.EditorText = this.rawTextChunks
},
processChunk(Chunk) {
if (!Chunk) {
@ -307,21 +324,21 @@ export default {
} else {
this.buffer += Chunk;
}
// - Markdown
let lastNewLine
lastNewLine = this.buffer.lastIndexOf(' <br>');
if (lastNewLine === -1) return '';
const complete = this.buffer.substring(0, lastNewLine);
this.buffer = this.buffer.substring(lastNewLine);
let lastNewLine = this.buffer.lastIndexOf(' <br>');
let html
// HTML
if (complete.includes('img')) {
html = complete.replace(' <br>', '')
if (this.buffer.includes('#')) {
if (lastNewLine === -1) return '';
const complete = this.buffer.substring(0, lastNewLine);
html = this.md.render(complete);
this.buffer = ""
} else {
html = this.md.render(complete.replace(' <br>', ''));
if (lastNewLine != -1) {
this.buffer = ""
} else {
html = Chunk
}
}
this.partialHTML += html;
return html;
return html
},
/** 生成 页面内容 */
async generateContent(type) {
@ -340,7 +357,7 @@ export default {
})
}
//
this.rawTextChunks = []
this.rawTextChunks = ""
this.isGenerating = true;
this.isComplete = false;
this.progressText = ""
@ -376,7 +393,7 @@ export default {
try {
const html = this.processChunk(data);
if (html) {
this.rawTextChunks.push(html); // HTML
this.rawTextChunks += html; // HTML
this.$nextTick(this.scrollToBottom('generatedContent'))
}
} catch (e) {
@ -579,4 +596,3 @@ export default {
}
</script>
<style src="@wangeditor/editor/dist/css/style.css"></style>

Loading…
Cancel
Save