From 5e2eb91ac0ea123b7b91f10cf3d741b73a9bd70c Mon Sep 17 00:00:00 2001
From: Soulter <905617992@qq.com>
Date: Sun, 26 Oct 2025 16:57:01 +0800
Subject: [PATCH 1/3] feat: enhance AddNewPlatform and ConfigPage components
with improved configuration management and UI interactions
---
.../components/platform/AddNewPlatform.vue | 124 +++++++++++++++---
dashboard/src/views/ConfigPage.vue | 63 ++++++---
2 files changed, 152 insertions(+), 35 deletions(-)
diff --git a/dashboard/src/components/platform/AddNewPlatform.vue b/dashboard/src/components/platform/AddNewPlatform.vue
index 3f7b86c98..929cde71b 100644
--- a/dashboard/src/components/platform/AddNewPlatform.vue
+++ b/dashboard/src/components/platform/AddNewPlatform.vue
@@ -89,10 +89,16 @@
使用现有配置文件
-
-
+
@@ -160,23 +166,33 @@
+ style="max-width: 140px;">
- {{ getMessageTypeLabel(item.messageType) }}
- :
+ {{ getMessageTypeLabel(item.messageType) }}
+ :
+ hide-details placeholder="会话ID或*">
- {{ item.sessionId === '*' ? '全部会话' : item.sessionId }}
+ {{ item.sessionId === '*' ? '全部会话' : item.sessionId }}
-
-
- {{ getConfigName(item.configId) }}
- 配置文件不存在
+
+
+
+
+ {{ getConfigName(item.configId) }}
+
+
+ mdi-arrow-top-right-thick
+
+
+ 配置文件不存在
@@ -259,6 +275,33 @@
+
+
+
+
+
+
+
+
+
+
@@ -268,10 +311,11 @@ import { useModuleI18n } from '@/i18n/composables';
import { getPlatformIcon, getPlatformDescription, getTutorialLink } from '@/utils/platformUtils';
import AstrBotConfig from '@/components/shared/AstrBotConfig.vue';
import AstrBotCoreConfigWrapper from '@/components/config/AstrBotCoreConfigWrapper.vue';
+import ConfigPage from '@/views/ConfigPage.vue';
export default {
name: 'AddNewPlatform',
- components: { AstrBotConfig, AstrBotCoreConfigWrapper },
+ components: { AstrBotConfig, AstrBotCoreConfigWrapper, ConfigPage },
emits: ['update:show', 'show-toast', 'refresh-config'],
props: {
show: {
@@ -324,8 +368,8 @@ export default {
// 平台路由表
platformRoutes: [],
routeTableHeaders: [
- { title: '消息会话来源(消息类型:会话 ID)', key: 'source', sortable: false, width: '40%' },
- { title: '使用配置文件', key: 'configId', sortable: false, width: '40%' },
+ { title: '消息会话来源(消息类型:会话 ID)', key: 'source', sortable: false, width: '60%' },
+ { title: '使用配置文件', key: 'configId', sortable: false, width: '20%' },
{ title: '操作', key: 'actions', sortable: false, align: 'center', width: '20%' },
],
messageTypeOptions: [
@@ -347,6 +391,10 @@ export default {
loading: false,
showConfigSection: false,
+
+ // 配置抽屉
+ showConfigDrawer: false,
+ configDrawerTargetId: null,
};
},
setup() {
@@ -478,6 +526,9 @@ export default {
this.showConfigSection = false;
this.isEditingRoutes = false; // 重置编辑模式
+
+ this.showConfigDrawer = false;
+ this.configDrawerTargetId = null;
},
closeDialog() {
this.resetForm();
@@ -534,6 +585,19 @@ export default {
const tutorialUrl = getTutorialLink(this.selectedPlatformConfig.type);
window.open(tutorialUrl, '_blank');
},
+ openConfigDrawer(configId) {
+ const targetId = configId || 'default';
+
+ if (configId && this.configInfoList.findIndex(c => c.id === configId) === -1) {
+ this.showError('目标配置文件不存在,已打开配置页面以便检查。');
+ }
+
+ this.configDrawerTargetId = targetId;
+ this.showConfigDrawer = true;
+ },
+ closeConfigDrawer() {
+ this.showConfigDrawer = false;
+ },
newPlatform() {
this.loading = true;
if (this.updatingMode) {
@@ -906,4 +970,30 @@ export default {
.v-select__selection-text {
font-size: 12px;
}
+
+.config-drawer-overlay {
+ align-items: stretch;
+ justify-content: flex-end;
+}
+
+.config-drawer-card {
+ width: clamp(320px, 60vw, 820px);
+ height: calc(100vh - 32px);
+ display: flex;
+ flex-direction: column;
+ margin: 16px;
+}
+
+.config-drawer-header {
+ display: flex;
+ align-items: center;
+ justify-content: space-between;
+ padding: 16px 20px 12px 20px;
+}
+
+.config-drawer-content {
+ flex: 1;
+ overflow-y: auto;
+ padding: 16px 16px 24px 16px;
+}
\ No newline at end of file
diff --git a/dashboard/src/views/ConfigPage.vue b/dashboard/src/views/ConfigPage.vue
index dbf47f624..133c5eebf 100644
--- a/dashboard/src/views/ConfigPage.vue
+++ b/dashboard/src/views/ConfigPage.vue
@@ -8,7 +8,7 @@
-
@@ -27,24 +27,26 @@
-
+
-
+
@@ -150,6 +152,12 @@ export default {
VueMonacoEditor,
WaitingForRestart
},
+ props: {
+ initialConfigId: {
+ type: String,
+ default: null
+ }
+ },
setup() {
const { t } = useI18n();
const { tm } = useModuleI18n('features/config');
@@ -187,8 +195,16 @@ export default {
},
},
watch: {
- config_data_str: function (val) {
+ config_data_str(val) {
this.config_data_has_changed = true;
+ },
+ initialConfigId(newVal) {
+ if (!newVal) {
+ return;
+ }
+ if (this.selectedConfigID !== newVal) {
+ this.getConfigInfoList(newVal);
+ }
}
},
data() {
@@ -207,6 +223,7 @@ export default {
save_message_snack: false,
save_message: "",
save_message_success: "",
+ configContentKey: 0,
// 配置类型切换
configType: 'normal', // 'normal' 或 'system'
@@ -224,7 +241,8 @@ export default {
}
},
mounted() {
- this.getConfigInfoList("default");
+ const targetConfigId = this.initialConfigId || 'default';
+ this.getConfigInfoList(targetConfigId);
// 初始化配置类型状态
this.configType = this.isSystemConfig ? 'system' : 'normal';
},
@@ -235,13 +253,21 @@ export default {
this.configInfoList = res.data.data.info_list;
if (abconf_id) {
+ let matched = false;
for (let i = 0; i < this.configInfoList.length; i++) {
if (this.configInfoList[i].id === abconf_id) {
- this.selectedConfigID = this.configInfoList[i].id
+ this.selectedConfigID = this.configInfoList[i].id;
this.getConfig(abconf_id);
+ matched = true;
break;
}
}
+
+ if (!matched && this.configInfoList.length) {
+ // 当找不到目标配置时,默认展示列表中的第一个配置
+ this.selectedConfigID = this.configInfoList[0].id;
+ this.getConfig(this.selectedConfigID);
+ }
}
}).catch((err) => {
this.save_message = this.messages.loadError;
@@ -265,6 +291,7 @@ export default {
this.config_data = res.data.data.config;
this.fetched = true
this.metadata = res.data.data.metadata;
+ this.configContentKey += 1;
}).catch((err) => {
this.save_message = this.messages.loadError;
this.save_message_snack = true;
From 14ec392091ea0abe4aaeb6cf73134425e9d7bdb1 Mon Sep 17 00:00:00 2001
From: Soulter <905617992@qq.com>
Date: Sun, 26 Oct 2025 17:00:36 +0800
Subject: [PATCH 2/3] fix: update message styling in AddNewPlatform component
for better visibility
---
dashboard/src/components/platform/AddNewPlatform.vue | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/dashboard/src/components/platform/AddNewPlatform.vue b/dashboard/src/components/platform/AddNewPlatform.vue
index 929cde71b..549c818de 100644
--- a/dashboard/src/components/platform/AddNewPlatform.vue
+++ b/dashboard/src/components/platform/AddNewPlatform.vue
@@ -212,7 +212,7 @@
-