Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion astrbot/dashboard/routes/session_management.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
from astrbot.core.provider.entities import ProviderType
from astrbot.core.star.session_llm_manager import SessionServiceManager
from astrbot.core.star.session_plugin_manager import SessionPluginManager

from .route import Response, Route, RouteContext


Expand Down Expand Up @@ -371,6 +370,7 @@ async def get_session_plugins(self):
"""获取指定会话的插件配置信息"""
try:
session_id = request.args.get("session_id")
hide_disabled = request.args.get("hide_disabled", "false").lower() == "true"

if not session_id:
return Response().error("缺少必要参数: session_id").__dict__
Expand All @@ -387,6 +387,10 @@ async def get_session_plugins(self):
session_id, plugin_name
)

# 如果启用了隐藏已禁用插件选项,则跳过已禁用的插件
if hide_disabled and not plugin_enabled:
continue

all_plugins.append(
{
"name": plugin_name,
Expand Down
2 changes: 2 additions & 0 deletions dashboard/src/i18n/locales/zh-CN/features/extension.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@
"buttons": {
"showSystemPlugins": "显示系统插件",
"hideSystemPlugins": "隐藏系统插件",
"hideDisabledPlugins": "隐藏已禁用插件",
"showDisabledPlugins": "显示已禁用插件",
"install": "安装",
"uninstall": "卸载",
"update": "更新",
Expand Down
35 changes: 28 additions & 7 deletions dashboard/src/views/ExtensionPage.vue
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@ import ConsoleDisplayer from '@/components/shared/ConsoleDisplayer.vue';
import ReadmeDialog from '@/components/shared/ReadmeDialog.vue';
import ProxySelector from '@/components/shared/ProxySelector.vue';
import axios from 'axios';
import { pinyin } from 'pinyin-pro';
import { useCommonStore } from '@/stores/common';
import { useI18n, useModuleI18n } from '@/i18n/composables';
import {pinyin} from 'pinyin-pro';
import {useCommonStore} from '@/stores/common';
import {useI18n, useModuleI18n} from '@/i18n/composables';

import { ref, computed, onMounted, reactive } from 'vue';
import {computed, onMounted, reactive, ref} from 'vue';


const commonStore = useCommonStore();
Expand All @@ -22,6 +22,7 @@ const extension_data = reactive({
message: ""
});
const showReserved = ref(false);
const hideDisabled = ref(false);
const snack_message = ref("");
const snack_show = ref(false);
const snack_success = ref("success");
Expand Down Expand Up @@ -124,10 +125,17 @@ const pluginMarketHeaders = computed(() => [

// 过滤要显示的插件
const filteredExtensions = computed(() => {
let result = extension_data?.data || [];

if (!showReserved.value) {
return extension_data?.data?.filter(ext => !ext.reserved) || [];
result = result.filter(ext => !ext.reserved);
}

if (!hideDisabled.value) {
result = result.filter(ext => ext.activated);
}
return extension_data.data || [];

return result;
});

// 通过搜索过滤插件
Expand All @@ -153,6 +161,10 @@ const toggleShowReserved = () => {
showReserved.value = !showReserved.value;
};

const toggleHideDisabled = () => {
hideDisabled.value = !hideDisabled.value;
};

const toast = (message, success) => {
snack_message.value = message;
snack_show.value = true;
Expand All @@ -176,7 +188,11 @@ const onLoadingDialogResult = (statusCode, result, timeToClose = 2000) => {
const getExtensions = async () => {
loading_.value = true;
try {
const res = await axios.get('/api/plugin/get');
const res = await axios.get('/api/plugin/get', {
params: {
hide_disabled: false // 强制获取所有插件,在前端过滤
}
});
Object.assign(extension_data, res.data);
checkUpdate();
} catch (err) {
Expand Down Expand Up @@ -595,6 +611,11 @@ onMounted(async () => {
{{ showReserved ? tm('buttons.hideSystemPlugins') : tm('buttons.showSystemPlugins') }}
</v-btn>

<v-btn class="ml-2" variant="tonal" @click="toggleHideDisabled">
<v-icon>{{ hideDisabled ? 'mdi-eye-off' : 'mdi-eye' }}</v-icon>
{{ hideDisabled ? tm('buttons.hideDisabledPlugins') : tm('buttons.showDisabledPlugins') }}
</v-btn>

<v-btn class="ml-2" color="primary" variant="tonal" @click="dialog = true">
<v-icon>mdi-plus</v-icon>
{{ tm('buttons.install') }}
Expand Down