44 <div v-if =" selectedConfigID || isSystemConfig" class =" mt-4 config-panel"
55 style =" display : flex ; flex-direction : column ; align-items : start ;" >
66
7- <!-- 普通配置选择区域 -->
87 <div class =" d-flex flex-row pr-4"
9- style =" margin-bottom : 16px ; align-items : center ; gap : 12px ; justify-content : space-between ; width : 100 % ;" >
8+ style =" margin-bottom : 16px ; align-items : center ; gap : 12px ; width : 100 % ; justify-content : space-between ;" >
109 <div class =" d-flex flex-row align-center" style =" gap : 12px ;" >
1110 <v-select style =" min-width : 130px ;" v-model =" selectedConfigID" :items =" configSelectItems" item-title =" name" :disabled =" initialConfigId !== null"
1211 v-if =" !isSystemConfig" item-value =" id" :label =" tm('configSelection.selectConfig')" hide-details density =" compact" rounded =" md"
1312 variant =" outlined" @update:model-value =" onConfigSelect" >
1413 </v-select >
15- <a style =" color : inherit ;" href =" https://blog.astrbot.app/posts/what-is-changed-in-4.0.0/#%E5%A4%9A%E9%85%8D%E7%BD%AE%E6%96%87%E4%BB%B6" target =" _blank" ><v-btn icon =" mdi-help-circle" size =" small" variant =" plain" ></v-btn ></a >
14+ <!-- < a style="color: inherit;" href="https://blog.astrbot.app/posts/what-is-changed-in-4.0.0/#%E5%A4%9A%E9%85%8D%E7%BD%AE%E6%96%87%E4%BB%B6" target="_blank"><v-btn icon="mdi-help-circle" size="small" variant="plain"></v-btn></a> -- >
1615
1716 </div >
18-
19- <v-btn-toggle v-model =" configType" mandatory color =" primary" variant =" outlined" density =" comfortable"
20- rounded =" md" @update:model-value =" onConfigTypeToggle" >
21- <v-btn value =" normal" prepend-icon =" mdi-cog" size =" large" >
22- {{ tm('configSelection.normalConfig') }}
23- </v-btn >
24- <v-btn value =" system" prepend-icon =" mdi-cog-outline" size =" large" >
25- {{ tm('configSelection.systemConfig') }}
26- </v-btn >
27- </v-btn-toggle >
2817 </div >
29-
3018 <!-- <v-progress-linear v-if="!fetched" indeterminate color="primary"></v-progress-linear> -->
3119
3220 <v-slide-y-transition mode =" out-in" >
@@ -252,6 +240,9 @@ export default {
252240 config_data_str (val ) {
253241 this .config_data_has_changed = true ;
254242 },
243+ ' $route.fullPath' (newVal) {
244+ this .syncConfigTypeFromHash (newVal);
245+ },
255246 initialConfigId (newVal ) {
256247 if (! newVal) {
257248 return ;
@@ -299,6 +290,12 @@ export default {
299290 }
300291 },
301292 mounted () {
293+ const hashConfigType = this .extractConfigTypeFromHash (
294+ this .$route ? .fullPath || ' '
295+ );
296+ this .configType = hashConfigType || ' normal' ;
297+ this .isSystemConfig = this .configType === ' system' ;
298+
302299 const targetConfigId = this .initialConfigId || ' default' ;
303300 this .getConfigInfoList (targetConfigId);
304301 // 初始化配置类型状态
@@ -323,6 +320,27 @@ export default {
323320 }
324321 },
325322
323+ },
324+ methods: {
325+ extractConfigTypeFromHash (hash ) {
326+ const rawHash = String (hash || ' ' );
327+ const lastHashIndex = rawHash .lastIndexOf (' #' );
328+ if (lastHashIndex === - 1 ) {
329+ return null ;
330+ }
331+ const cleanHash = rawHash .slice (lastHashIndex + 1 );
332+ return cleanHash === ' system' || cleanHash === ' normal' ? cleanHash : null ;
333+ },
334+ syncConfigTypeFromHash (hash ) {
335+ const configType = this .extractConfigTypeFromHash (hash);
336+ if (! configType || configType === this .configType ) {
337+ return false ;
338+ }
339+
340+ this .configType = configType;
341+ this .onConfigTypeToggle ();
342+ return true ;
343+ },
326344 getConfigInfoList (abconf_id ) {
327345 // 获取配置列表
328346 axios .get (' /api/config/abconfs' ).then ((res ) => {
@@ -568,19 +586,7 @@ export default {
568586 // 保持向后兼容性,更新 configType
569587 this .configType = this .isSystemConfig ? ' system' : ' normal' ;
570588
571- this .fetched = false ; // 重置加载状态
572-
573- if (this .isSystemConfig ) {
574- // 切换到系统配置
575- this .getConfig ();
576- } else {
577- // 切换回普通配置,如果有选中的配置文件则加载,否则加载default
578- if (this .selectedConfigID ) {
579- this .getConfig (this .selectedConfigID );
580- } else {
581- this .getConfigInfoList (" default" );
582- }
583- }
589+ this .onConfigTypeToggle ();
584590 },
585591 openTestChat () {
586592 if (! this .selectedConfigID ) {
0 commit comments