Merge pull request #3028 from xinnan-tech/update-manager-mobile

mobile 智能体管理多语言调整、缓存用户信息
This commit is contained in:
wengzh
2026-03-20 14:48:26 +08:00
committed by GitHub
9 changed files with 66 additions and 33 deletions
+3 -3
View File
@@ -85,7 +85,7 @@ export default {
'agent.chatHistory': 'Chat-Verlauf',
'agent.voiceprintManagement': 'Stimmabdruckverwaltung',
'agent.editTitle': 'Agent bearbeiten',
'agent.toolsTitle': 'Funktionen bearbeiten',
'agent.toolsTitle': 'Bearbeiten',
'agent.voiceActivityDetection': 'Sprachaktivitätserkennung',
'agent.speechRecognition': 'Spracherkennung',
'agent.largeLanguageModel': 'Großes Sprachmodell',
@@ -116,7 +116,7 @@ export default {
'agent.tts': 'Text-zu-Sprache',
'agent.voiceprint': 'Agenten-Stimme',
'agent.plugins': 'Plugins',
'agent.editFunctions': 'Funktionen bearbeiten',
'agent.editFunctions': 'Bearbeiten',
'agent.historyMemory': 'Verlaufsspeicher',
'agent.memoryContent': 'Speicherinhalt',
'agent.saving': 'Wird gespeichert...',
@@ -371,7 +371,7 @@ export default {
'agent.tools.mcpAccessPoint': 'MCP-Zugangspunkt',
'agent.tools.copy': 'Kopieren',
'agent.tools.noTools': 'Keine Werkzeuge verfügbar',
'agent.tools.parameterConfig': 'Parameterkonfiguration',
'agent.tools.parameterConfig': 'Konfig',
'agent.tools.noParamsNeeded': 'Keine Parameter benötigt',
'agent.tools.pleaseInput': 'Bitte eingeben',
'agent.tools.inputOneItemPerLine': 'Ein Element pro Zeile eingeben',
+1 -1
View File
@@ -371,7 +371,7 @@ export default {
'agent.tools.mcpAccessPoint': 'MCP Access Point',
'agent.tools.copy': 'Copy',
'agent.tools.noTools': 'No tools available',
'agent.tools.parameterConfig': 'Parameter Configuration',
'agent.tools.parameterConfig': 'Param Config',
'agent.tools.noParamsNeeded': 'No parameters needed',
'agent.tools.pleaseInput': 'Please input',
'agent.tools.inputOneItemPerLine': 'Input one item per line',
+1 -1
View File
@@ -371,7 +371,7 @@ export default {
'agent.tools.mcpAccessPoint': 'Ponto de Acesso MCP',
'agent.tools.copy': 'Copiar',
'agent.tools.noTools': 'Nenhuma ferramenta disponível',
'agent.tools.parameterConfig': 'Configuração de Parâmetros',
'agent.tools.parameterConfig': 'Configuração',
'agent.tools.noParamsNeeded': 'Nenhum parâmetro necessário',
'agent.tools.pleaseInput': 'Por favor, insira',
'agent.tools.inputOneItemPerLine': 'Insira um item por linha',
+1 -1
View File
@@ -371,7 +371,7 @@ export default {
'agent.tools.mcpAccessPoint': 'Điểm truy cập MCP',
'agent.tools.copy': 'Sao chép',
'agent.tools.noTools': 'Không có công cụ nào',
'agent.tools.parameterConfig': 'Cấu hình tham số',
'agent.tools.parameterConfig': 'Cấu hình',
'agent.tools.noParamsNeeded': 'Không cần tham số',
'agent.tools.pleaseInput': 'Vui lòng nhập',
'agent.tools.inputOneItemPerLine': 'Nhập một mục mỗi dòng',
@@ -1006,6 +1006,7 @@ onMounted(async () => {
<wd-action-sheet
v-model="pickerShow.tts"
:actions="modelOptions.TTS && modelOptions.TTS.map(item => ({ name: item.modelName, value: item.id }))"
class="custom-sheet-tts"
@close="onPickerCancel('tts')"
@select="({ item }) => onPickerConfirm('tts', item.value, item.name)"
/>
@@ -1059,4 +1060,13 @@ onMounted(async () => {
background: transparent !important;
}
}
::v-deep .custom-sheet-tts {
.wd-action-sheet {
padding: 8px 0 !important;
overflow: hidden;
}
.wd-action-sheet__actions {
padding: 0 !important;
}
}
</style>
@@ -311,7 +311,7 @@ onMounted(async () => {
v-if="notSelectedList.length === 0"
class="h-[400rpx] flex items-center justify-center"
>
<wd-status-tip image="content" tip="{{ t('agent.tools.noMorePlugins') }}" />
<wd-status-tip image="content" :tip="t('agent.tools.noMorePlugins')" />
</view>
<view v-else class="p-[20rpx] space-y-[20rpx]">
<view
@@ -347,7 +347,7 @@ onMounted(async () => {
v-if="selectedList.length === 0"
class="h-[400rpx] flex items-center justify-center"
>
<wd-status-tip image="content" tip="{{ t('agent.tools.pleaseSelectPlugin') }}" />
<wd-status-tip image="content" :tip="t('agent.tools.pleaseSelectPlugin')" />
</view>
<view v-else class="p-[20rpx] space-y-[20rpx]">
<view
@@ -445,7 +445,7 @@ onMounted(async () => {
<!-- 参数编辑弹窗 -->
<wd-action-sheet
v-model="showParamDialog"
:title="`${t('agent.tools.paramConfiguration')} - ${currentFunction?.name || ''}`"
:title="`${t('agent.tools.parameterConfig')} - ${currentFunction?.name || ''}`"
custom-header-class="h-[75vh]"
@close="closeParamEdit"
>
@@ -586,3 +586,9 @@ onMounted(async () => {
</wd-action-sheet>
</view>
</template>
<style scoped lang="scss">
::v-deep .wd-action-sheet__header {
padding-right: 30rpx;
}
</style>
@@ -15,7 +15,7 @@ import { computed, onMounted, ref } from 'vue'
import { login } from '@/api/auth'
// 导入国际化相关功能
import { changeLanguage, getCurrentLanguage, getSupportedLanguages, initI18n, t } from '@/i18n'
import { useConfigStore } from '@/store'
import { useConfigStore, useUserStore } from '@/store'
// 导入SM2加密工具
import { getEnvBaseUrl, sm2Encrypt } from '@/utils'
import { toast } from '@/utils/toast'
@@ -61,6 +61,7 @@ const loginType = ref<'username' | 'mobile'>('username')
// 获取配置store
const configStore = useConfigStore()
const userStore = useUserStore()
// 区号选择相关
const showAreaCodeSheet = ref(false)
@@ -227,6 +228,7 @@ async function handleLogin() {
const response = await login(loginData)
// 存储token
uni.setStorageSync('token', JSON.stringify(response))
await userStore.getUserInfo()
toast.success(t('message.loginSuccess'))
@@ -581,7 +583,6 @@ onMounted(async () => {
.input-wrapper {
position: relative;
background: #f8f9fa;
border-radius: 16rpx;
padding: 20rpx 16rpx;
border: 2rpx solid #e9ecef;
@@ -460,8 +460,11 @@ defineExpose({
<view class="p-[32rpx]">
<!-- 声纹向量选择 -->
<view class="mb-[32rpx]">
<text class="mb-[16rpx] block text-[28rpx] text-red font-medium">
* {{ t('voiceprint.voiceVector') }}
<text class="mb-[16rpx] block text-[28rpx] text-[#232338] font-medium">
<text class="text-red">
*
</text>
{{ t('voiceprint.voiceVector') }}
</text>
<view
class="flex cursor-pointer items-center justify-between border-[1rpx] border-[#eeeeee] rounded-[12rpx] bg-[#f5f7fb] p-[20rpx] transition-all duration-300 active:bg-[#eef3ff]"
@@ -479,8 +482,11 @@ defineExpose({
<!-- 姓名 -->
<view class="mb-[32rpx]">
<text class="mb-[16rpx] block text-[28rpx] text-red font-medium">
* {{ t('voiceprint.name') }}
<text class="mb-[16rpx] block text-[28rpx] text-[#232338] font-medium">
<text class="text-red">
*
</text>
{{ t('voiceprint.name') }}
</text>
<input
v-model="addForm.sourceName"
@@ -491,8 +497,11 @@ defineExpose({
<!-- 描述 -->
<view>
<text class="mb-[16rpx] block text-[28rpx] text-red font-medium">
* {{ t('voiceprint.description') }}
<text class="mb-[16rpx] block text-[28rpx] text-[#232338] font-medium">
<text class="text-red">
*
</text>
{{ t('voiceprint.description') }}
</text>
<textarea
v-model="addForm.introduce" :maxlength="100" :placeholder="t('voiceprint.pleaseInputDescription')"
@@ -521,7 +530,7 @@ defineExpose({
safe-area-inset-bottom
>
<view>
<view class="w-full flex items-center justify-between border-b-[2rpx] border-[#eeeeee] p-[32rpx_32rpx_24rpx]">
<view class="box-border 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.editSpeaker') }}
</text>
@@ -531,7 +540,10 @@ defineExpose({
<!-- 声纹向量选择 -->
<view class="mb-[32rpx]">
<text class="mb-[16rpx] block text-[28rpx] text-[#232338] font-medium">
* {{ t('voiceprint.voiceVector') }}
<text class="text-red">
*
</text>
{{ t('voiceprint.voiceVector') }}
</text>
<view
class="flex cursor-pointer items-center justify-between border-[1rpx] border-[#eeeeee] rounded-[12rpx] bg-[#f5f7fb] p-[20rpx] transition-all duration-300 active:bg-[#eef3ff]"
@@ -550,7 +562,10 @@ defineExpose({
<!-- 姓名 -->
<view class="mb-[32rpx]">
<text class="mb-[16rpx] block text-[28rpx] text-[#232338] font-medium">
* {{ t('voiceprint.name') }}
<text class="text-red">
*
</text>
{{ t('voiceprint.name') }}
</text>
<input
v-model="editForm.sourceName"
@@ -562,7 +577,10 @@ defineExpose({
<!-- 描述 -->
<view>
<text class="mb-[16rpx] block text-[28rpx] text-[#232338] font-medium">
* {{ t('voiceprint.description') }}
<text class="text-red">
*
</text>
{{ t('voiceprint.description') }}
</text>
<textarea
v-model="editForm.introduce" :maxlength="100" :placeholder="t('voiceprint.pleaseInputDescription')"
+10 -12
View File
@@ -19,7 +19,7 @@ const userInfoState: UserInfo & { avatar?: string, token?: string } = {
}
export const useUserStore = defineStore(
'user',
'userInfo',
() => {
// 定义用户信息
const userInfo = ref<UserInfo & { avatar?: string, token?: string }>({ ...userInfoState })
@@ -51,16 +51,8 @@ export const useUserStore = defineStore(
*/
const getUserInfo = async () => {
const userData = await _getUserInfo()
const authInfo = JSON.parse(uni.getStorageSync('token') || '{}')
const userInfoWithExtras = {
...userData,
avatar: userInfoState.avatar,
token: authInfo.token || '',
}
setUserInfo(userInfoWithExtras)
uni.setStorageSync('userInfo', userInfoWithExtras)
// TODO 这里可以增加获取用户路由的方法 根据用户的角色动态生成路由
return userInfoWithExtras
setUserInfo(userData)
return userData
}
/**
* 退出登录 并 删除用户信息
@@ -79,6 +71,12 @@ export const useUserStore = defineStore(
}
},
{
persist: true,
persist: {
key: 'userInfo',
serializer: {
serialize: state => JSON.stringify(state.userInfo),
deserialize: value => ({ userInfo: JSON.parse(value) }),
},
},
},
)