mirror of
https://github.com/xinnan-tech/xiaozhi-esp32-server.git
synced 2026-11-28 04:59:52 +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' }" />
|
: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>
|
<span class="nav-text">{{ $t('header.smartManagement') }}</span>
|
||||||
</div>
|
</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' }"
|
<div v-if="isSuperAdmin" class="equipment-management" :class="{ 'active-tab': $route.path === '/model-config' }"
|
||||||
@click="goModelConfig">
|
@click="goModelConfig">
|
||||||
<img loading="lazy" alt="" src="@/assets/header/model_config.png"
|
<img loading="lazy" alt="" src="@/assets/header/model_config.png"
|
||||||
:style="{ filter: $route.path === '/model-config' ? 'brightness(0) invert(1)' : 'None' }" />
|
:style="{ filter: $route.path === '/model-config' ? 'brightness(0) invert(1)' : 'None' }" />
|
||||||
<span class="nav-text">{{ $t('header.modelConfig') }}</span>
|
<span class="nav-text">{{ $t('header.modelConfig') }}</span>
|
||||||
</div>
|
</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"
|
<div v-if="isSuperAdmin" class="equipment-management"
|
||||||
:class="{ 'active-tab': $route.path === '/user-management' }" @click="goUserManagement">
|
:class="{ 'active-tab': $route.path === '/user-management' }" @click="goUserManagement">
|
||||||
<img loading="lazy" alt="" src="@/assets/header/user_management.png"
|
<img loading="lazy" alt="" src="@/assets/header/user_management.png"
|
||||||
|
|
@ -34,11 +70,11 @@
|
||||||
<span class="nav-text">{{ $t('header.otaManagement') }}</span>
|
<span class="nav-text">{{ $t('header.otaManagement') }}</span>
|
||||||
</div>
|
</div>
|
||||||
<el-dropdown v-if="isSuperAdmin" trigger="click" class="equipment-management more-dropdown"
|
<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">
|
@visible-change="handleParamDropdownVisibleChange">
|
||||||
<span class="el-dropdown-link">
|
<span class="el-dropdown-link">
|
||||||
<img loading="lazy" alt="" src="@/assets/header/param_management.png"
|
<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>
|
<span class="nav-text">{{ $t('header.paramDictionary') }}</span>
|
||||||
<i class="el-icon-arrow-down el-icon--right" :class="{ 'rotate-down': paramDropdownVisible }"></i>
|
<i class="el-icon-arrow-down el-icon--right" :class="{ 'rotate-down': paramDropdownVisible }"></i>
|
||||||
</span>
|
</span>
|
||||||
|
|
@ -58,6 +94,9 @@
|
||||||
<el-dropdown-item @click.native="goServerSideManagement">
|
<el-dropdown-item @click.native="goServerSideManagement">
|
||||||
{{ $t('header.serverSideManagement') }}
|
{{ $t('header.serverSideManagement') }}
|
||||||
</el-dropdown-item>
|
</el-dropdown-item>
|
||||||
|
<el-dropdown-item @click.native="goFeatureManagement">
|
||||||
|
{{ $t('header.featureManagement') }}
|
||||||
|
</el-dropdown-item>
|
||||||
</el-dropdown-menu>
|
</el-dropdown-menu>
|
||||||
</el-dropdown>
|
</el-dropdown>
|
||||||
</div>
|
</div>
|
||||||
|
|
@ -107,8 +146,9 @@
|
||||||
<script>
|
<script>
|
||||||
import userApi from '@/apis/module/user';
|
import userApi from '@/apis/module/user';
|
||||||
import i18n, { changeLanguage, supportedLanguages, getLanguageLabelKey } from '@/i18n';
|
import i18n, { changeLanguage, supportedLanguages, getLanguageLabelKey } from '@/i18n';
|
||||||
import { mapActions, mapGetters } from 'vuex';
|
import { mapActions, mapGetters, mapState } from 'vuex';
|
||||||
import ChangePasswordDialog from './ChangePasswordDialog.vue'; // Import change password dialog component
|
import ChangePasswordDialog from './ChangePasswordDialog.vue';
|
||||||
|
import featureManager from '@/utils/featureManager';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'HeaderBar',
|
name: 'HeaderBar',
|
||||||
|
|
@ -126,12 +166,19 @@ export default {
|
||||||
isChangePasswordDialogVisible: false, // Control change password dialog display
|
isChangePasswordDialogVisible: false, // Control change password dialog display
|
||||||
userDropdownVisible: false,
|
userDropdownVisible: false,
|
||||||
paramDropdownVisible: false,
|
paramDropdownVisible: false,
|
||||||
|
voiceCloneDropdownVisible: false,
|
||||||
languageDropdownVisible: false,
|
languageDropdownVisible: false,
|
||||||
isSmallScreen: false
|
isSmallScreen: false
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
...mapGetters(['getIsSuperAdmin']),
|
...mapGetters(['getIsSuperAdmin']),
|
||||||
|
...mapState({
|
||||||
|
featureStatus: (state) => ({
|
||||||
|
voiceClone: state.pubConfig.systemWebMenu?.features?.voiceClone?.enabled,
|
||||||
|
knowledgeBase: state.pubConfig.systemWebMenu?.features?.knowledgeBase?.enabled,
|
||||||
|
}),
|
||||||
|
}),
|
||||||
isSuperAdmin() {
|
isSuperAdmin() {
|
||||||
return this.getIsSuperAdmin;
|
return this.getIsSuperAdmin;
|
||||||
},
|
},
|
||||||
|
|
@ -147,10 +194,11 @@ export default {
|
||||||
return supportedLanguages;
|
return supportedLanguages;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
mounted() {
|
async mounted() {
|
||||||
this.fetchUserInfo();
|
this.fetchUserInfo();
|
||||||
this.checkScreenSize();
|
this.checkScreenSize();
|
||||||
window.addEventListener('resize', this.checkScreenSize);
|
window.addEventListener('resize', this.checkScreenSize);
|
||||||
|
await featureManager.waitForInitialization();
|
||||||
},
|
},
|
||||||
// Remove event listener
|
// Remove event listener
|
||||||
beforeDestroy() {
|
beforeDestroy() {
|
||||||
|
|
@ -167,6 +215,15 @@ export default {
|
||||||
goModelConfig() {
|
goModelConfig() {
|
||||||
this.$router.push('/model-config')
|
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() {
|
goParamManagement() {
|
||||||
this.$router.push('/params-management')
|
this.$router.push('/params-management')
|
||||||
},
|
},
|
||||||
|
|
@ -186,6 +243,9 @@ export default {
|
||||||
goAgentTemplateManagement() {
|
goAgentTemplateManagement() {
|
||||||
this.$router.push('/agent-template-management')
|
this.$router.push('/agent-template-management')
|
||||||
},
|
},
|
||||||
|
goFeatureManagement() {
|
||||||
|
this.$router.push('/feature-management')
|
||||||
|
},
|
||||||
// Get user information
|
// Get user information
|
||||||
fetchUserInfo() {
|
fetchUserInfo() {
|
||||||
userApi.getUserInfo(({ data }) => {
|
userApi.getUserInfo(({ data }) => {
|
||||||
|
|
@ -249,6 +309,9 @@ export default {
|
||||||
handleParamDropdownVisibleChange(visible) {
|
handleParamDropdownVisibleChange(visible) {
|
||||||
this.paramDropdownVisible = visible;
|
this.paramDropdownVisible = visible;
|
||||||
},
|
},
|
||||||
|
handleVoiceCloneDropdownVisibleChange(visible) {
|
||||||
|
this.voiceCloneDropdownVisible = visible;
|
||||||
|
},
|
||||||
// Listen to language dropdown menu visibility change
|
// Listen to language dropdown menu visibility change
|
||||||
handleLanguageDropdownVisibleChange(visible) {
|
handleLanguageDropdownVisibleChange(visible) {
|
||||||
this.languageDropdownVisible = visible;
|
this.languageDropdownVisible = visible;
|
||||||
|
|
|
||||||
|
|
@ -14,7 +14,11 @@ export default {
|
||||||
'header.paramDictionary': 'More',
|
'header.paramDictionary': 'More',
|
||||||
'header.paramManagement': 'Params Management',
|
'header.paramManagement': 'Params Management',
|
||||||
'header.dictManagement': 'Dict 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
|
// McpToolCallDialog component text
|
||||||
'mcpToolCall.title': 'Tool Call',
|
'mcpToolCall.title': 'Tool Call',
|
||||||
|
|
|
||||||
|
|
@ -87,7 +87,28 @@ const routes = [
|
||||||
title: 'Parameter Management'
|
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',
|
path: '/server-side-management',
|
||||||
name: 'ServerSideManager',
|
name: 'ServerSideManager',
|
||||||
|
|
@ -110,6 +131,28 @@ const routes = [
|
||||||
title: 'OTA Management'
|
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',
|
path: '/dict-management',
|
||||||
name: 'DictManagement',
|
name: 'DictManagement',
|
||||||
|
|
@ -141,10 +184,14 @@ const routes = [
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: '/provider-management',
|
path: '/feature-management',
|
||||||
name: 'ProviderManagement',
|
name: 'FeatureManagement',
|
||||||
component: function () {
|
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
|
// Routes that require login to access
|
||||||
const protectedRoutes = ['home', 'RoleConfig', 'DeviceManagement', 'UserManagement', 'ModelConfig']
|
const protectedRoutes = ['home', 'RoleConfig', 'DeviceManagement', 'UserManagement', 'ModelConfig', 'KnowledgeBaseManagement', 'KnowledgeFileUpload']
|
||||||
|
|
||||||
// Route guard
|
// Route guard
|
||||||
router.beforeEach((to, from, next) => {
|
router.beforeEach((to, from, next) => {
|
||||||
|
|
|
||||||
File diff suppressed because it is too large
Load diff
Loading…
Reference in a new issue