chenrong 9 hónapja
szülő
commit
ed815b2ae8

+ 5 - 6
src/views/chat/ChatH5.vue

@@ -702,12 +702,11 @@ export default {
       // 模型选中角色默认模型
       this.configForm.radio2 = this.info.modelId
       // 如果用户有设置过模型使用用户设置模型
-      let userConfig = Cookies.get(`userConfig_${this.$store.state.user.userId}_${this.info.id}`)
-      if (userConfig) {
-        userConfig = JSON.parse(userConfig)
-      }
-      if (userConfig && userConfig.radio2) {
-        this.configForm.radio2 = userConfig.radio2
+      if (Cookies.get(`userConfig_${this.$store.state.user.userId}_${this.info.id}`)) {
+        let userConfig = JSON.parse(Cookies.get(`userConfig_${this.$store.state.user.userId}_${this.info.id}`))
+        if (userConfig.radio2) {
+          this.configForm.radio2 = userConfig.radio2
+        }
       }
       // let HistoryMessage = JSON.parse(localStorage.getItem(`[userId:${123},aiId:${this.info.id}]`));
       // if (HistoryMessage) {

+ 38 - 25
src/views/chat/ChatHistoryH5.vue

@@ -5,14 +5,13 @@
       <i class="el-icon-circle-plus-outline absolute right-3 text-xl"></i>
     </div>
     <div class="list flex-1 overflow-auto">
-      <div
-        class="flex flex-col"
-      >
-        <div class="listItem p-2 flex items-center mb-1" v-for="(item, index) in allRecords" :key="index" @click="toChat(item)">
-          <div class="img h-10 w-10">
+      <div class="flex flex-col">
+        <div class="listItem p-2 flex items-center mb-1" v-for="(item, index) in allRecords" :key="index"
+          @click="toChat(item)">
+          <div class="img">
             <img :src="baseApi + item.picture" class="w-full h-full object-cover rounded-full" />
           </div>
-          <div class="info flex-1 flex flex-col text-sm ml-2">
+          <div class="info flex flex-col text-sm ml-2">
             <div>{{ item.characterName }}</div>
             <div class="text2 text-gray-500">{{ item.firstContent }}</div>
           </div>
@@ -70,23 +69,37 @@ export default {
 </script>
 
 <style scopod>
-  .liet {
-    padding-bottom: 60px;
-  }
-  .liet::-webkit-scrollbar {
-    display: none;
-  }
-  .text2 {
-    overflow:hidden;
-    text-overflow: ellipsis;
-    -webkit-line-clamp: 1;
-    display: -webkit-box;
-    -webkit-box-orient: vertical;
-  }
-  .listItem {
-    border-bottom: solid 1px #f1f1f1;
-  }
-  .listItem:last-child {
-    border-bottom: none;
-  }
+.liet {
+  padding-bottom: 60px;
+}
+
+.liet::-webkit-scrollbar {
+  display: none;
+}
+
+.text2 {
+  overflow: hidden;
+  text-overflow: ellipsis;
+  -webkit-line-clamp: 1;
+  display: -webkit-box;
+  -webkit-box-orient: vertical;
+  width: 100%;
+}
+
+.listItem {
+  border-bottom: solid 1px #f1f1f1;
+}
+
+.listItem>.img {
+  width: 40px;
+  height: 40px;
+}
+
+.listItem>.info {
+  width: calc(100% - 50px);
+}
+
+.listItem:last-child {
+  border-bottom: none;
+}
 </style>

+ 59 - 9
src/views/chat/ChatPC.vue

@@ -11,7 +11,8 @@
               </div>
               <div class="info flex-1 ml-2 flex flex-col justify-around">
                 <div class="text-sm font-semibold">{{ item.characterName }}</div>
-                <div class="text-sm text-gray-400">{{ item.prologue }}</div>
+                <div class="text-sm text-gray-400">{{ item.prologue }}
+                </div>
               </div>
               <div class="flex items-center text-lg" style="height: 48px;">
                 <i v-if="!item.open" class="el-icon-arrow-down" style="font-size: 16px;"></i>
@@ -98,11 +99,16 @@
                     <i class="el-icon-document"></i>
                     简介
                   </div>
-                  <div class="mt-3 text-sm max-h-48">
-                    {{ info.prologue }}
+                  <div class="flex">
+                    <div ref="prologue" class="mt-3 text-sm max-h-48 prologue" :class="showPrologue && 'prologueOpen'">
+                      <div v-show="showPrologueButton" class="textButton" @click="showPrologue = !showPrologue">{{
+                        showPrologue ? '收起' :
+                        '展开' }}</div>
+                      {{ info.prologue }}
+                    </div>
                   </div>
                 </div>
-                <div class="flex justify-between items-center  mt-5 text-base pb-3 border-b border-gray-200">
+                <div class="flex justify-between items-center mt-5 text-base pb-3 border-b border-gray-200">
                   <div>
                     <i class="el-icon-user"></i>
                     创作人
@@ -415,6 +421,10 @@ export default {
   },
   data() {
     return {
+      // 展开收起简介按钮是否显示
+      showPrologueButton: false,
+      // 展开收起简介
+      showPrologue: false,
       // 对话请求超时参数
       timeOut: null,
       // 聊天等待
@@ -485,7 +495,6 @@ export default {
       }
     },
     notChatSend() {
-      console.log(this.audioPlayIndex, 'this.audioPlayIndex>>>>>>>>>>>');
       return this.chatLoading != false || this.audioPlayIndex != null
     },
     showNodata() {
@@ -495,7 +504,6 @@ export default {
   mounted() {
     this.init()
     this.$nextTick(() => {
-      console.log(this.$refs.audio.paused, '>>>>>>>>>>>>>');
     })
   },
   watch: {
@@ -919,12 +927,17 @@ export default {
       let res = await detailApi(id)
       console.log(res, '角色详情');
       this.info = res.data
+      this.$nextTick(() => {
+        this.showPrologueButton = this.$refs.prologue.scrollHeight > this.$refs.prologue.offsetHeight
+      })
       // 模型选中角色默认模型
       this.configForm.radio2 = this.info.modelId
       // 如果用户有设置过模型使用用户设置模型
-      let userConfig = JSON.parse(Cookies.get(`userConfig_${this.$store.state.user.userId}_${this.info.id}`))
-      if (userConfig.radio2) {
-        this.configForm.radio2 = userConfig.radio2
+      if (Cookies.get(`userConfig_${this.$store.state.user.userId}_${this.info.id}`)) {
+        let userConfig = JSON.parse(Cookies.get(`userConfig_${this.$store.state.user.userId}_${this.info.id}`))
+        if (userConfig.radio2) {
+          this.configForm.radio2 = userConfig.radio2
+        }
       }
       // let HistoryMessage = JSON.parse(localStorage.getItem(`[userId:${123},aiId:${this.info.id}]`));
       // if (HistoryMessage) {
@@ -951,6 +964,7 @@ export default {
           }
         }
       } else {
+        console.log('fffffffffffffffffffffff');
         this.returnMessage.push({
           role: 'assistant',
           content: this.info.firstContent
@@ -1744,6 +1758,42 @@ export default {
 .planeColor {
   color: var(--bg-color1);
 }
+
+.prologue {
+  position: relative;
+  display: -webkit-box;
+  -webkit-line-clamp: 3;
+  -webkit-box-orient: vertical;
+  overflow: hidden;
+  padding-bottom: 4px;
+
+  .textButton {
+    // display: inline-block;
+    float: right;
+    clear: both;
+    color: #fff;
+    padding: 0 5px;
+    border-radius: 5px;
+    background: var(--bg-color1);
+    font-size: 12px;
+    cursor: pointer;
+  }
+}
+
+.prologueOpen {
+  -webkit-line-clamp: 20;
+}
+
+.prologueOpen::before {}
+
+.prologue::before {
+  content: '';
+  float: right;
+  // width: 10px;
+  height: calc(100% - 20px);
+  /*先随便设置一个高度*/
+  background: red
+}
 </style>
 <style scoped>
 .loadingMessage>>>.el-loading-parent--relative {

+ 4 - 2
src/views/create/createH5.vue

@@ -29,7 +29,8 @@
                       <el-input v-model="form.characterName" placeholder="填写名称"></el-input>
                     </el-form-item>
                     <el-form-item label="简介" prop="prologue">
-                      <el-input v-model="form.prologue" type="textarea" :autosize="{ minRows: 3, maxRows: 3 }"
+                      <el-input v-model="form.prologue" type="textarea" maxlength="1000" show-word-limit
+                        :autosize="{ minRows: 3, maxRows: 3 }"
                         placeholder="介绍一下你要值造的这个机器人。应段介绍只会是示在机器人的角色详情信息中,不会出现在提示词中,也不会影响到你的机器人。"></el-input>
                     </el-form-item>
                     <el-form-item label="性别" prop="sex">
@@ -72,10 +73,11 @@
               </el-form-item>
               <el-form-item label="开场白" prop="firstContent" label-width="80px" style="margin-bottom: 20px;">
                 <el-input v-model="form.firstContent" type="textarea" :autosize="{ minRows: 4, maxRows: 4 }"
-                  placeholder="帮您的机器人设计一段开场白吧"></el-input>
+                  maxlength="400" show-word-limit placeholder="帮您的机器人设计一段开场白吧"></el-input>
               </el-form-item>
               <el-form-item label="角色描述" prop="characterIntroduction" label-width="80px">
                 <el-input v-model="form.characterIntroduction" type="textarea" :autosize="{ minRows: 4, maxRows: 4 }"
+                  maxlength="400" show-word-limit
                   placeholder="通过设置机器人的指令和反馈,机器人在玩家互动时即时回复,增强玩家的互动,有什么较好的指令。我们会对指令的使用情况进行了解,确保指令的正常使用。"></el-input>
               </el-form-item>
               <el-form-item label="场景" prop="scene" label-width="80px" style="margin-bottom: 20px;">

+ 6 - 3
src/views/create/createPC.vue

@@ -31,6 +31,7 @@
                   </el-form-item>
                   <el-form-item label="简介" prop="prologue">
                     <el-input v-model="form.prologue" type="textarea" :autosize="{ minRows: 3, maxRows: 3 }"
+                      maxlength="1000" show-word-limit
                       placeholder="介绍一下你要值造的这个机器人。应段介绍只会是示在机器人的角色详情信息中,不会出现在提示词中,也不会影响到你的机器人。"></el-input>
                   </el-form-item>
                   <el-form-item label="性别" prop="sex">
@@ -75,21 +76,23 @@
 
               <el-form-item label="开场白" prop="firstContent" label-width="80px" style="margin-bottom: 20px;">
                 <el-input v-model="form.firstContent" type="textarea" :autosize="{ minRows: 4, maxRows: 4 }"
-                  placeholder="帮您的机器人设计一段开场白吧"></el-input>
+                  maxlength="400" show-word-limit placeholder="帮您的机器人设计一段开场白吧"></el-input>
               </el-form-item>
               <el-form-item label="角色描述" prop="characterIntroduction" label-width="80px" style="margin-bottom: 20px;">
                 <el-input v-model="form.characterIntroduction" type="textarea" :autosize="{ minRows: 4, maxRows: 4 }"
+                  maxlength="400" show-word-limit
                   placeholder="请在此处提供该角色的背景资讯。 使用'{char}'來指代您的角色。 例如:{char}是一个从小娇生惯养的大小姐。"></el-input>
               </el-form-item>
               <el-collapse class="collapse">
                 <el-collapse-item title="更多设置" name="1">
                   <el-form-item label="场景" prop="scene" label-width="80px" style="margin-bottom: 20px;">
-                    <el-input v-model="form.scene" type="textarea" :autosize="{ minRows: 4, maxRows: 4 }"
-                      placeholder="输入您的角色所处的场景,例如:{char}和{user}现在已经交往一个月了。"></el-input>
+                    <el-input v-model="form.scene" type="textarea" :autosize="{ minRows: 4, maxRows: 4 }" maxlength="400"
+                      show-word-limit placeholder="输入您的角色所处的场景,例如:{char}和{user}现在已经交往一个月了。"></el-input>
                   </el-form-item>
 
                   <el-form-item label="对话范例" prop="dialogue" label-width="80px">
                     <el-input v-model="form.dialogue" type="textarea" :autosize="{ minRows: 4, maxRows: 4 }"
+                      maxlength="400" show-word-limit
                       :placeholder="'例如\n<START>\n{user}:嗨,我听说你喜欢在酒吧消磨时间。\n{char}:*兴奋*天呐,是的!'"></el-input>
                   </el-form-item>
                 </el-collapse-item>

+ 1 - 1
src/views/create/createSceneH5.vue

@@ -2,7 +2,7 @@
   <div class=" w-full app-pageContainer relative" style="overflow: hidden; height: calc(var(--vh, 1vh) * 100);">
     <TitleH5 titleName=" 创建场景" />
     <!-- 第一步场景基本信息 -->
-    <div class="overflow-y-auto" style="height: calc(100% - 49px);">
+    <div class="overflow-y-auto" style="height: calc(100% - 49px - 60px);">
       <div v-show="active == 1" class="px-6 pb-4 mx-auto  w-full">
         <div>
           <div class="py-4 flex flex-col">

+ 11 - 9
src/views/detail/indexH5.vue

@@ -141,6 +141,16 @@ export default {
   padding-top: 60px;
   background: rgba(58, 58, 58, 0.3);
   overflow-y: auto;
+
+  .info {
+    .prologue {
+      overflow: hidden;
+      text-overflow: ellipsis;
+      display: -webkit-box;
+      -webkit-line-clamp: 3;
+      -webkit-box-orient: vertical;
+    }
+  }
 }
 
 .content::-webkit-scrollbar {
@@ -179,15 +189,7 @@ export default {
     cursor: pointer;
   }
 
-  .info {
-    .prologue {
-      overflow: hidden;
-      text-overflow: ellipsis;
-      display: -webkit-box;
-      -webkit-line-clamp: 2;
-      -webkit-box-orient: vertical;
-    }
-  }
+
 }
 
 .scenarioList {

+ 1 - 1
src/views/profile/profilePC.vue

@@ -419,7 +419,7 @@ export default {
 .prologue {
   overflow: hidden;
   text-overflow: ellipsis;
-  -webkit-line-clamp: 4;
+  -webkit-line-clamp: 3;
   display: -webkit-box;
   -webkit-box-orient: vertical;
 }