|
@@ -260,7 +260,7 @@
|
|
|
/>
|
|
|
</div>
|
|
|
<div class="messageRight">
|
|
|
- <div class="message mt-4 ml-4 p-2 rounded-r-md rounded-bl-md text-xs" >
|
|
|
+ <div class="message mt-4 ml-4 p-4 rounded-r-md rounded-bl-md text-xs relative" >
|
|
|
<div v-if="item.voiceFilePosition" class="yyPlayBg mb-2 w-16 p-1 cursor-pointer" >
|
|
|
<img v-if="audioPlayIndex == index" class="yyPlay" src="@/assets/images/播放/yyPlay1.png" alt="" >
|
|
|
<img v-else class="yyPlay" src="@/assets/images/播放/yyPlay.png" alt="" @click="playAudio(item.voiceFilePosition, index)">
|
|
@@ -275,9 +275,16 @@
|
|
|
{{ item.chatGuidance }}
|
|
|
</div>
|
|
|
</div>
|
|
|
+ <el-dropdown v-if="index != 0" class="messageDropdown" @command="handleCommand" placement="top-end">
|
|
|
+ <el-button class="messageButton" icon="el-icon-more" circle></el-button>
|
|
|
+ <el-dropdown-menu slot="dropdown">
|
|
|
+ <el-dropdown-item command="1">编辑</el-dropdown-item>
|
|
|
+ <el-dropdown-item command="2">删除</el-dropdown-item>
|
|
|
+ <el-dropdown-item v-if="index == returnMessage.length - 1" command="3">重新生成</el-dropdown-item>
|
|
|
+ </el-dropdown-menu>
|
|
|
+ </el-dropdown>
|
|
|
</div>
|
|
|
</div>
|
|
|
-
|
|
|
</div>
|
|
|
<!-- 用户发送的信息 -->
|
|
|
<div v-if="item.role == 'user'" class="mb-4 flex me" :key="index">
|
|
@@ -307,15 +314,15 @@
|
|
|
v-model="content"
|
|
|
@keydown="Enterkey"
|
|
|
/>
|
|
|
- <div class="flex pt-6 justify-between" v-if="canChat">
|
|
|
+ <div class="flex pt-6 justify-between" v-if="canChat" style="height: 70px;">
|
|
|
<div class="tools w-36 flex justify-between">
|
|
|
<i class="el-icon-setting text-2xl cursor-pointer" @click="showConfig = true"></i>
|
|
|
- <i class="el-icon-picture-outline text-2xl cursor-pointer"></i>
|
|
|
- <i class="el-icon-s-opportunity text-2xl cursor-pointer"></i>
|
|
|
+ <!-- <i class="el-icon-picture-outline text-2xl cursor-pointer"></i> -->
|
|
|
+ <!-- <i class="el-icon-s-opportunity text-2xl cursor-pointer"></i> -->
|
|
|
</div>
|
|
|
- <button @click.prevent="getStreamChatWithWeb" class="px-4 rounded-r-lg text-sm text-gray-400" :class="content && 'planeColor'">
|
|
|
- <v-icon name="paper-plane" scale="1.5"/>
|
|
|
- </button>
|
|
|
+ <el-button type="text" :loading="chatLoading" @click.prevent="getStreamChatWithWeb" class="px-4 rounded-r-lg text-sm text-gray-400" :class="content && 'planeColor'">
|
|
|
+ <v-icon v-show="!chatLoading" name="paper-plane" scale="1.5"/>
|
|
|
+ </el-button>
|
|
|
</div>
|
|
|
<div v-if="!canChat" class=" flex w-full text-sm text-gray-400">
|
|
|
当前角色或场景已被设定为私有或被创作者删除,但你任然可以查看历史对话。
|
|
@@ -332,7 +339,7 @@
|
|
|
:visible.sync="showConfig"
|
|
|
width="500px"
|
|
|
>
|
|
|
- <p class="text-base">身分</p>
|
|
|
+ <!-- <p class="text-base">身分</p>
|
|
|
<p class="text-sm text-gray-400">选择你和角色聊天的身份</p>
|
|
|
<div class="flex items-start py-3 border-b border-gray-200">
|
|
|
<el-radio-group class="radio" v-model="configForm.radio1">
|
|
@@ -341,7 +348,7 @@
|
|
|
<el-button>
|
|
|
<i class="el-icon-sort" style="transform: rotate(90deg);"></i>
|
|
|
</el-button>
|
|
|
- </div>
|
|
|
+ </div> -->
|
|
|
<p class="text-base mt-3">选择模型</p>
|
|
|
<p class="text-sm text-gray-400">每个模型可能有不同的效果,仅对当前对话有影响</p>
|
|
|
<div class="flex items-start py-3 border-b border-gray-200">
|
|
@@ -349,7 +356,7 @@
|
|
|
<el-radio-button v-for="(item, index) in modelList" :key="index" :label="item.id">{{ item.model }}</el-radio-button>
|
|
|
</el-radio-group>
|
|
|
</div>
|
|
|
- <p class="text-base mt-3">角色语言</p>
|
|
|
+ <!-- <p class="text-base mt-3">角色语言</p>
|
|
|
<p class="text-sm text-gray-400">请选择角色的回复语言</p>
|
|
|
<div class="flex items-start py-3">
|
|
|
<el-radio-group class="radio" v-model="configForm.radio3">
|
|
@@ -359,7 +366,7 @@
|
|
|
<el-radio-button label="English"></el-radio-button>
|
|
|
<el-radio-button label="Español"></el-radio-button>
|
|
|
</el-radio-group>
|
|
|
- </div>
|
|
|
+ </div> -->
|
|
|
<span slot="footer" class="dialog-footer">
|
|
|
<el-button @click="showConfig = false">取 消</el-button>
|
|
|
<el-button type="primary" @click="showConfig = false">确 定</el-button>
|
|
@@ -393,6 +400,8 @@ export default {
|
|
|
},
|
|
|
data() {
|
|
|
return {
|
|
|
+ // 聊天等待
|
|
|
+ chatLoading: false,
|
|
|
// 是否全屏
|
|
|
fullScreen: false,
|
|
|
// 角色所有聊天列表
|
|
@@ -502,7 +511,7 @@ export default {
|
|
|
await this.getDetail(this.allRecords[0].id)
|
|
|
}
|
|
|
// 查找当前角色是否有对话记录
|
|
|
- this.searchHistory(this.info.id)
|
|
|
+ // this.searchHistory(this.info.id)
|
|
|
},
|
|
|
// 左侧面板变化
|
|
|
showInfoChange(index) {
|
|
@@ -698,6 +707,7 @@ export default {
|
|
|
})
|
|
|
this.returnMessage = [...this.returnMessage, ...history]
|
|
|
}
|
|
|
+ this.configForm.radio2 = res.data[res.data.length - 1].modelId
|
|
|
})
|
|
|
},
|
|
|
searchHistory(characterId) {
|
|
@@ -865,6 +875,9 @@ export default {
|
|
|
},
|
|
|
Enterkey(e) {
|
|
|
if (e.keyCode == 13) {
|
|
|
+ if (this.chatLoading) {
|
|
|
+ return
|
|
|
+ }
|
|
|
this.getStreamChatWithWeb()
|
|
|
}
|
|
|
},
|
|
@@ -940,12 +953,13 @@ export default {
|
|
|
}, 50)
|
|
|
},
|
|
|
async getStreamChatWithWeb() {
|
|
|
- this.textCache = ''
|
|
|
- this.resError = false
|
|
|
- this.messageLoading = true
|
|
|
if (!this.content) {
|
|
|
return
|
|
|
}
|
|
|
+ this.textCache = ''
|
|
|
+ this.resError = false
|
|
|
+ this.messageLoading = true
|
|
|
+ this.chatLoading = true
|
|
|
// 初始化定时器和audio的状态
|
|
|
if (this.videoLoop) {
|
|
|
clearInterval(this.videoLoop)
|
|
@@ -997,6 +1011,7 @@ export default {
|
|
|
if (res.status != 200) {
|
|
|
this.$message.error(res.statusText)
|
|
|
this.returnMessage.splice(this.returnMessage.length - 1, 2)
|
|
|
+ this.chatLoading = false
|
|
|
return
|
|
|
}
|
|
|
const reader = res.body.getReader()
|
|
@@ -1006,6 +1021,7 @@ export default {
|
|
|
// console.log(done, 'done');
|
|
|
if(done){
|
|
|
console.log(value, '结束value');
|
|
|
+ this.chatLoading = false
|
|
|
// if (typeof(value) == "undefined") {
|
|
|
// this.$message.error('错误')
|
|
|
// this.returnMessage.splice(this.returnMessage.length - 1, 1)
|
|
@@ -1050,6 +1066,7 @@ export default {
|
|
|
if(JSON.parse(element).code == 401) {
|
|
|
this.returnMessage.splice(this.returnMessage.length - 1, 1)
|
|
|
this.noLogin(element)
|
|
|
+ this.chatLoading = false
|
|
|
break;
|
|
|
}
|
|
|
if(JSON.parse(element).code == 500) {
|
|
@@ -1057,6 +1074,7 @@ export default {
|
|
|
this.returnMessage.splice(this.returnMessage.length - 2, 2)
|
|
|
this.$message.error(JSON.parse(element).content || '系统错误请联系管理员')
|
|
|
this.resError = true
|
|
|
+ this.chatLoading = false
|
|
|
break;
|
|
|
}
|
|
|
let txt = JSON.parse(element).content
|
|
@@ -1443,4 +1461,19 @@ export default {
|
|
|
-webkit-box-shadow: -1px 0 0 0 var(--bg-color1);
|
|
|
box-shadow: -1px 0 0 0 var(--bg-color1);
|
|
|
}
|
|
|
+ .message:hover >>> .messageButton {
|
|
|
+ display: block;
|
|
|
+ }
|
|
|
+ .messageButton {
|
|
|
+ display: none;
|
|
|
+
|
|
|
+ width: 25px;
|
|
|
+ height: 25px;
|
|
|
+ padding: 0;
|
|
|
+ }
|
|
|
+ .messageDropdown {
|
|
|
+ position: absolute;
|
|
|
+ bottom: -12px;
|
|
|
+ right: 10px;
|
|
|
+ }
|
|
|
</style>
|