update: mobile 播放声纹弹窗样式调整,切换角色模板更新表单状态

This commit is contained in:
zhuoqinglian
2026-03-18 16:44:27 +08:00
parent d6d50e0432
commit 07113dc4d2
5 changed files with 47 additions and 46 deletions
@@ -131,6 +131,7 @@ export function getMcpAddress(agentId: string) {
meta: {
ignoreAuth: false,
toast: false,
isExposeError: true,
},
})
}
@@ -12,7 +12,7 @@ import { ContentTypeEnum, ResultEnum, ShowMessage } from './enum'
// 语言映射, 用于设置 Accept-language 头
const langMap: Record<Language, string> = {
zh_CN: 'zh-CN',
en: 'en',
en: 'en-US',
zh_TW: 'zh-TW',
de: 'de',
vi: 'vi',
+29 -16
View File
@@ -426,15 +426,24 @@ function selectRoleTemplate(templateId: string) {
selectedTemplateId.value = templateId
const template = roleTemplates.value.find(t => t.id === templateId)
if (template) {
formData.value.systemPrompt = template.systemPrompt
formData.value.vadModelId = template.vadModelId
formData.value.asrModelId = template.asrModelId
formData.value.llmModelId = template.llmModelId
formData.value.vllmModelId = template.vllmModelId
formData.value.intentModelId = template.intentModelId
formData.value.memModelId = template.memModelId
formData.value.ttsModelId = template.ttsModelId
formData.value.ttsVoiceId = template.ttsVoiceId
formData.value = {
...formData.value,
systemPrompt: template.systemPrompt || formData.value.systemPrompt,
vadModelId: template.vadModelId || formData.value.vadModelId,
asrModelId: template.asrModelId || formData.value.asrModelId,
llmModelId: template.llmModelId || formData.value.llmModelId,
vllmModelId: template.vllmModelId || formData.value.vllmModelId,
intentModelId: template.intentModelId || formData.value.intentModelId,
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')">
<view class="bg-white rounded-t-[20rpx] pb-[env(safe-area-inset-bottom)]">
<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>
<wd-popup v-model="pickerShow.voiceprint" class="custom-popup" position="bottom" @close="onPickerCancel('voiceprint')">
<view class="overflow-hidden rounded-[20rpx] bg-white pb-[20rpx] pt-[20rpx]">
<view class="max-h-[600rpx] overflow-y-auto">
<view
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]"
@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)">
<wd-icon
:name="playingVoiceId === voice.value ? 'pause-circle' : 'play-circle'"
@@ -1046,4 +1053,10 @@ onMounted(async () => {
::v-deep .wd-tag__close {
color: #336cff !important;
}
::v-deep .custom-popup {
.wd-popup {
padding: 20rpx !important;
background: transparent !important;
}
}
</style>
@@ -70,6 +70,7 @@ async function mergeFunctions() {
uni.setStorageSync(`cachedMcpAddress_${agentId.value}`, address)
}
catch (error) {
mcpAddress.value = error
console.error('获取MCP地址失败:', error)
}
@@ -451,20 +451,16 @@ defineExpose({
<!-- 添加说话人弹窗 -->
<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
>
<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="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') }}
</text>
<view
@@ -483,7 +479,7 @@ defineExpose({
<!-- 姓名 -->
<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') }}
</text>
<input
@@ -495,7 +491,7 @@ defineExpose({
<!-- 描述 -->
<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') }}
</text>
<textarea
@@ -590,15 +586,9 @@ defineExpose({
</wd-popup>
<!-- 自定义语音对话记录选择弹出层 -->
<wd-popup v-model="showChatHistoryDialog" position="bottom" @close="stopAudio">
<view class="rounded-t-[20rpx] bg-white pb-[env(safe-area-inset-bottom)]">
<view class="flex items-center justify-between border-b border-[#eeeeee] p-[32rpx]">
<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">
<wd-popup v-model="showChatHistoryDialog" class="custom-popup" position="bottom" @close="stopAudio">
<view class="rounded-[20rpx] bg-white pb-[20rpx] pt-[20rpx]">
<view class="max-h-[600rpx] overflow-y-auto rounded-[20rpx]">
<view
v-for="item in chatHistoryActions"
:key="item.audioId"
@@ -621,7 +611,7 @@ defineExpose({
</wd-popup>
</template>
<style scoped>
<style lang="scss" scoped>
.voiceprint-container {
position: relative;
}
@@ -640,14 +630,10 @@ defineExpose({
color: #666666;
}
:deep(.wd-swipe-action) {
border-radius: 20rpx;
overflow: hidden;
box-shadow: 0 2rpx 12rpx rgba(0, 0, 0, 0.04);
border: 1rpx solid #eeeeee;
}
:deep(.flex-1) {
flex: 1;
::v-deep .custom-popup {
.wd-popup {
padding: 20rpx !important;
background: transparent;
}
}
</style>