liyongli 2 jaren geleden
bovenliggende
commit
3ef6749185

+ 11 - 1
src/router/allMedia.js

@@ -82,7 +82,17 @@ export default [
           import(
             /* webpackChunkName: "reporting" */ '../view/allMedia/reporting.vue'
           ),
-      }
+      },  
+      {
+        path: 'easy_diffusion',
+        component: () =>
+          import(/* webpackChunkName: "easyDiffusionmain" */ '../view/easyDiffusion/index.vue'),
+      },
+      {
+        path: 'qh',
+        component: () =>
+          import(/* webpackChunkName: "qhmain" */ '../view/qh/index.vue'),
+      },
     ],
   },
 ];

+ 10 - 0
src/view/allMedia/main.vue

@@ -65,6 +65,16 @@ const menu = [
     icon: 'icon-RectangleCopy',
     path: '/main_home/H5Mall',
   },
+  {
+    title: 'AI绘图',
+    icon: 'icon-RectangleCopy',
+    path: '/main_home/easy_diffusion',
+  },
+  {
+    title: 'AI对话',
+    icon: 'icon-RectangleCopy',
+    path: '/main_home/qh',
+  },
 ];
 
 for (let i = 0; i < menu.length; i++) {

+ 2 - 1
src/view/easyDiffusion/components/image.vue

@@ -58,7 +58,8 @@ const draw = () => {
   position: absolute;
   width: 6em;
   text-align: center;
-  top: 3em;
+  top: 50%;
+  transform: translateY(-50%);
   right: -7em;
 }
 </style>

+ 11 - 2
src/view/easyDiffusion/components/listItem.vue

@@ -138,7 +138,7 @@
               ><CircleClose
             /></el-icon>
             <el-image
-              :style="{ width: jindu / 2 + 'vh', height: jindu / 2 + 'vh' }"
+              :style="{ width: jindu / 2 + 'vw', height: jindu / 2 + 'vw', maxWidth: '512px', maxHeight: '512px' }"
               :src="v.image"
               :zoom-rate="1.2"
               :preview-src-list="getimgeList(item.list)"
@@ -160,6 +160,8 @@
               >
                 种子:{{ v.seed }}
               </div>
+              <br />
+              <el-button color="#202225" size="small" @click="() => setImage(v)">作为输入图片</el-button>
               <div style="margin: 5px 0">
                 <el-button
                   color="#202225"
@@ -274,7 +276,7 @@ import { ref, defineProps, defineEmits } from 'vue';
 const jindutiao = ref(null);
 const dialogVisible = ref(false);
 const jindu = ref(50);
-const emit = defineEmits(['removeItem', 'setconfig', 'makeimg']);
+const emit = defineEmits(['removeItem', 'setconfig', 'makeimg', 'setImage']);
 const props = defineProps({
   downlist: Array,
 });
@@ -300,6 +302,10 @@ const setConfig = item => {
   emit('setconfig', item);
 };
 
+const setImage = item => {
+    emit('setImage', item.image);
+}
+
 const getimgeList = list => {
   return list.map(v => v.image);
 };
@@ -555,6 +561,9 @@ input {
     font-size: 11pt;
     color: #eee;
 }
+.listItem .el-image-viewer__mask{
+    opacity: .9;
+}
 </style>
 <style scoped>
 .el-input__inner{

+ 9 - 2
src/view/easyDiffusion/index.vue

@@ -10,12 +10,12 @@
     <el-row class="body">
       <el-col :span="8">
         <div class="main left">
-          <p class="label">输入文字</p>
+          <p class="label">输入描述<small>(建议输入英文)</small></p>
           <el-input
             v-model="textarea"
             :rows="2"
             type="textarea"
-            placeholder="请输入配置文字"
+            placeholder="请输入描述内容"
           />
           <p class="label">初始图片 (img2img) <small>(可选)</small></p>
           <input
@@ -394,6 +394,7 @@
             @setconfig="setconfig"
             @removeItem="removeItem"
             @makeimg="makeimg"
+            @setImage="setImage"
             :downlist="downlist"
           />
         </div>
@@ -532,6 +533,12 @@ const selectTypeFunc = (type, i, index) => {
   else delete selectObject.value[index + '-' + i];
 };
 
+const setImage = image => {
+    console.log(image)
+    fileInput.value.fileResult = image;
+    fileInput.value.file = image;
+}
+
 const delectSelect = index => {
   delete selectObject.value[index];
 };

+ 132 - 130
src/view/qh/index.vue

@@ -1,142 +1,144 @@
 <template>
-  <h2
-    style="
-      text-align: center;
-      margin: 18px 0;
-      font-size: 25px;
-      font-family: 'Source Sans Pro', 'ui-sans-serif', 'system-ui', sans-serif;
-    "
-  >
-    ChatGLM
-  </h2>
-  <div class="chatbg tool">
-    <div
+  <div>
+    <h2
       style="
-        float: left;
-        font-size: 12px;
-        padding: 4px 8px;
-        border-right: 1px solid #e5e7eb;
-        border-bottom: 1px solid #e5e7eb;
-        border-bottom-right-radius: 7px;
+        text-align: center;
+        margin: 18px 0;
+        font-size: 25px;
+        font-family: 'Source Sans Pro', 'ui-sans-serif', 'system-ui', sans-serif;
       "
     >
-      <el-icon><ChatDotRound /></el-icon>
-      Chatbot
-    </div>
-    <div style="clear: both"></div>
-    <div class="chatGptChat" ref="chatEle">
-      <div v-for="(item, index) in chat" :key="index">
-        <div v-if="item.type === 'robot'" class="chat">
-          <div class="cahtText">
-            <textShow :text="item.text" />
+      ChatGLM
+    </h2>
+    <div class="chatbg tool">
+      <div
+        style="
+          float: left;
+          font-size: 12px;
+          padding: 4px 8px;
+          border-right: 1px solid #e5e7eb;
+          border-bottom: 1px solid #e5e7eb;
+          border-bottom-right-radius: 7px;
+        "
+      >
+        <el-icon><ChatDotRound /></el-icon>
+        Chatbot
+      </div>
+      <div style="clear: both"></div>
+      <div class="chatGptChat" ref="chatEle">
+        <div v-for="(item, index) in chat" :key="index">
+          <div v-if="item.type === 'robot'" class="chat">
+            <div class="cahtText">
+              <textShow :text="item.text" />
+            </div>
           </div>
+          <div v-if="item.type === 'user'" class="chat chatRight">
+            <div class="cahtText" v-text="item.text"></div>
+          </div>
+          <div style="clear: both"></div>
         </div>
-        <div v-if="item.type === 'user'" class="chat chatRight">
-          <div class="cahtText" v-text="item.text"></div>
-        </div>
-        <div style="clear: both"></div>
       </div>
     </div>
-  </div>
-  <div class="tool">
-    <el-row :gutter="15">
-      <el-col :span="16">
-        <el-input
-          v-model="inputText"
-          :rows="10"
-          type="textarea"
-          placeholder="请输入您的问题"
-        />
-        <el-button
-          style="
-            width: 100%;
-            color: #ea580c;
-            font-weight: 600;
-            font-size: 16px;
-            margin-top: 1em;
-          "
-          :loading="load"
-          color="#fdba74"
-          size="large"
-          @click="saveText"
-        >
-          提交
-        </el-button>
-      </el-col>
-      <el-col :span="8">
-        <el-button
-          style="width: 100%; margin-bottom: 1em"
-          color="#f3f4f6"
-          size="large"
-          @click="(chat = []), (chatlist = [])"
-        >
-          清除历史记录
-        </el-button>
-        <div class="tools">
-          <div class="toolsItem">
-            最大长度
-            <el-input-number
-              style="float: right"
-              v-model="num"
-              :min="0"
-              :max="4096"
-              @change="change"
-              controls-position="right"
-              size="small"
-            />
-            <input
-              :value="0"
-              type="range"
-              id="num"
-              style="width: 100%"
-              @input="input"
-            />
+    <div class="tool">
+      <el-row :gutter="15">
+        <el-col :span="16">
+          <el-input
+            v-model="inputText"
+            :rows="10"
+            type="textarea"
+            placeholder="请输入您的问题"
+          />
+          <el-button
+            style="
+              width: 100%;
+              color: #ea580c;
+              font-weight: 600;
+              font-size: 16px;
+              margin-top: 1em;
+            "
+            :loading="load"
+            color="#fdba74"
+            size="large"
+            @click="saveText"
+          >
+            提交
+          </el-button>
+        </el-col>
+        <el-col :span="8">
+          <el-button
+            style="width: 100%; margin-bottom: 1em"
+            color="#f3f4f6"
+            size="large"
+            @click="(chat = []), (chatlist = [])"
+          >
+            清除历史记录
+          </el-button>
+          <div class="tools">
+            <div class="toolsItem">
+              最大长度
+              <el-input-number
+                style="float: right"
+                v-model="num"
+                :min="0"
+                :max="4096"
+                @change="change"
+                controls-position="right"
+                size="small"
+              />
+              <input
+                :value="0"
+                type="range"
+                id="num"
+                style="width: 100%"
+                @input="input"
+              />
+            </div>
+            <div class="line"></div>
+            <div class="toolsItem">
+              Top P
+              <el-input-number
+                style="float: right"
+                v-model="num1"
+                :min="0"
+                :max="1"
+                :step="0.01"
+                @change="change1"
+                controls-position="right"
+                size="small"
+              />
+              <input
+                :value="0"
+                type="range"
+                id="num1"
+                style="width: 100%"
+                @input="input1"
+              />
+            </div>
+            <div class="line"></div>
+            <div class="toolsItem">
+              感情度
+              <el-input-number
+                style="float: right"
+                v-model="num2"
+                :min="0"
+                :max="1"
+                :step="0.01"
+                @change="change2"
+                controls-position="right"
+                size="small"
+              />
+              <input
+                :value="0"
+                type="range"
+                id="num2"
+                style="width: 100%"
+                @input="input2"
+              />
+            </div>
           </div>
-          <div class="line"></div>
-          <div class="toolsItem">
-            Top P
-            <el-input-number
-              style="float: right"
-              v-model="num1"
-              :min="0"
-              :max="1"
-              :step="0.01"
-              @change="change1"
-              controls-position="right"
-              size="small"
-            />
-            <input
-              :value="0"
-              type="range"
-              id="num1"
-              style="width: 100%"
-              @input="input1"
-            />
-          </div>
-          <div class="line"></div>
-          <div class="toolsItem">
-            感情度
-            <el-input-number
-              style="float: right"
-              v-model="num2"
-              :min="0"
-              :max="1"
-              :step="0.01"
-              @change="change2"
-              controls-position="right"
-              size="small"
-            />
-            <input
-              :value="0"
-              type="range"
-              id="num2"
-              style="width: 100%"
-              @input="input2"
-            />
-          </div>
-        </div>
-      </el-col>
-    </el-row>
+        </el-col>
+      </el-row>
+    </div>
   </div>
 </template>
 <script setup>