mirror of
https://github.com/xinnan-tech/xiaozhi-esp32-server.git
synced 2026-07-25 08:33:53 +08:00
update: mobile 播放声纹弹窗样式调整,切换角色模板更新表单状态
This commit is contained in:
@@ -131,6 +131,7 @@ export function getMcpAddress(agentId: string) {
|
|||||||
meta: {
|
meta: {
|
||||||
ignoreAuth: false,
|
ignoreAuth: false,
|
||||||
toast: false,
|
toast: false,
|
||||||
|
isExposeError: true,
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ import { ContentTypeEnum, ResultEnum, ShowMessage } from './enum'
|
|||||||
// 语言映射, 用于设置 Accept-language 头
|
// 语言映射, 用于设置 Accept-language 头
|
||||||
const langMap: Record<Language, string> = {
|
const langMap: Record<Language, string> = {
|
||||||
zh_CN: 'zh-CN',
|
zh_CN: 'zh-CN',
|
||||||
en: 'en',
|
en: 'en-US',
|
||||||
zh_TW: 'zh-TW',
|
zh_TW: 'zh-TW',
|
||||||
de: 'de',
|
de: 'de',
|
||||||
vi: 'vi',
|
vi: 'vi',
|
||||||
|
|||||||
@@ -426,15 +426,24 @@ function selectRoleTemplate(templateId: string) {
|
|||||||
selectedTemplateId.value = templateId
|
selectedTemplateId.value = templateId
|
||||||
const template = roleTemplates.value.find(t => t.id === templateId)
|
const template = roleTemplates.value.find(t => t.id === templateId)
|
||||||
if (template) {
|
if (template) {
|
||||||
formData.value.systemPrompt = template.systemPrompt
|
formData.value = {
|
||||||
formData.value.vadModelId = template.vadModelId
|
...formData.value,
|
||||||
formData.value.asrModelId = template.asrModelId
|
systemPrompt: template.systemPrompt || formData.value.systemPrompt,
|
||||||
formData.value.llmModelId = template.llmModelId
|
vadModelId: template.vadModelId || formData.value.vadModelId,
|
||||||
formData.value.vllmModelId = template.vllmModelId
|
asrModelId: template.asrModelId || formData.value.asrModelId,
|
||||||
formData.value.intentModelId = template.intentModelId
|
llmModelId: template.llmModelId || formData.value.llmModelId,
|
||||||
formData.value.memModelId = template.memModelId
|
vllmModelId: template.vllmModelId || formData.value.vllmModelId,
|
||||||
formData.value.ttsModelId = template.ttsModelId
|
intentModelId: template.intentModelId || formData.value.intentModelId,
|
||||||
formData.value.ttsVoiceId = template.ttsVoiceId
|
memModelId: template.memModelId || formData.value.memModelId,
|
||||||
|
ttsModelId: template.ttsModelId || formData.value.ttsModelId,
|
||||||
|
ttsVoiceId: template.ttsVoiceId || formData.value.ttsVoiceId,
|
||||||
|
agentName: template.agentName || formData.value.agentName,
|
||||||
|
chatHistoryConf: template.chatHistoryConf || formData.value.chatHistoryConf,
|
||||||
|
summaryMemory: template.summaryMemory || formData.value.summaryMemory,
|
||||||
|
langCode: template.langCode || formData.value.langCode,
|
||||||
|
}
|
||||||
|
fetchAllLanguag(template.ttsModelId || formData.value.ttsModelId)
|
||||||
|
updateDisplayNames()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1002,12 +1011,8 @@ onMounted(async () => {
|
|||||||
/>
|
/>
|
||||||
|
|
||||||
<!-- 自定义语音选择弹出层 -->
|
<!-- 自定义语音选择弹出层 -->
|
||||||
<wd-popup v-model="pickerShow.voiceprint" position="bottom" @close="onPickerCancel('voiceprint')">
|
<wd-popup v-model="pickerShow.voiceprint" class="custom-popup" position="bottom" @close="onPickerCancel('voiceprint')">
|
||||||
<view class="bg-white rounded-t-[20rpx] pb-[env(safe-area-inset-bottom)]">
|
<view class="overflow-hidden rounded-[20rpx] bg-white pb-[20rpx] pt-[20rpx]">
|
||||||
<view class="flex items-center justify-between border-b border-[#eeeeee] p-[32rpx]">
|
|
||||||
<text class="text-[32rpx] text-[#232338] font-bold">{{ t('agent.voiceprint') }}</text>
|
|
||||||
<wd-icon name="close" size="20px" @click="onPickerCancel('voiceprint')" />
|
|
||||||
</view>
|
|
||||||
<view class="max-h-[600rpx] overflow-y-auto">
|
<view class="max-h-[600rpx] overflow-y-auto">
|
||||||
<view
|
<view
|
||||||
v-for="voice in voiceOptions"
|
v-for="voice in voiceOptions"
|
||||||
@@ -1015,7 +1020,9 @@ onMounted(async () => {
|
|||||||
class="flex items-center justify-between border-b border-[#f5f5f5] p-[32rpx] transition-all active:bg-[#f5f7fb]"
|
class="flex items-center justify-between border-b border-[#f5f5f5] p-[32rpx] transition-all active:bg-[#f5f7fb]"
|
||||||
@click="onPickerConfirm('voiceprint', voice.value, voice.name)"
|
@click="onPickerConfirm('voiceprint', voice.value, voice.name)"
|
||||||
>
|
>
|
||||||
<text class="flex-1 text-[28rpx] text-[#232338]">{{ voice.name }}</text>
|
<text :class="`flex-1 text-[28rpx] text-[#232338] ${(voice.voiceDemo || voice.voice_demo) ? '' : 'text-center'}`">
|
||||||
|
{{ voice.name }}
|
||||||
|
</text>
|
||||||
<view v-if="voice.voiceDemo || voice.voice_demo" class="ml-[20rpx]" @click.stop="playAudio(voice.voiceDemo || voice.voice_demo, voice.value, $event)">
|
<view v-if="voice.voiceDemo || voice.voice_demo" class="ml-[20rpx]" @click.stop="playAudio(voice.voiceDemo || voice.voice_demo, voice.value, $event)">
|
||||||
<wd-icon
|
<wd-icon
|
||||||
:name="playingVoiceId === voice.value ? 'pause-circle' : 'play-circle'"
|
:name="playingVoiceId === voice.value ? 'pause-circle' : 'play-circle'"
|
||||||
@@ -1046,4 +1053,10 @@ onMounted(async () => {
|
|||||||
::v-deep .wd-tag__close {
|
::v-deep .wd-tag__close {
|
||||||
color: #336cff !important;
|
color: #336cff !important;
|
||||||
}
|
}
|
||||||
|
::v-deep .custom-popup {
|
||||||
|
.wd-popup {
|
||||||
|
padding: 20rpx !important;
|
||||||
|
background: transparent !important;
|
||||||
|
}
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
@@ -70,6 +70,7 @@ async function mergeFunctions() {
|
|||||||
uni.setStorageSync(`cachedMcpAddress_${agentId.value}`, address)
|
uni.setStorageSync(`cachedMcpAddress_${agentId.value}`, address)
|
||||||
}
|
}
|
||||||
catch (error) {
|
catch (error) {
|
||||||
|
mcpAddress.value = error
|
||||||
console.error('获取MCP地址失败:', error)
|
console.error('获取MCP地址失败:', error)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -451,20 +451,16 @@ defineExpose({
|
|||||||
|
|
||||||
<!-- 添加说话人弹窗 -->
|
<!-- 添加说话人弹窗 -->
|
||||||
<wd-popup
|
<wd-popup
|
||||||
v-model="showAddDialog" position="center" custom-style="width: 90%; max-width: 400px; border-radius: 16px;"
|
v-model="showAddDialog"
|
||||||
|
position="center"
|
||||||
|
custom-style="width: 90%; max-width: 400px; border-radius: 16px;"
|
||||||
safe-area-inset-bottom
|
safe-area-inset-bottom
|
||||||
>
|
>
|
||||||
<view>
|
<view>
|
||||||
<view class="w-full flex items-center justify-between border-b-[2rpx] border-[#eeeeee] p-[32rpx_32rpx_24rpx]">
|
|
||||||
<text class="w-full text-center text-[32rpx] text-[#232338] font-semibold">
|
|
||||||
{{ t('voiceprint.addSpeaker') }}
|
|
||||||
</text>
|
|
||||||
</view>
|
|
||||||
|
|
||||||
<view class="p-[32rpx]">
|
<view class="p-[32rpx]">
|
||||||
<!-- 声纹向量选择 -->
|
<!-- 声纹向量选择 -->
|
||||||
<view class="mb-[32rpx]">
|
<view class="mb-[32rpx]">
|
||||||
<text class="mb-[16rpx] block text-[28rpx] text-[#232338] font-medium">
|
<text class="mb-[16rpx] block text-[28rpx] text-red font-medium">
|
||||||
* {{ t('voiceprint.voiceVector') }}
|
* {{ t('voiceprint.voiceVector') }}
|
||||||
</text>
|
</text>
|
||||||
<view
|
<view
|
||||||
@@ -483,7 +479,7 @@ defineExpose({
|
|||||||
|
|
||||||
<!-- 姓名 -->
|
<!-- 姓名 -->
|
||||||
<view class="mb-[32rpx]">
|
<view class="mb-[32rpx]">
|
||||||
<text class="mb-[16rpx] block text-[28rpx] text-[#232338] font-medium">
|
<text class="mb-[16rpx] block text-[28rpx] text-red font-medium">
|
||||||
* {{ t('voiceprint.name') }}
|
* {{ t('voiceprint.name') }}
|
||||||
</text>
|
</text>
|
||||||
<input
|
<input
|
||||||
@@ -495,7 +491,7 @@ defineExpose({
|
|||||||
|
|
||||||
<!-- 描述 -->
|
<!-- 描述 -->
|
||||||
<view>
|
<view>
|
||||||
<text class="mb-[16rpx] block text-[28rpx] text-[#232338] font-medium">
|
<text class="mb-[16rpx] block text-[28rpx] text-red font-medium">
|
||||||
* {{ t('voiceprint.description') }}
|
* {{ t('voiceprint.description') }}
|
||||||
</text>
|
</text>
|
||||||
<textarea
|
<textarea
|
||||||
@@ -590,15 +586,9 @@ defineExpose({
|
|||||||
</wd-popup>
|
</wd-popup>
|
||||||
|
|
||||||
<!-- 自定义语音对话记录选择弹出层 -->
|
<!-- 自定义语音对话记录选择弹出层 -->
|
||||||
<wd-popup v-model="showChatHistoryDialog" position="bottom" @close="stopAudio">
|
<wd-popup v-model="showChatHistoryDialog" class="custom-popup" position="bottom" @close="stopAudio">
|
||||||
<view class="rounded-t-[20rpx] bg-white pb-[env(safe-area-inset-bottom)]">
|
<view class="rounded-[20rpx] bg-white pb-[20rpx] pt-[20rpx]">
|
||||||
<view class="flex items-center justify-between border-b border-[#eeeeee] p-[32rpx]">
|
<view class="max-h-[600rpx] overflow-y-auto rounded-[20rpx]">
|
||||||
<text class="text-[32rpx] text-[#232338] font-bold">
|
|
||||||
{{ t('voiceprint.selectVector') }}
|
|
||||||
</text>
|
|
||||||
<wd-icon name="close" size="20px" @click="showChatHistoryDialog = false; stopAudio()" />
|
|
||||||
</view>
|
|
||||||
<view class="max-h-[600rpx] overflow-y-auto">
|
|
||||||
<view
|
<view
|
||||||
v-for="item in chatHistoryActions"
|
v-for="item in chatHistoryActions"
|
||||||
:key="item.audioId"
|
:key="item.audioId"
|
||||||
@@ -621,7 +611,7 @@ defineExpose({
|
|||||||
</wd-popup>
|
</wd-popup>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<style scoped>
|
<style lang="scss" scoped>
|
||||||
.voiceprint-container {
|
.voiceprint-container {
|
||||||
position: relative;
|
position: relative;
|
||||||
}
|
}
|
||||||
@@ -640,14 +630,10 @@ defineExpose({
|
|||||||
color: #666666;
|
color: #666666;
|
||||||
}
|
}
|
||||||
|
|
||||||
:deep(.wd-swipe-action) {
|
::v-deep .custom-popup {
|
||||||
border-radius: 20rpx;
|
.wd-popup {
|
||||||
overflow: hidden;
|
padding: 20rpx !important;
|
||||||
box-shadow: 0 2rpx 12rpx rgba(0, 0, 0, 0.04);
|
background: transparent;
|
||||||
border: 1rpx solid #eeeeee;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
:deep(.flex-1) {
|
|
||||||
flex: 1;
|
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
Reference in New Issue
Block a user