liyongli hace 1 año
padre
commit
f913fe10d5

+ 1 - 0
src/view/allMedia/AIeditor/components/brainstorming.vue

@@ -197,6 +197,7 @@ const get = p => {
   line-height: 15px;
   color: #cacaca;
 }
+
 .item {
   width: 100%;
   min-height: 45px;

+ 81 - 7
src/view/allMedia/AIeditor/components/composition.vue

@@ -19,13 +19,25 @@
     <el-form label-width="100px" :model="form" label-position="left">
       <el-form-item label="文章长度">
         <div style="text-align: right; width: 100%">
-          <el-button plain :class="{ act: form.long === 'small' }">
+          <el-button
+            @click="form.long = 'short'"
+            plain
+            :class="{ act: form.long === 'short' }"
+          >
           </el-button>
-          <el-button plain :class="{ act: form.long === 'middle' }">
+          <el-button
+            @click="form.long = 'default'"
+            plain
+            :class="{ act: form.long === 'default' }"
+          >
           </el-button>
-          <el-button plain :class="{ act: form.long === 'long' }">
+          <el-button
+            @click="form.long = 'long'"
+            plain
+            :class="{ act: form.long === 'long' }"
+          >
           </el-button>
         </div>
@@ -33,7 +45,13 @@
     </el-form>
 
     <div class="btn_group">
-      <el-button type="primary" style="width: 100%">生成内容</el-button>
+      <el-button
+        type="primary"
+        style="width: 100%"
+        :loading="load"
+        @click="create"
+        >生成内容</el-button
+      >
       <div class="bottom-content-safe-tip">
         <img :src="image_base64.tanhao" class="content-safe-tip-icon" />
         <div class="content-safe-tip-text">
@@ -45,14 +63,70 @@
 </template>
 
 <script setup>
-import { ref } from 'vue';
+import { ref, defineEmits } from 'vue';
 import { image_base64 } from './data.js';
-// import {commit} from "@/api/aleditor.js";
+import { advertisement, generate_pc_get } from '@/api/aleditor.js';
+const emits = defineEmits(['closeType', 'setHtml', 'getImage']);
 const form = ref({
   title: '',
   desc: '',
-  long: 'small'
+  long: 'small',
 });
+const load = ref(false);
+
+const create = () => {
+  load.value = true;
+  const p = {
+    count: form.value.num,
+    data: {
+      title: form.value.title,
+      prev: form.value.desc,
+      next: '',
+    },
+    generateType: 3,
+    domain: 'essay',
+    length: form.value.long,
+    noblock: true,
+    query_type: 'comment',
+  };
+  advertisement({
+    data: p,
+    noload: true,
+  }).then(r => {
+    if (r.errCode !== 0) return (load.value = false);
+    p.req = { doc_id: r.data.doc_id };
+    get(p);
+  });
+};
+
+const get = p => {
+  generate_pc_get({
+    data: p,
+    noload: true,
+  })
+    .then(res => {
+      load.value = false;
+      if (res.errCode !== 0 && res.data.status === 'RUNNING') {
+        let t = setTimeout(() => {
+          get(p);
+          clearTimeout(t);
+        }, 200);
+        return;
+      }
+      emits(
+        'setHtml',
+        '<h3>' +
+          form.value.title +
+          '</h3><p>' +
+          form.value.desc +
+          res.data.result.content +
+          '</p>'
+      );
+    })
+    .catch(() => {
+      load.value = false;
+    });
+};
 </script>
 
 <style scoped>

+ 225 - 94
src/view/allMedia/AIeditor/components/fission.vue

@@ -1,99 +1,230 @@
 <template>
-    <div class="model-item-container">
-      <br />
-      <el-form label-width="100px" :model="form" label-position="top">
-        <el-form-item label="请录入原文">
-          <el-input
-            v-model="form.title"
-            type="textarea"
-            :rows="5"
-            maxlength="1000"
-            show-word-limit
-            placeholder="随着时代的更迭、技术的演变,互联网的内容生产逐渐出现了新的流行趋势,即由AI生产内容(AIGC)。那么,这类内容的生产是否能够满足用户的需求,是否能够替代人工内容生产带给用户的体验?"
-          />
-        </el-form-item>
-      </el-form>
-      <el-form>
-        <el-form-item label="文案条数">
-          <div style="text-align: right; width: 100%">
-            <el-input-number v-model="form.num" :min="1" />
-          </div>
-        </el-form-item>
-      </el-form>
-  
-      <div class="btn_group">
-        <el-button type="primary" style="width: 100%">生成内容</el-button>
-        <div class="bottom-content-safe-tip">
-          <img
-            :src="image_base64.tanhao"
-            class="content-safe-tip-icon"
-          />
-          <div class="content-safe-tip-text">
-            声明:内容为概率模型生成,可能会产生不正确的信息,不代表我司的观点和立场
-          </div>
+  <div class="model-item-container">
+    <br />
+    <el-form label-width="100px" :model="form" label-position="top">
+      <el-form-item label="请录入原文">
+        <el-input
+          v-model="form.title"
+          type="textarea"
+          :rows="5"
+          maxlength="1000"
+          show-word-limit
+          placeholder="随着时代的更迭、技术的演变,互联网的内容生产逐渐出现了新的流行趋势,即由AI生产内容(AIGC)。那么,这类内容的生产是否能够满足用户的需求,是否能够替代人工内容生产带给用户的体验?"
+        />
+      </el-form-item>
+    </el-form>
+    <el-form>
+      <el-form-item label="文案条数">
+        <div style="text-align: right; width: 100%">
+          <el-input-number v-model="form.num" :min="1" />
+        </div>
+      </el-form-item>
+    </el-form>
+
+    <div class="btn_group">
+      <el-button
+        type="primary"
+        style="width: 100%"
+        @click="create"
+        :loading="load"
+        >生成内容</el-button
+      >
+      <div class="bottom-content-safe-tip">
+        <img :src="image_base64.tanhao" class="content-safe-tip-icon" />
+        <div class="content-safe-tip-text">
+          声明:内容为概率模型生成,可能会产生不正确的信息,不代表我司的观点和立场
         </div>
       </div>
     </div>
-  </template>
-  
-  <script setup>
-  import { ref } from 'vue';
-  import {image_base64} from "./data.js"
-  // import {commit} from "@/api/aleditor.js";
-  const form = ref({
-    title: '',
-    num: 1
+    
+    <template v-if="form.list.length">
+      <div class="item" v-for="(item, i) in form.list" :key="i">
+        <div class="content" v-text="item.text"></div>
+        <div class="btn_div">
+          <el-tooltip effect="dark" content="左侧导入" placement="top">
+            <el-icon
+              @click="() => inputText(item.text)"
+              style="
+                left: 50;
+                top: 50%;
+                transform: translate(-50%, -50%);
+                cursor: pointer;
+              "
+              color="#cacaca"
+              ><DArrowLeft
+            /></el-icon>
+          </el-tooltip>
+        </div>
+        <div class="btn_div">
+          <el-tooltip effect="dark" content="复制" placement="top">
+            <el-icon
+              style="
+                left: 50;
+                top: 50%;
+                transform: translate(-50%, -50%);
+                cursor: pointer;
+              "
+              color="#cacaca"
+              ><CopyDocument
+            /></el-icon>
+          </el-tooltip>
+        </div>
+      </div>
+    </template>
+  </div>
+</template>
+
+<script setup>
+import { ref, defineEmits } from 'vue';
+import { image_base64 } from './data.js';
+import { advertisement, generate_pc_get } from '@/api/aleditor.js';
+const emits = defineEmits(['closeType', 'setHtml', 'getImage']);
+const load = ref(false);
+const form = ref({
+  title: '',
+  num: 1,
+  list: []
+});
+const inputText = text => {
+  emits('setHtml', text);
+};
+const create = () => {
+  load.value = true;
+  const p = {
+    count: form.value.num,
+    data: {
+        prev: form.value.title
+    },
+    domain: "variation",
+    generateType: 28,
+    length: "default",
+    noblock: true,
+  };
+  advertisement({
+    data: p,
+    noload: true,
+  }).then(r => {
+    if (r.errCode !== 0) return (load.value = false);
+    p.req = { doc_id: r.data.doc_id };
+    get(p);
   });
-  </script>
-  
-  <style scoped>
-  .model-item-container {
-    text-align: center;
-    -webkit-box-flex: 1;
-    -ms-flex: 1;
-    flex: 1;
-    display: -webkit-box;
-    display: -ms-flexbox;
-    display: flex;
-    -webkit-box-orient: vertical;
-    -webkit-box-direction: normal;
-    -ms-flex-direction: column;
-    flex-direction: column;
-    min-height: 0;
-    width: 95%;
-    height: 100%;
-  }
-  
-  .act {
-    color: var(--el-button-hover-text-color);
-    border-color: var(--el-button-hover-border-color);
-    background-color: var(--el-button-hover-bg-color);
-    outline: 0;
-  }
-  
-  .btn_group {
-    padding-right: 1em;
-  }
-  .bottom-content-safe-tip {
-    display: -webkit-box;
-    display: -ms-flexbox;
-    display: flex;
-    padding: 15px 0;
-    -webkit-box-pack: center;
-    -ms-flex-pack: center;
-    justify-content: center;
-    width: 100%;
-    zoom: 0.83;
-  }
-  .bottom-content-safe-tip .content-safe-tip-icon {
-    width: 15px;
-    height: 15px;
-    margin-right: 10px;
-  }
-  .bottom-content-safe-tip .content-safe-tip-text {
-    font-size: 12px;
-    line-height: 15px;
-    color: #cacaca;
-  }
-  </style>
-  
+};
+
+const get = p => {
+  generate_pc_get({
+    data: p,
+    noload: true,
+  })
+    .then(res => {
+      load.value = false;
+      if (res.errCode !== 0 && res.data.status === 'RUNNING') {
+        let t = setTimeout(() => {
+          get(p);
+          clearTimeout(t);
+        }, 200);
+        return;
+      }
+      const list = res.data.result.content;
+      const l = [];
+      for (let i = 0; i < list.length; i++) {
+        const v = list[i];
+        l.push({
+          text: v,
+        });
+      }
+      form.value.list.push(...l);
+    })
+    .catch(() => {
+      load.value = false;
+    });
+};
+</script>
+
+<style scoped>
+.model-item-container {
+  text-align: center;
+  -webkit-box-flex: 1;
+  -ms-flex: 1;
+  flex: 1;
+  display: -webkit-box;
+  display: -ms-flexbox;
+  display: flex;
+  -webkit-box-orient: vertical;
+  -webkit-box-direction: normal;
+  -ms-flex-direction: column;
+  flex-direction: column;
+  min-height: 0;
+  width: 95%;
+  height: 100%;
+}
+
+.act {
+  color: var(--el-button-hover-text-color);
+  border-color: var(--el-button-hover-border-color);
+  background-color: var(--el-button-hover-bg-color);
+  outline: 0;
+}
+
+.btn_group {
+  padding-right: 1em;
+}
+.bottom-content-safe-tip {
+  display: -webkit-box;
+  display: -ms-flexbox;
+  display: flex;
+  padding: 15px 0;
+  -webkit-box-pack: center;
+  -ms-flex-pack: center;
+  justify-content: center;
+  width: 100%;
+  zoom: 0.83;
+}
+.bottom-content-safe-tip .content-safe-tip-icon {
+  width: 15px;
+  height: 15px;
+  margin-right: 10px;
+}
+.bottom-content-safe-tip .content-safe-tip-text {
+  font-size: 12px;
+  line-height: 15px;
+  color: #cacaca;
+}
+
+.item {
+  width: 100%;
+  min-height: 45px;
+  -webkit-box-sizing: border-box;
+  box-sizing: border-box;
+  margin-bottom: 20px;
+  text-align: left;
+  position: relative;
+  padding: 10px 10px 10px 0;
+  display: flex;
+  -webkit-box-align: center;
+  -ms-flex-align: center;
+  align-items: center;
+  border-bottom: 1px solid #eee;
+}
+
+.content {
+  -webkit-box-flex: 1;
+  -ms-flex: 1;
+  flex: 1;
+  outline: none;
+  line-height: 28px;
+  text-align: justify;
+  overflow-y: auto;
+}
+
+.hover_class,
+.item:hover {
+  background-color: #f5f5f5;
+  border-bottom: 1px solid #f8f8f8;
+}
+
+.btn_div {
+  height: 30px;
+  width: 30px;
+  position: relative;
+}
+</style>

+ 73 - 7
src/view/allMedia/AIeditor/components/novel.vue

@@ -18,13 +18,25 @@
     <el-form label-width="100px" :model="form" label-position="left">
       <el-form-item label="文章长度">
         <div style="text-align: right; width: 100%">
-          <el-button plain :class="{ act: form.long === 'small' }">
+          <el-button
+            @click="form.long = 'short'"
+            plain
+            :class="{ act: form.long === 'short' }"
+          >
           </el-button>
-          <el-button plain :class="{ act: form.long === 'middle' }">
+          <el-button
+            @click="form.long = 'default'"
+            plain
+            :class="{ act: form.long === 'default' }"
+          >
           </el-button>
-          <el-button plain :class="{ act: form.long === 'long' }">
+          <el-button
+            @click="form.long = 'long'"
+            plain
+            :class="{ act: form.long === 'long' }"
+          >
           </el-button>
         </div>
@@ -32,7 +44,13 @@
     </el-form>
 
     <div class="btn_group">
-      <el-button type="primary" style="width: 100%">生成内容</el-button>
+      <el-button
+        type="primary"
+        style="width: 100%"
+        :loading="load"
+        @click="create"
+        >生成内容</el-button
+      >
       <div class="bottom-content-safe-tip">
         <img :src="image_base64.tanhao" class="content-safe-tip-icon" />
         <div class="content-safe-tip-text">
@@ -44,14 +62,62 @@
 </template>
 
 <script setup>
-import { ref } from 'vue';
+import { ref,defineEmits } from 'vue';
 import { image_base64 } from './data.js';
-// import {commit} from "@/api/aleditor.js";
+import { advertisement, generate_pc_get } from '@/api/aleditor.js';
+const emits = defineEmits(['closeType', 'setHtml', 'getImage']);
 const form = ref({
   title: '',
   desc: '',
-  long: 'small'
+  long: 'small',
 });
+const load = ref(false);
+
+const create = () => {
+  load.value = true;
+  const p = {
+    count: form.value.num,
+    data: {
+      title: form.value.title,
+      prev: form.value.desc,
+      next: ""
+    },
+    generateType: 2,
+    domain: "novel",
+    length: form.value.long,
+    noblock: true,
+    query_type: 'comment',
+  };
+  advertisement({
+    data: p,
+    noload: true,
+  }).then(r => {
+    if (r.errCode !== 0) return (load.value = false);
+    p.req = { doc_id: r.data.doc_id };
+    get(p);
+  });
+};
+
+const get = p => {
+  generate_pc_get({
+    data: p,
+    noload: true,
+  })
+    .then(res => {
+      load.value = false;
+      if (res.errCode !== 0 && res.data.status === 'RUNNING') {
+        let t = setTimeout(() => {
+          get(p);
+          clearTimeout(t);
+        }, 200);
+        return;
+      }
+      emits('setHtml', '<h3>' + form.value.title + '</h3><p>' + form.value.desc + res.data.result.content + '</p>');
+    })
+    .catch(() => {
+      load.value = false;
+    });
+};
 </script>
 
 <style scoped>

+ 146 - 10
src/view/allMedia/AIeditor/components/poetry.vue

@@ -4,7 +4,7 @@
     <el-form label-position="top">
       <el-form-item label="请输入诗歌主题">
         <el-input
-          v-model="form.desc"
+          v-model="form.title"
           type="textarea"
           :rows="5"
           :maxlength="1000"
@@ -16,11 +16,11 @@
       <el-form-item label="选择语气">
         <div style="text-align: right; width: 100%">
           <el-select v-model="form.region">
-            <el-option label="现代诗" value="现代诗1" />
-            <el-option label="五言绝句" value="五言绝句1" />
-            <el-option label="七言绝句" value="七言绝句1" />
-            <el-option label="五言律诗" value="五言律诗1" />
-            <el-option label="七言律诗" value="七言律诗1" />
+            <el-option label="现代诗" value="现代诗" />
+            <el-option label="五言绝句" value="五言绝句" />
+            <el-option label="七言绝句" value="七言绝句" />
+            <el-option label="五言律诗" value="五言律诗" />
+            <el-option label="七言律诗" value="七言律诗" />
           </el-select>
         </div>
       </el-form-item>
@@ -32,7 +32,13 @@
     </el-form>
 
     <div class="btn_group">
-      <el-button type="primary" style="width: 100%">生成内容</el-button>
+      <el-button
+        type="primary"
+        style="width: 100%"
+        @click="create"
+        :loading="load"
+        >生成内容</el-button
+      >
       <div class="bottom-content-safe-tip">
         <img :src="image_base64.tanhao" class="content-safe-tip-icon" />
         <div class="content-safe-tip-text">
@@ -40,18 +46,111 @@
         </div>
       </div>
     </div>
+
+    <template v-if="form.list.length">
+      <div class="item" v-for="(item, i) in form.list" :key="i">
+        <div class="content" v-text="item.text"></div>
+        <div class="btn_div">
+          <el-tooltip effect="dark" content="左侧导入" placement="top">
+            <el-icon
+              @click="() => inputText(item.text)"
+              style="
+                left: 50;
+                top: 50%;
+                transform: translate(-50%, -50%);
+                cursor: pointer;
+              "
+              color="#cacaca"
+              ><DArrowLeft
+            /></el-icon>
+          </el-tooltip>
+        </div>
+        <div class="btn_div">
+          <el-tooltip effect="dark" content="复制" placement="top">
+            <el-icon
+              style="
+                left: 50;
+                top: 50%;
+                transform: translate(-50%, -50%);
+                cursor: pointer;
+              "
+              color="#cacaca"
+              ><CopyDocument
+            /></el-icon>
+          </el-tooltip>
+        </div>
+      </div>
+    </template>
   </div>
 </template>
 
 <script setup>
-import { ref } from 'vue';
+import { ref, defineEmits } from 'vue';
 import { image_base64 } from './data.js';
-// import {commit} from "@/api/aleditor.js";
+import { advertisement, generate_pc_get } from '@/api/aleditor.js';
+const emits = defineEmits(['closeType', 'setHtml', 'getImage']);
+const load = ref(false);
 const form = ref({
   num: 1,
-  desc: '',
+  title: '',
   region: '现代诗',
+  list: [],
 });
+const inputText = text => {
+  emits('setHtml', text);
+};
+
+const create = () => {
+  load.value = true;
+  const p = {
+    count: form.value.num,
+    data: {
+      title: form.value.title,
+      attribute: form.value.region,
+    },
+    generateType: 20,
+    length: 'default',
+    noblock: true,
+    query_type: 'poetry',
+  };
+  advertisement({
+    data: p,
+    noload: true,
+  }).then(r => {
+    if (r.errCode !== 0) return (load.value = false);
+    p.req = { doc_id: r.data.doc_id };
+    get(p);
+  });
+};
+
+const get = p => {
+  generate_pc_get({
+    data: p,
+    noload: true,
+  })
+    .then(res => {
+      load.value = false;
+      if (res.errCode !== 0 && res.data.status === 'RUNNING') {
+        let t = setTimeout(() => {
+          get(p);
+          clearTimeout(t);
+        }, 200);
+        return;
+      }
+      const list = res.data.result.content;
+      const l = [];
+      for (let i = 0; i < list.length; i++) {
+        const v = list[i];
+        l.push({
+          text: v,
+        });
+      }
+      form.value.list.push(...l);
+    })
+    .catch(() => {
+      load.value = false;
+    });
+};
 </script>
 
 <style scoped>
@@ -113,4 +212,41 @@ const form = ref({
   line-height: 15px;
   color: #cacaca;
 }
+.item {
+  width: 100%;
+  min-height: 45px;
+  -webkit-box-sizing: border-box;
+  box-sizing: border-box;
+  margin-bottom: 20px;
+  text-align: left;
+  position: relative;
+  padding: 10px 10px 10px 0;
+  display: flex;
+  -webkit-box-align: center;
+  -ms-flex-align: center;
+  align-items: center;
+  border-bottom: 1px solid #eee;
+}
+
+.content {
+  -webkit-box-flex: 1;
+  -ms-flex: 1;
+  flex: 1;
+  outline: none;
+  line-height: 28px;
+  text-align: justify;
+  overflow-y: auto;
+}
+
+.hover_class,
+.item:hover {
+  background-color: #f5f5f5;
+  border-bottom: 1px solid #f8f8f8;
+}
+
+.btn_div {
+  height: 30px;
+  width: 30px;
+  position: relative;
+}
 </style>

+ 84 - 9
src/view/allMedia/AIeditor/components/product_review.vue

@@ -6,30 +6,54 @@
         <el-input v-model="form.title" :maxlength="100" show-word-limit />
       </el-form-item>
       <el-form-item label="产品描述">
-        <el-input v-model="form.desc" type="textarea" :rows="5" :maxlength="1000" show-word-limit />
+        <el-input
+          v-model="form.desc"
+          type="textarea"
+          :rows="5"
+          :maxlength="1000"
+          show-word-limit
+        />
       </el-form-item>
       <el-form-item label="文案长度">
         <div style="text-align: right; width: 100%">
-          <el-button plain :class="{ act: form.long === 'small' }">
+          <el-button
+            @click="form.long = 'short'"
+            plain
+            :class="{ act: form.long === 'short' }"
+          >
           </el-button>
-          <el-button plain :class="{ act: form.long === 'middle' }">
+          <el-button
+            @click="form.long = 'default'"
+            plain
+            :class="{ act: form.long === 'default' }"
+          >
           </el-button>
-          <el-button plain :class="{ act: form.long === 'long' }">
+          <el-button
+            @click="form.long = 'long'"
+            plain
+            :class="{ act: form.long === 'long' }"
+          >
           </el-button>
         </div>
       </el-form-item>
       <el-form-item label="文案条数">
         <div style="text-align: right; width: 100%">
-            <el-input-number v-model="form.num" :min="1" />
+          <el-input-number v-model="form.num" :min="1" />
         </div>
       </el-form-item>
     </el-form>
 
     <div class="btn_group">
-      <el-button type="primary" style="width: 100%;">生成文案</el-button>
+      <el-button
+        type="primary"
+        style="width: 100%"
+        :loading="load"
+        @click="create"
+        >生成文案</el-button
+      >
       <div class="bottom-content-safe-tip">
         <img :src="image_base64.tanhao" class="content-safe-tip-icon" />
         <div class="content-safe-tip-text">
@@ -41,16 +65,67 @@
 </template>
 
 <script setup>
-import { ref } from 'vue';
+import { ref, defineEmits } from 'vue';
 import { image_base64 } from './data.js';
-// import {commit} from "@/api/aleditor.js";
+import { advertisement, generate_pc_get } from '@/api/aleditor.js';
+const emits = defineEmits(['closeType', 'setHtml', 'getImage']);
 const form = ref({
   title: '',
   num: 1,
-  long: 'small',
+  long: 'short',
   desc: '',
 });
+const load = ref(false);
 
+const create = () => {
+  load.value = true;
+  const p = {
+    count: form.value.num,
+    data: {
+      title: form.value.title,
+      occupation: form.value.career,
+      type: form.value.type,
+    },
+    generateType: 15,
+    length: form.value.long,
+    noblock: true,
+    query_type: 'comment',
+  };
+  advertisement({
+    data: p,
+    noload: true,
+  }).then(r => {
+    if (r.errCode !== 0) return (load.value = false);
+    p.req = { doc_id: r.data.doc_id };
+    get(p);
+  });
+};
+
+const get = p => {
+  generate_pc_get({
+    data: p,
+    noload: true,
+  })
+    .then(res => {
+      load.value = false;
+      if (res.errCode !== 0 && res.data.status === 'RUNNING') {
+        let t = setTimeout(() => {
+          get(p);
+          clearTimeout(t);
+        }, 200);
+        return;
+      }
+      const list = res.data.result.content;
+      let t = '';
+      list.map(v => {
+        t += '<p>' + v + '</p>';
+      });
+      emits('setHtml', t);
+    })
+    .catch(() => {
+      load.value = false;
+    });
+};
 </script>
 
 <style scoped>