From dfe5009e5d39c90586556376c2432f5e7ec2eb86 Mon Sep 17 00:00:00 2001
From: 622aa39c1f9b166ab1a38c05 <622aa39c1f9b166ab1a38c05@devide>
Date: Fri, 7 Jul 2023 08:01:01 +0000
Subject: [PATCH] Fri Jul  7 08:01:01 UTC 2023 inscode

---
 src/App.vue      | 26 ++++++++++++++++++--------
 src/js/config.js |  2 +-
 2 files changed, 19 insertions(+), 9 deletions(-)

diff --git a/src/App.vue b/src/App.vue
index 3bdc0cf..f39fe72 100644
--- a/src/App.vue
+++ b/src/App.vue
@@ -23,14 +23,14 @@
 
         <t-form labelAlign="top">
           <t-form-item label="StableDiffusion服务器类型" name="sdServerType">
-            <t-select v-model="sdServerType" @change="handleSDServerTypeChange">
+            <t-select v-model="sdServerType" @change="handleSDServerTypeChange" class="bg-gray-200" style="background: #ccc;font-size:12px;">
               <t-option v-for="(item, index) in sdServerTypeOptions" :key="index" :value="item.value" :label="item.label">
                 {{ item.label }}
               </t-option>
             </t-select>
           </t-form-item>
           <t-form-item label="服务器地址" name="sdServerUrl">
-            <t-textarea placeholder="请输入内容" v-model="sdServerUrl" :autosize="true"/>
+            <t-textarea placeholder="请输入内容" v-model="sdServerUrl" :autosize="true" @change="saveConfig"/>
           </t-form-item>
         </t-form>
         <t-card class="bg-orange-100 mt-8 text-gray-600 text-sm" v-if="sdServerType === 'common'">
@@ -192,7 +192,7 @@ export default {
         { label: '公共服务器', value: 'common' },
         { label: '私有服务器', value: 'private' },
       ],
-      sdServerUrl: 'https://gpu-pod64a4ff02b54fe048c07abc40-6006.node.inscode.run/sdapi/v1/txt2img',
+      sdServerUrl: '',
       loading: false,
       maxHistory: 200,
       speaking: false, // 是否正在输出语音
@@ -313,7 +313,11 @@ export default {
       const negative_prompt = this.negative_prompt
       const _this = this
       const messages = this.message
-      messages.push({ "user": "User", "message": 'prompt: <br/>' + this.prompt + (negative_prompt ? '<br/>' + 'negative_prompt: </br>' + negative_prompt : '')   })
+      const content = 'prompt: <br/>' + 
+                        this.prompt + 
+                        (negative_prompt ? '<br/><br/>' + 'negative_prompt: </br>' + negative_prompt : '') + '<br/><br/>' +
+                        'width: ' + this.width + ' height: ' + this.height + '<br/>steps: ' + this.steps +'<br/>sampler: ' + this.sampler 
+      messages.push({ "user": "User", "message": content })
 
       messages.push(currentMsg)
 
@@ -473,13 +477,12 @@ export default {
     copyAsPrompt (message) {
       this.prompt = message
     },
-    handleServerTypeChange (type) {
+    handleSDServerTypeChange (type) {
       
       if (type === 'common') {
         this.sdServerUrl = this.config.common_sd_api
       }
-      
-      console.info(123)
+      this.saveConfig()
     },
     recoverConfig () {
       const config = localStorage.getItem('ai-config')
@@ -488,18 +491,25 @@ export default {
         this.config = configJSON
         this.sdServerType = configJSON.sdServerType
         this.sdServerUrl = configJSON.sdServerUrl
+        this.sdServerType = configJSON.sdServerType??'common'
+
+        const data = Config.getData().data
+        this.name = data.name
+        document.title = this.name
       } else {
 
         this.getAppInfo()
         this.sdServerUrl = this.config.common_sd_api
+        this.sdServerType = 'common'
         
       }
     },
     saveConfig () {
-
+      
       const config = JSON.parse(JSON.stringify(this.config))
       config.sdServerType = this.sdServerType
       config.sdServerUrl = this.sdServerUrl
+      config.sdServerType = this.sdServerType
       localStorage.setItem('ai-config', JSON.stringify(config))
     }
   },
diff --git a/src/js/config.js b/src/js/config.js
index 0127adb..440f40c 100644
--- a/src/js/config.js
+++ b/src/js/config.js
@@ -4,7 +4,7 @@ export default {
             "code": 200,
             "data": {
                 "id": 128897,
-                "name": "小羊驼",
+                "name": "AI绘图",
                 "create_time": 1684920670901,
                 "app": "llm_rep",
                 "resource_type": "app",
-- 
GitLab