mirror of
https://github.com/xinnan-tech/xiaozhi-esp32-server.git
synced 2026-11-27 04:49:47 +01:00
feat(header): enhance HeaderBar with voice clone and knowledge base management features
- Added new navigation items for voice clone management and knowledge base management in the HeaderBar component. - Implemented dropdown functionality for super admins to access voice clone and resource management. - Updated routing to include new paths for knowledge base and voice resource management. - Added corresponding translations in the i18n files.
This commit is contained in:
parent
598c5bc69e
commit
76b72579cd
4 changed files with 964 additions and 167 deletions
|
|
@ -15,12 +15,48 @@
|
|||
:style="{ filter: $route.path === '/home' || $route.path === '/role-config' || $route.path === '/device-management' ? 'brightness(0) invert(1)' : 'None' }" />
|
||||
<span class="nav-text">{{ $t('header.smartManagement') }}</span>
|
||||
</div>
|
||||
<div v-if="!isSuperAdmin && featureStatus.voiceClone" class="equipment-management"
|
||||
:class="{ 'active-tab': $route.path === '/voice-clone-management' }" @click="goVoiceCloneManagement">
|
||||
<img loading="lazy" alt="" src="@/assets/header/voice.png"
|
||||
:style="{ filter: $route.path === '/voice-clone-management' ? 'brightness(0) invert(1)' : 'None' }" />
|
||||
<span class="nav-text">{{ $t('header.voiceCloneManagement') }}</span>
|
||||
</div>
|
||||
<el-dropdown v-if="isSuperAdmin && featureStatus.voiceClone" trigger="click"
|
||||
class="equipment-management more-dropdown" :class="{
|
||||
'active-tab': $route.path === '/voice-clone-management' || $route.path === '/voice-resource-management'
|
||||
}" @visible-change="handleVoiceCloneDropdownVisibleChange">
|
||||
<span class="el-dropdown-link">
|
||||
<img loading="lazy" alt="" src="@/assets/header/voice.png" :style="{
|
||||
filter: $route.path === '/voice-clone-management' || $route.path === '/voice-resource-management'
|
||||
? 'brightness(0) invert(1)' : 'None'
|
||||
}" />
|
||||
<span class="nav-text">{{ $t('header.voiceCloneManagement') }}</span>
|
||||
<i class="el-icon-arrow-down el-icon--right" :class="{ 'rotate-down': voiceCloneDropdownVisible }"></i>
|
||||
</span>
|
||||
<el-dropdown-menu slot="dropdown">
|
||||
<el-dropdown-item @click.native="goVoiceCloneManagement">
|
||||
{{ $t('header.voiceCloneManagement') }}
|
||||
</el-dropdown-item>
|
||||
<el-dropdown-item @click.native="goVoiceResourceManagement">
|
||||
{{ $t('header.voiceResourceManagement') }}
|
||||
</el-dropdown-item>
|
||||
</el-dropdown-menu>
|
||||
</el-dropdown>
|
||||
<div v-if="isSuperAdmin" class="equipment-management" :class="{ 'active-tab': $route.path === '/model-config' }"
|
||||
@click="goModelConfig">
|
||||
<img loading="lazy" alt="" src="@/assets/header/model_config.png"
|
||||
:style="{ filter: $route.path === '/model-config' ? 'brightness(0) invert(1)' : 'None' }" />
|
||||
<span class="nav-text">{{ $t('header.modelConfig') }}</span>
|
||||
</div>
|
||||
<div v-if="featureStatus.knowledgeBase" class="equipment-management"
|
||||
:class="{ 'active-tab': $route.path === '/knowledge-base-management' || $route.path === '/knowledge-file-upload' }"
|
||||
@click="goKnowledgeBaseManagement">
|
||||
<img loading="lazy" alt="" src="@/assets/header/knowledge_base.png" :style="{
|
||||
filter: $route.path === '/knowledge-base-management' || $route.path === '/knowledge-file-upload'
|
||||
? 'brightness(0) invert(1)' : 'None'
|
||||
}" />
|
||||
<span class="nav-text">{{ $t('header.knowledgeBase') }}</span>
|
||||
</div>
|
||||
<div v-if="isSuperAdmin" class="equipment-management"
|
||||
:class="{ 'active-tab': $route.path === '/user-management' }" @click="goUserManagement">
|
||||
<img loading="lazy" alt="" src="@/assets/header/user_management.png"
|
||||
|
|
@ -34,11 +70,11 @@
|
|||
<span class="nav-text">{{ $t('header.otaManagement') }}</span>
|
||||
</div>
|
||||
<el-dropdown v-if="isSuperAdmin" trigger="click" class="equipment-management more-dropdown"
|
||||
:class="{ 'active-tab': $route.path === '/dict-management' || $route.path === '/params-management' || $route.path === '/provider-management' || $route.path === '/server-side-management' || $route.path === '/agent-template-management' }"
|
||||
:class="{ 'active-tab': $route.path === '/dict-management' || $route.path === '/params-management' || $route.path === '/provider-management' || $route.path === '/server-side-management' || $route.path === '/agent-template-management' || $route.path === '/feature-management' }"
|
||||
@visible-change="handleParamDropdownVisibleChange">
|
||||
<span class="el-dropdown-link">
|
||||
<img loading="lazy" alt="" src="@/assets/header/param_management.png"
|
||||
:style="{ filter: $route.path === '/dict-management' || $route.path === '/params-management' || $route.path === '/provider-management' || $route.path === '/server-side-management' || $route.path === '/agent-template-management' ? 'brightness(0) invert(1)' : 'None' }" />
|
||||
:style="{ filter: $route.path === '/dict-management' || $route.path === '/params-management' || $route.path === '/provider-management' || $route.path === '/server-side-management' || $route.path === '/agent-template-management' || $route.path === '/feature-management' ? 'brightness(0) invert(1)' : 'None' }" />
|
||||
<span class="nav-text">{{ $t('header.paramDictionary') }}</span>
|
||||
<i class="el-icon-arrow-down el-icon--right" :class="{ 'rotate-down': paramDropdownVisible }"></i>
|
||||
</span>
|
||||
|
|
@ -58,6 +94,9 @@
|
|||
<el-dropdown-item @click.native="goServerSideManagement">
|
||||
{{ $t('header.serverSideManagement') }}
|
||||
</el-dropdown-item>
|
||||
<el-dropdown-item @click.native="goFeatureManagement">
|
||||
{{ $t('header.featureManagement') }}
|
||||
</el-dropdown-item>
|
||||
</el-dropdown-menu>
|
||||
</el-dropdown>
|
||||
</div>
|
||||
|
|
@ -107,8 +146,9 @@
|
|||
<script>
|
||||
import userApi from '@/apis/module/user';
|
||||
import i18n, { changeLanguage, supportedLanguages, getLanguageLabelKey } from '@/i18n';
|
||||
import { mapActions, mapGetters } from 'vuex';
|
||||
import ChangePasswordDialog from './ChangePasswordDialog.vue'; // Import change password dialog component
|
||||
import { mapActions, mapGetters, mapState } from 'vuex';
|
||||
import ChangePasswordDialog from './ChangePasswordDialog.vue';
|
||||
import featureManager from '@/utils/featureManager';
|
||||
|
||||
export default {
|
||||
name: 'HeaderBar',
|
||||
|
|
@ -126,12 +166,19 @@ export default {
|
|||
isChangePasswordDialogVisible: false, // Control change password dialog display
|
||||
userDropdownVisible: false,
|
||||
paramDropdownVisible: false,
|
||||
voiceCloneDropdownVisible: false,
|
||||
languageDropdownVisible: false,
|
||||
isSmallScreen: false
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
...mapGetters(['getIsSuperAdmin']),
|
||||
...mapState({
|
||||
featureStatus: (state) => ({
|
||||
voiceClone: state.pubConfig.systemWebMenu?.features?.voiceClone?.enabled,
|
||||
knowledgeBase: state.pubConfig.systemWebMenu?.features?.knowledgeBase?.enabled,
|
||||
}),
|
||||
}),
|
||||
isSuperAdmin() {
|
||||
return this.getIsSuperAdmin;
|
||||
},
|
||||
|
|
@ -147,10 +194,11 @@ export default {
|
|||
return supportedLanguages;
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
async mounted() {
|
||||
this.fetchUserInfo();
|
||||
this.checkScreenSize();
|
||||
window.addEventListener('resize', this.checkScreenSize);
|
||||
await featureManager.waitForInitialization();
|
||||
},
|
||||
// Remove event listener
|
||||
beforeDestroy() {
|
||||
|
|
@ -167,6 +215,15 @@ export default {
|
|||
goModelConfig() {
|
||||
this.$router.push('/model-config')
|
||||
},
|
||||
goKnowledgeBaseManagement() {
|
||||
this.$router.push('/knowledge-base-management')
|
||||
},
|
||||
goVoiceCloneManagement() {
|
||||
this.$router.push('/voice-clone-management')
|
||||
},
|
||||
goVoiceResourceManagement() {
|
||||
this.$router.push('/voice-resource-management')
|
||||
},
|
||||
goParamManagement() {
|
||||
this.$router.push('/params-management')
|
||||
},
|
||||
|
|
@ -186,6 +243,9 @@ export default {
|
|||
goAgentTemplateManagement() {
|
||||
this.$router.push('/agent-template-management')
|
||||
},
|
||||
goFeatureManagement() {
|
||||
this.$router.push('/feature-management')
|
||||
},
|
||||
// Get user information
|
||||
fetchUserInfo() {
|
||||
userApi.getUserInfo(({ data }) => {
|
||||
|
|
@ -249,6 +309,9 @@ export default {
|
|||
handleParamDropdownVisibleChange(visible) {
|
||||
this.paramDropdownVisible = visible;
|
||||
},
|
||||
handleVoiceCloneDropdownVisibleChange(visible) {
|
||||
this.voiceCloneDropdownVisible = visible;
|
||||
},
|
||||
// Listen to language dropdown menu visibility change
|
||||
handleLanguageDropdownVisibleChange(visible) {
|
||||
this.languageDropdownVisible = visible;
|
||||
|
|
|
|||
|
|
@ -14,7 +14,11 @@ export default {
|
|||
'header.paramDictionary': 'More',
|
||||
'header.paramManagement': 'Params Management',
|
||||
'header.dictManagement': 'Dict Management',
|
||||
'header.agentTemplate': 'Default Role Templates', // Add this line
|
||||
'header.agentTemplate': 'Default Role Templates',
|
||||
'header.knowledgeBase': 'Knowledge',
|
||||
'header.voiceCloneManagement': 'Voice Clone',
|
||||
'header.voiceResourceManagement': 'Voice Resource',
|
||||
'header.featureManagement': 'System Feature Management',
|
||||
|
||||
// McpToolCallDialog component text
|
||||
'mcpToolCall.title': 'Tool Call',
|
||||
|
|
|
|||
|
|
@ -87,7 +87,28 @@ const routes = [
|
|||
title: 'Parameter Management'
|
||||
}
|
||||
},
|
||||
|
||||
{
|
||||
path: '/knowledge-base-management',
|
||||
name: 'KnowledgeBaseManagement',
|
||||
component: function () {
|
||||
return import('../views/KnowledgeBaseManagement.vue')
|
||||
},
|
||||
meta: {
|
||||
requiresAuth: true,
|
||||
title: 'Knowledge Base Management'
|
||||
}
|
||||
},
|
||||
{
|
||||
path: '/knowledge-file-upload',
|
||||
name: 'KnowledgeFileUpload',
|
||||
component: function () {
|
||||
return import('../views/KnowledgeFileUpload.vue')
|
||||
},
|
||||
meta: {
|
||||
requiresAuth: true,
|
||||
title: 'Document Upload Management'
|
||||
}
|
||||
},
|
||||
{
|
||||
path: '/server-side-management',
|
||||
name: 'ServerSideManager',
|
||||
|
|
@ -110,6 +131,28 @@ const routes = [
|
|||
title: 'OTA Management'
|
||||
}
|
||||
},
|
||||
{
|
||||
path: '/voice-resource-management',
|
||||
name: 'VoiceResourceManagement',
|
||||
component: function () {
|
||||
return import('../views/VoiceResourceManagement.vue')
|
||||
},
|
||||
meta: {
|
||||
requiresAuth: true,
|
||||
title: 'Voice Resource Management'
|
||||
}
|
||||
},
|
||||
{
|
||||
path: '/voice-clone-management',
|
||||
name: 'VoiceCloneManagement',
|
||||
component: function () {
|
||||
return import('../views/VoiceCloneManagement.vue')
|
||||
},
|
||||
meta: {
|
||||
requiresAuth: true,
|
||||
title: 'Voice Clone Management'
|
||||
}
|
||||
},
|
||||
{
|
||||
path: '/dict-management',
|
||||
name: 'DictManagement',
|
||||
|
|
@ -141,10 +184,14 @@ const routes = [
|
|||
}
|
||||
},
|
||||
{
|
||||
path: '/provider-management',
|
||||
name: 'ProviderManagement',
|
||||
path: '/feature-management',
|
||||
name: 'FeatureManagement',
|
||||
component: function () {
|
||||
return import('../views/ProviderManagement.vue')
|
||||
return import('../views/FeatureManagement.vue')
|
||||
},
|
||||
meta: {
|
||||
requiresAuth: true,
|
||||
title: 'Feature Management'
|
||||
}
|
||||
},
|
||||
]
|
||||
|
|
@ -168,7 +215,7 @@ VueRouter.prototype.push = function push(location) {
|
|||
}
|
||||
|
||||
// Routes that require login to access
|
||||
const protectedRoutes = ['home', 'RoleConfig', 'DeviceManagement', 'UserManagement', 'ModelConfig']
|
||||
const protectedRoutes = ['home', 'RoleConfig', 'DeviceManagement', 'UserManagement', 'ModelConfig', 'KnowledgeBaseManagement', 'KnowledgeFileUpload']
|
||||
|
||||
// Route guard
|
||||
router.beforeEach((to, from, next) => {
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load diff
Loading…
Reference in a new issue