diff --git a/dashboard/src/components/config/AstrBotCoreConfigWrapper.vue b/dashboard/src/components/config/AstrBotCoreConfigWrapper.vue index 2a84989df..88029a25a 100644 --- a/dashboard/src/components/config/AstrBotCoreConfigWrapper.vue +++ b/dashboard/src/components/config/AstrBotCoreConfigWrapper.vue @@ -2,18 +2,22 @@
- - {{ tm(metadata[key]['name']) }} + {{ tm(section.value['name']) }} - + -
+
- +
@@ -31,6 +35,11 @@
+ + + {{ tm('search.noResult') }} + + @@ -112,4 +177,4 @@ export default { margin-top: 16px; } } - \ No newline at end of file + diff --git a/dashboard/src/components/shared/AstrBotConfigV4.vue b/dashboard/src/components/shared/AstrBotConfigV4.vue index 15339980a..b4ab52f8c 100644 --- a/dashboard/src/components/shared/AstrBotConfigV4.vue +++ b/dashboard/src/components/shared/AstrBotConfigV4.vue @@ -19,6 +19,10 @@ const props = defineProps({ metadataKey: { type: String, required: true + }, + searchKeyword: { + type: String, + default: '' } }) @@ -124,16 +128,27 @@ function saveEditedContent() { } function shouldShowItem(itemMeta, itemKey) { - if (!itemMeta?.condition) { - return true - } - for (const [conditionKey, expectedValue] of Object.entries(itemMeta.condition)) { - const actualValue = getValueBySelector(props.iterable, conditionKey) - if (actualValue !== expectedValue) { - return false + if (itemMeta?.condition) { + for (const [conditionKey, expectedValue] of Object.entries(itemMeta.condition)) { + const actualValue = getValueBySelector(props.iterable, conditionKey) + if (actualValue !== expectedValue) { + return false + } } } - return true + + const keyword = String(props.searchKeyword || '').trim().toLowerCase() + if (!keyword) { + return true + } + + const searchableText = [ + itemKey, + translateIfKey(itemMeta?.description || ''), + translateIfKey(itemMeta?.hint || '') + ].join(' ').toLowerCase() + + return searchableText.includes(keyword) } // 检查最外层的 object 是否应该显示 @@ -148,7 +163,10 @@ function shouldShowSection() { return false } } - return true + + const sectionItems = props.metadata?.[props.metadataKey]?.items || {} + const hasVisibleItems = Object.entries(sectionItems).some(([itemKey, itemMeta]) => shouldShowItem(itemMeta, itemKey)) + return hasVisibleItems } function hasVisibleItemsAfter(items, currentIndex) { @@ -436,9 +454,13 @@ function getSpecialSubtype(value) { } .property-info, - .type-indicator, + .type-indicator { + padding: 4px 8px; + } + .config-input { - padding: 4px; + padding-left: 24px; + padding-right: 24px; } } diff --git a/dashboard/src/i18n/locales/en-US/features/config.json b/dashboard/src/i18n/locales/en-US/features/config.json index 4a766ad3d..5f3af4135 100644 --- a/dashboard/src/i18n/locales/en-US/features/config.json +++ b/dashboard/src/i18n/locales/en-US/features/config.json @@ -69,6 +69,10 @@ "normalConfig": "Basic", "systemConfig": "System" }, + "search": { + "placeholder": "Search config items (key/description/hint)", + "noResult": "No matching config items found" + }, "configManagement": { "title": "Configuration Management", "description": "AstrBot supports separate configuration files for different bots. The `default` configuration is used by default.", diff --git a/dashboard/src/i18n/locales/zh-CN/features/config.json b/dashboard/src/i18n/locales/zh-CN/features/config.json index 6ab2292f5..39564a717 100644 --- a/dashboard/src/i18n/locales/zh-CN/features/config.json +++ b/dashboard/src/i18n/locales/zh-CN/features/config.json @@ -69,6 +69,10 @@ "normalConfig": "普通", "systemConfig": "系统" }, + "search": { + "placeholder": "搜索配置项(字段名/描述/提示)", + "noResult": "未找到匹配的配置项" + }, "configManagement": { "title": "配置文件管理", "description": "AstrBot 支持针对不同机器人分别设置配置文件。默认会使用 `default` 配置。", diff --git a/dashboard/src/views/ConfigPage.vue b/dashboard/src/views/ConfigPage.vue index 88ba3d5f1..f667b7ab1 100644 --- a/dashboard/src/views/ConfigPage.vue +++ b/dashboard/src/views/ConfigPage.vue @@ -4,13 +4,24 @@
-
-
- + +
@@ -34,6 +45,7 @@ @@ -290,6 +302,7 @@ export default { // 配置类型切换 configType: 'normal', // 'normal' 或 'system' + configSearchKeyword: '', // 系统配置开关 isSystemConfig: false, @@ -702,6 +715,21 @@ export default { .config-panel { width: 100%; } + + .config-toolbar { + padding-right: 0 !important; + } + + .config-toolbar-controls { + width: 100%; + flex-wrap: wrap; + } + + .config-select, + .config-search-input { + width: 100%; + min-width: 0 !important; + } } /* 测试聊天抽屉样式 */