@@ -7,42 +7,11 @@ from flask import Blueprint, request, jsonify, render_template, current_app
|
|||||||
|
|
||||||
from admin.dashboard.blueprints.auth import login_required
|
from admin.dashboard.blueprints.auth import login_required
|
||||||
from utils.robot_cmd.robot_command import GroupBotManager, PermissionStatus
|
from utils.robot_cmd.robot_command import GroupBotManager, PermissionStatus
|
||||||
from plugins.robot_menu.menu_render_tool import RobotMenuRenderTool
|
|
||||||
|
|
||||||
# 创建蓝图
|
# 创建蓝图
|
||||||
plugin_routes = Blueprint('plugin_routes', __name__)
|
plugin_routes = Blueprint('plugin_routes', __name__)
|
||||||
LOG = logger
|
LOG = logger
|
||||||
|
|
||||||
# 后台命令索引页只复用“命令目录生成”能力,不需要图片渲染,
|
|
||||||
# 因此这里固定使用轻量 text 配置创建一个工具实例即可。
|
|
||||||
_command_catalog_tool = RobotMenuRenderTool(
|
|
||||||
output_mode="text",
|
|
||||||
image_fallback_to_text=True,
|
|
||||||
image_render_timeout_seconds=30,
|
|
||||||
image_render_retries=1,
|
|
||||||
image_template_path="plugins/robot_menu/templates/menu_cards.html",
|
|
||||||
log=LOG,
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
def _build_group_options(server) -> list:
|
|
||||||
"""构建后台命令索引页的群组选项列表。"""
|
|
||||||
group_ids = sorted(set(GroupBotManager.get_group_list() or []))
|
|
||||||
options = []
|
|
||||||
for group_id in group_ids:
|
|
||||||
group_name = ""
|
|
||||||
try:
|
|
||||||
group_name = server.contact_manager.get_nickname(group_id) or ""
|
|
||||||
except Exception:
|
|
||||||
group_name = ""
|
|
||||||
options.append(
|
|
||||||
{
|
|
||||||
"group_id": group_id,
|
|
||||||
"group_name": str(group_name or group_id),
|
|
||||||
}
|
|
||||||
)
|
|
||||||
return options
|
|
||||||
|
|
||||||
|
|
||||||
# 机器人管理页面
|
# 机器人管理页面
|
||||||
@plugin_routes.route('/plugins_manage')
|
@plugin_routes.route('/plugins_manage')
|
||||||
@@ -51,13 +20,6 @@ def robot_management():
|
|||||||
return render_template('plugins_manage.html')
|
return render_template('plugins_manage.html')
|
||||||
|
|
||||||
|
|
||||||
@plugin_routes.route('/command_catalog')
|
|
||||||
@login_required
|
|
||||||
def command_catalog_page():
|
|
||||||
"""后台命令索引页面。"""
|
|
||||||
return render_template('command_catalog.html')
|
|
||||||
|
|
||||||
|
|
||||||
@plugin_routes.route('/api/plugins', methods=['GET'])
|
@plugin_routes.route('/api/plugins', methods=['GET'])
|
||||||
@login_required
|
@login_required
|
||||||
def get_plugins():
|
def get_plugins():
|
||||||
@@ -75,37 +37,6 @@ def get_plugins():
|
|||||||
return jsonify({"success": False, "message": f"获取插件列表失败: {str(e)}"})
|
return jsonify({"success": False, "message": f"获取插件列表失败: {str(e)}"})
|
||||||
|
|
||||||
|
|
||||||
@plugin_routes.route('/api/plugins/command_catalog', methods=['GET'])
|
|
||||||
@login_required
|
|
||||||
def get_command_catalog():
|
|
||||||
"""获取后台命令索引数据。"""
|
|
||||||
try:
|
|
||||||
server = current_app.dashboard_server
|
|
||||||
group_id = str(request.args.get('group_id') or '').strip()
|
|
||||||
|
|
||||||
# 后台命令索引默认站在“管理员”视角,
|
|
||||||
# 这样既能看到当前可用命令,也能看到未启用能力和管理指令。
|
|
||||||
catalog = _command_catalog_tool.build_command_catalog_data(
|
|
||||||
group_id=group_id,
|
|
||||||
requester_id="dashboard_admin",
|
|
||||||
force_admin=True,
|
|
||||||
)
|
|
||||||
data = {
|
|
||||||
**catalog,
|
|
||||||
"group_options": _build_group_options(server),
|
|
||||||
"summary": {
|
|
||||||
"available_manual_count": len(catalog.get("available_manual", []) or []),
|
|
||||||
"available_auto_count": len(catalog.get("available_auto", []) or []),
|
|
||||||
"unavailable_manual_count": len(catalog.get("unavailable_manual", []) or []),
|
|
||||||
"admin_command_count": len(catalog.get("admin_commands", []) or []),
|
|
||||||
},
|
|
||||||
}
|
|
||||||
return jsonify({"success": True, "data": data})
|
|
||||||
except Exception as e:
|
|
||||||
LOG.error(f"获取命令索引失败: {str(e)}", exc_info=True)
|
|
||||||
return jsonify({"success": False, "message": f"获取命令索引失败: {str(e)}"})
|
|
||||||
|
|
||||||
|
|
||||||
@plugin_routes.route('/api/plugins/group_status', methods=['GET'])
|
@plugin_routes.route('/api/plugins/group_status', methods=['GET'])
|
||||||
@login_required
|
@login_required
|
||||||
def get_plugin_group_status():
|
def get_plugin_group_status():
|
||||||
|
|||||||
@@ -1012,7 +1012,6 @@
|
|||||||
items: [
|
items: [
|
||||||
{ label: '插件统计', path: '/plugins' },
|
{ label: '插件统计', path: '/plugins' },
|
||||||
{ label: '插件管理', path: '/plugins_manage' },
|
{ label: '插件管理', path: '/plugins_manage' },
|
||||||
{ label: '命令索引', path: '/command_catalog' },
|
|
||||||
{ label: '插件定时任务', path: '/plugin_schedules' },
|
{ label: '插件定时任务', path: '/plugin_schedules' },
|
||||||
{ label: '群级插件配置', path: '/group_plugin_config' },
|
{ label: '群级插件配置', path: '/group_plugin_config' },
|
||||||
{ label: '响应指令管理', path: '/fun_command_rules' },
|
{ label: '响应指令管理', path: '/fun_command_rules' },
|
||||||
@@ -1153,7 +1152,6 @@
|
|||||||
'12': '/virtual_group',
|
'12': '/virtual_group',
|
||||||
'13': '/api_docs',
|
'13': '/api_docs',
|
||||||
'14': '/system_status',
|
'14': '/system_status',
|
||||||
'18': '/command_catalog',
|
|
||||||
'17': '/system_llm',
|
'17': '/system_llm',
|
||||||
'15': '/file_browser',
|
'15': '/file_browser',
|
||||||
'16': '/message_push'
|
'16': '/message_push'
|
||||||
|
|||||||
@@ -1,478 +0,0 @@
|
|||||||
{% extends "base.html" %}
|
|
||||||
|
|
||||||
{% block title %}命令索引 - 机器人管理后台{% endblock %}
|
|
||||||
|
|
||||||
{% block content %}
|
|
||||||
<div class="page-shell command-catalog-page">
|
|
||||||
<div class="page-hero">
|
|
||||||
<div class="page-hero-copy">
|
|
||||||
<div class="page-eyebrow">Command Catalog</div>
|
|
||||||
<h1>命令索引</h1>
|
|
||||||
<p>集中查看当前插件命令、群可用状态、自动能力与管理员触发示例,减少靠记忆找功能的成本。</p>
|
|
||||||
</div>
|
|
||||||
<div class="page-hero-actions">
|
|
||||||
<el-select v-model="selectedGroupId" clearable filterable placeholder="选择群查看实际可用状态" @change="loadCatalog" class="hero-select">
|
|
||||||
<el-option
|
|
||||||
v-for="group in groupOptions"
|
|
||||||
:key="group.group_id"
|
|
||||||
:label="group.group_name"
|
|
||||||
:value="group.group_id">
|
|
||||||
</el-option>
|
|
||||||
</el-select>
|
|
||||||
<el-button type="primary" @click="loadCatalog">
|
|
||||||
<i class="el-icon-refresh"></i> 刷新索引
|
|
||||||
</el-button>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<el-row :gutter="16" class="overview-grid">
|
|
||||||
<el-col :xs="24" :sm="12" :md="6">
|
|
||||||
<el-card class="overview-card overview-card--primary" shadow="hover">
|
|
||||||
<div class="overview-label">可用手动命令</div>
|
|
||||||
<div class="overview-value">{% raw %}{{ summary.available_manual_count || 0 }}{% endraw %}</div>
|
|
||||||
<div class="overview-note">当前群可以直接触发的消息命令</div>
|
|
||||||
</el-card>
|
|
||||||
</el-col>
|
|
||||||
<el-col :xs="24" :sm="12" :md="6">
|
|
||||||
<el-card class="overview-card" shadow="hover">
|
|
||||||
<div class="overview-label">自动能力</div>
|
|
||||||
<div class="overview-value">{% raw %}{{ summary.available_auto_count || 0 }}{% endraw %}</div>
|
|
||||||
<div class="overview-note">无需手动发送指令的自动/定时能力</div>
|
|
||||||
</el-card>
|
|
||||||
</el-col>
|
|
||||||
<el-col :xs="24" :sm="12" :md="6">
|
|
||||||
<el-card class="overview-card overview-card--soft" shadow="hover">
|
|
||||||
<div class="overview-label">未启用命令</div>
|
|
||||||
<div class="overview-value">{% raw %}{{ summary.unavailable_manual_count || 0 }}{% endraw %}</div>
|
|
||||||
<div class="overview-note">管理员视角下可看到但当前群不可用的命令</div>
|
|
||||||
</el-card>
|
|
||||||
</el-col>
|
|
||||||
<el-col :xs="24" :sm="12" :md="6">
|
|
||||||
<el-card class="overview-card" shadow="hover">
|
|
||||||
<div class="overview-label">管理命令</div>
|
|
||||||
<div class="overview-value">{% raw %}{{ summary.admin_command_count || 0 }}{% endraw %}</div>
|
|
||||||
<div class="overview-note">群开关、管理员维护等后台辅助命令</div>
|
|
||||||
</el-card>
|
|
||||||
</el-col>
|
|
||||||
</el-row>
|
|
||||||
|
|
||||||
<el-card class="workspace-card workspace-card--filters" shadow="hover">
|
|
||||||
<div class="workspace-header workspace-header--compact">
|
|
||||||
<div>
|
|
||||||
<h3>筛选条件</h3>
|
|
||||||
<p>支持按命令、插件名、描述关键词快速定位。</p>
|
|
||||||
</div>
|
|
||||||
<el-input
|
|
||||||
v-model.trim="searchKeyword"
|
|
||||||
clearable
|
|
||||||
placeholder="搜索命令 / 插件 / 描述"
|
|
||||||
class="search-input">
|
|
||||||
<i slot="prefix" class="el-input__icon el-icon-search"></i>
|
|
||||||
</el-input>
|
|
||||||
</div>
|
|
||||||
</el-card>
|
|
||||||
|
|
||||||
<el-card class="workspace-card" shadow="hover">
|
|
||||||
<div slot="header" class="workspace-header">
|
|
||||||
<div>
|
|
||||||
<h3>当前可用命令</h3>
|
|
||||||
<p>这里展示的是当前群在管理员视角下“真实可触发”的命令入口。</p>
|
|
||||||
</div>
|
|
||||||
<div class="workspace-meta">
|
|
||||||
{% raw %}{{ activeGroupLabel }}{% endraw %}
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<el-table :data="filteredAvailableManual" style="width: 100%" v-loading="loading" empty-text="当前没有可直接使用的命令">
|
|
||||||
<el-table-column label="插件" min-width="180">
|
|
||||||
<template slot-scope="scope">
|
|
||||||
<div class="entity-title">{% raw %}{{ scope.row.name }}{% endraw %}</div>
|
|
||||||
<div class="entity-subtitle">{% raw %}{{ scope.row.description }}{% endraw %}</div>
|
|
||||||
</template>
|
|
||||||
</el-table-column>
|
|
||||||
<el-table-column label="主指令" min-width="180">
|
|
||||||
<template slot-scope="scope">
|
|
||||||
<span class="mono-text">{% raw %}{{ scope.row.primary_command || '-' }}{% endraw %}</span>
|
|
||||||
</template>
|
|
||||||
</el-table-column>
|
|
||||||
<el-table-column label="别名" min-width="220">
|
|
||||||
<template slot-scope="scope">
|
|
||||||
<div class="tag-row" v-if="scope.row.alias_commands && scope.row.alias_commands.length">
|
|
||||||
<el-tag v-for="alias in scope.row.alias_commands" :key="alias" size="mini" effect="plain">
|
|
||||||
{% raw %}{{ alias }}{% endraw %}
|
|
||||||
</el-tag>
|
|
||||||
</div>
|
|
||||||
<span v-else>-</span>
|
|
||||||
</template>
|
|
||||||
</el-table-column>
|
|
||||||
<el-table-column label="类别" width="110" align="center">
|
|
||||||
<template slot-scope="scope">
|
|
||||||
<el-tag size="small" type="success">{% raw %}{{ scope.row.category_label }}{% endraw %}</el-tag>
|
|
||||||
</template>
|
|
||||||
</el-table-column>
|
|
||||||
<el-table-column label="可用原因" min-width="150">
|
|
||||||
<template slot-scope="scope">
|
|
||||||
{% raw %}{{ scope.row.availability_reason || '-' }}{% endraw %}
|
|
||||||
</template>
|
|
||||||
</el-table-column>
|
|
||||||
<el-table-column label="Feature Key" min-width="150">
|
|
||||||
<template slot-scope="scope">
|
|
||||||
<span class="mono-text">{% raw %}{{ scope.row.feature_key || '-' }}{% endraw %}</span>
|
|
||||||
</template>
|
|
||||||
</el-table-column>
|
|
||||||
</el-table>
|
|
||||||
</el-card>
|
|
||||||
|
|
||||||
<el-row :gutter="16" class="insight-grid">
|
|
||||||
<el-col :xs="24" :lg="12">
|
|
||||||
<el-card class="workspace-card" shadow="hover">
|
|
||||||
<div slot="header" class="workspace-header">
|
|
||||||
<div>
|
|
||||||
<h3>未启用命令</h3>
|
|
||||||
<p>这部分只在后台管理员视角展示,便于你知道还有哪些能力没在当前群打开。</p>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<el-table :data="filteredUnavailableManual" style="width: 100%" v-loading="loading" empty-text="当前没有未启用命令">
|
|
||||||
<el-table-column label="插件" min-width="160">
|
|
||||||
<template slot-scope="scope">
|
|
||||||
<div class="entity-title">{% raw %}{{ scope.row.name }}{% endraw %}</div>
|
|
||||||
<div class="entity-subtitle">{% raw %}{{ scope.row.description }}{% endraw %}</div>
|
|
||||||
</template>
|
|
||||||
</el-table-column>
|
|
||||||
<el-table-column label="命令" min-width="150">
|
|
||||||
<template slot-scope="scope">
|
|
||||||
<span class="mono-text">{% raw %}{{ scope.row.primary_command || '-' }}{% endraw %}</span>
|
|
||||||
</template>
|
|
||||||
</el-table-column>
|
|
||||||
<el-table-column label="原因" min-width="140">
|
|
||||||
<template slot-scope="scope">
|
|
||||||
<el-tag size="mini" type="warning">{% raw %}{{ scope.row.availability_reason || '-' }}{% endraw %}</el-tag>
|
|
||||||
</template>
|
|
||||||
</el-table-column>
|
|
||||||
</el-table>
|
|
||||||
</el-card>
|
|
||||||
</el-col>
|
|
||||||
<el-col :xs="24" :lg="12">
|
|
||||||
<el-card class="workspace-card" shadow="hover">
|
|
||||||
<div slot="header" class="workspace-header">
|
|
||||||
<div>
|
|
||||||
<h3>自动/定时能力</h3>
|
|
||||||
<p>用于提醒你哪些功能不是靠用户发命令触发,而是自动执行。</p>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="info-list">
|
|
||||||
<div v-if="filteredAutoCommands.length === 0" class="empty-state">当前没有已启用的自动能力</div>
|
|
||||||
<div v-for="item in filteredAutoCommands" :key="item.module_name" class="info-item">
|
|
||||||
<div class="info-item__head">
|
|
||||||
<div class="info-item__title">{% raw %}{{ item.name }}{% endraw %}</div>
|
|
||||||
<el-tag size="mini" type="info">{% raw %}{{ item.category_label }}{% endraw %}</el-tag>
|
|
||||||
</div>
|
|
||||||
<div class="info-item__desc">{% raw %}{{ item.description }}{% endraw %}</div>
|
|
||||||
<div class="info-item__meta">{% raw %}{{ item.availability_reason || '自动执行' }}{% endraw %}</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</el-card>
|
|
||||||
</el-col>
|
|
||||||
</el-row>
|
|
||||||
|
|
||||||
<el-card class="workspace-card" shadow="hover">
|
|
||||||
<div slot="header" class="workspace-header">
|
|
||||||
<div>
|
|
||||||
<h3>管理命令示例</h3>
|
|
||||||
<p>给管理员的常用操作命令,适合快速开关功能和维护群管理员。</p>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="info-list info-list--grid">
|
|
||||||
<div v-if="!adminCommands.length" class="empty-state">当前没有管理命令示例</div>
|
|
||||||
<div v-for="item in adminCommands" :key="item.example" class="info-item">
|
|
||||||
<div class="info-item__head">
|
|
||||||
<div class="info-item__title">{% raw %}{{ item.title }}{% endraw %}</div>
|
|
||||||
</div>
|
|
||||||
<div class="info-item__command mono-text">{% raw %}{{ item.example }}{% endraw %}</div>
|
|
||||||
<div class="info-item__desc">{% raw %}{{ item.description }}{% endraw %}</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</el-card>
|
|
||||||
</div>
|
|
||||||
{% endblock %}
|
|
||||||
|
|
||||||
{% block scripts %}
|
|
||||||
<script>
|
|
||||||
new Vue({
|
|
||||||
el: '#app',
|
|
||||||
mixins: [baseApp],
|
|
||||||
data() {
|
|
||||||
return {
|
|
||||||
currentView: '18',
|
|
||||||
loading: false,
|
|
||||||
searchKeyword: '',
|
|
||||||
selectedGroupId: '',
|
|
||||||
groupOptions: [],
|
|
||||||
summary: {
|
|
||||||
available_manual_count: 0,
|
|
||||||
available_auto_count: 0,
|
|
||||||
unavailable_manual_count: 0,
|
|
||||||
admin_command_count: 0
|
|
||||||
},
|
|
||||||
availableManual: [],
|
|
||||||
unavailableManual: [],
|
|
||||||
autoCommands: [],
|
|
||||||
adminCommands: [],
|
|
||||||
generatedAt: ''
|
|
||||||
};
|
|
||||||
},
|
|
||||||
computed: {
|
|
||||||
activeGroupLabel() {
|
|
||||||
if (!this.selectedGroupId) {
|
|
||||||
return '当前视角:全部运行中插件(未指定群)';
|
|
||||||
}
|
|
||||||
const matched = (this.groupOptions || []).find(item => item.group_id === this.selectedGroupId);
|
|
||||||
return `当前视角:${matched ? matched.group_name : this.selectedGroupId}`;
|
|
||||||
},
|
|
||||||
filteredAvailableManual() {
|
|
||||||
return this.filterCommandItems(this.availableManual);
|
|
||||||
},
|
|
||||||
filteredUnavailableManual() {
|
|
||||||
return this.filterCommandItems(this.unavailableManual);
|
|
||||||
},
|
|
||||||
filteredAutoCommands() {
|
|
||||||
return this.filterCommandItems(this.autoCommands);
|
|
||||||
}
|
|
||||||
},
|
|
||||||
mounted() {
|
|
||||||
this.currentView = '18';
|
|
||||||
this.loadCatalog();
|
|
||||||
},
|
|
||||||
methods: {
|
|
||||||
filterCommandItems(items) {
|
|
||||||
const keyword = String(this.searchKeyword || '').trim().toLowerCase();
|
|
||||||
if (!keyword) return items || [];
|
|
||||||
return (items || []).filter(item => {
|
|
||||||
const aliasText = ((item.alias_commands || []).join(' ') || '').toLowerCase();
|
|
||||||
const fullText = [
|
|
||||||
item.name,
|
|
||||||
item.description,
|
|
||||||
item.primary_command,
|
|
||||||
aliasText,
|
|
||||||
item.feature_key,
|
|
||||||
item.availability_reason
|
|
||||||
].join(' ').toLowerCase();
|
|
||||||
return fullText.includes(keyword);
|
|
||||||
});
|
|
||||||
},
|
|
||||||
loadCatalog() {
|
|
||||||
this.loading = true;
|
|
||||||
axios.get('/api/plugins/command_catalog', {
|
|
||||||
params: {
|
|
||||||
group_id: this.selectedGroupId
|
|
||||||
}
|
|
||||||
})
|
|
||||||
.then(response => {
|
|
||||||
if (response.data.success) {
|
|
||||||
const payload = response.data.data || {};
|
|
||||||
this.groupOptions = payload.group_options || [];
|
|
||||||
this.summary = payload.summary || this.summary;
|
|
||||||
this.availableManual = payload.available_manual || [];
|
|
||||||
this.unavailableManual = payload.unavailable_manual || [];
|
|
||||||
this.autoCommands = payload.available_auto || [];
|
|
||||||
this.adminCommands = payload.admin_commands || [];
|
|
||||||
this.generatedAt = payload.generated_at || '';
|
|
||||||
} else {
|
|
||||||
this.$message.error(response.data.message || '加载命令索引失败');
|
|
||||||
}
|
|
||||||
})
|
|
||||||
.catch(error => {
|
|
||||||
console.error('加载命令索引出错:', error);
|
|
||||||
this.$message.error('加载命令索引出错');
|
|
||||||
})
|
|
||||||
.finally(() => {
|
|
||||||
this.loading = false;
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
</script>
|
|
||||||
{% endblock %}
|
|
||||||
|
|
||||||
{% block styles %}
|
|
||||||
<style>
|
|
||||||
.page-shell {
|
|
||||||
display: flex;
|
|
||||||
flex-direction: column;
|
|
||||||
gap: 16px;
|
|
||||||
}
|
|
||||||
.page-hero {
|
|
||||||
display: flex;
|
|
||||||
align-items: flex-end;
|
|
||||||
justify-content: space-between;
|
|
||||||
gap: 18px;
|
|
||||||
padding: 24px 26px;
|
|
||||||
border-radius: 24px;
|
|
||||||
background: linear-gradient(135deg, rgba(79,70,229,0.10), rgba(59,130,246,0.08), rgba(255,255,255,0.92));
|
|
||||||
border: 1px solid rgba(148, 163, 184, 0.16);
|
|
||||||
box-shadow: 0 18px 40px rgba(15, 23, 42, 0.06);
|
|
||||||
}
|
|
||||||
.page-eyebrow {
|
|
||||||
font-size: 12px;
|
|
||||||
text-transform: uppercase;
|
|
||||||
letter-spacing: .08em;
|
|
||||||
color: #6366f1;
|
|
||||||
font-weight: 700;
|
|
||||||
margin-bottom: 8px;
|
|
||||||
}
|
|
||||||
.page-hero-copy h1 {
|
|
||||||
font-size: 30px;
|
|
||||||
line-height: 1.1;
|
|
||||||
margin-bottom: 10px;
|
|
||||||
color: #0f172a;
|
|
||||||
}
|
|
||||||
.page-hero-copy p {
|
|
||||||
color: #64748b;
|
|
||||||
font-size: 14px;
|
|
||||||
}
|
|
||||||
.page-hero-actions {
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
gap: 12px;
|
|
||||||
flex-wrap: wrap;
|
|
||||||
}
|
|
||||||
.hero-select {
|
|
||||||
width: 280px;
|
|
||||||
max-width: 100%;
|
|
||||||
}
|
|
||||||
.overview-grid .el-col,
|
|
||||||
.insight-grid .el-col {
|
|
||||||
margin-bottom: 16px;
|
|
||||||
}
|
|
||||||
.overview-card { min-height: 112px; }
|
|
||||||
.overview-card--primary {
|
|
||||||
background: linear-gradient(180deg, rgba(79,70,229,0.10), rgba(255,255,255,0.94)) !important;
|
|
||||||
}
|
|
||||||
.overview-card--soft {
|
|
||||||
background: linear-gradient(180deg, rgba(59,130,246,0.08), rgba(255,255,255,0.94)) !important;
|
|
||||||
}
|
|
||||||
.overview-label { font-size: 13px; color: #64748b; margin-bottom: 14px; }
|
|
||||||
.overview-value { font-size: 30px; font-weight: 700; color: #0f172a; margin-bottom: 10px; }
|
|
||||||
.overview-note { font-size: 12px; color: #94a3b8; }
|
|
||||||
.workspace-header {
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
justify-content: space-between;
|
|
||||||
gap: 16px;
|
|
||||||
}
|
|
||||||
.workspace-header--compact {
|
|
||||||
align-items: flex-end;
|
|
||||||
}
|
|
||||||
.workspace-header h3 { font-size: 18px; margin-bottom: 4px; }
|
|
||||||
.workspace-header p { font-size: 13px; color: #64748b; }
|
|
||||||
.workspace-meta {
|
|
||||||
font-size: 12px;
|
|
||||||
color: #94a3b8;
|
|
||||||
white-space: nowrap;
|
|
||||||
}
|
|
||||||
.search-input {
|
|
||||||
width: 280px;
|
|
||||||
max-width: 100%;
|
|
||||||
}
|
|
||||||
.entity-title {
|
|
||||||
font-size: 14px;
|
|
||||||
font-weight: 600;
|
|
||||||
color: #0f172a;
|
|
||||||
}
|
|
||||||
.entity-subtitle {
|
|
||||||
margin-top: 4px;
|
|
||||||
font-size: 12px;
|
|
||||||
color: #94a3b8;
|
|
||||||
line-height: 1.6;
|
|
||||||
}
|
|
||||||
.mono-text {
|
|
||||||
font-family: Consolas, "SFMono-Regular", Menlo, monospace;
|
|
||||||
color: #334155;
|
|
||||||
}
|
|
||||||
.tag-row {
|
|
||||||
display: flex;
|
|
||||||
flex-wrap: wrap;
|
|
||||||
gap: 6px;
|
|
||||||
}
|
|
||||||
.info-list {
|
|
||||||
display: flex;
|
|
||||||
flex-direction: column;
|
|
||||||
gap: 12px;
|
|
||||||
}
|
|
||||||
.info-list--grid {
|
|
||||||
display: grid;
|
|
||||||
grid-template-columns: repeat(2, minmax(0, 1fr));
|
|
||||||
gap: 12px;
|
|
||||||
}
|
|
||||||
.info-item {
|
|
||||||
padding: 14px;
|
|
||||||
border-radius: 16px;
|
|
||||||
background: rgba(248,250,252,0.82);
|
|
||||||
border: 1px solid rgba(148,163,184,0.12);
|
|
||||||
}
|
|
||||||
.info-item__head {
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
justify-content: space-between;
|
|
||||||
gap: 12px;
|
|
||||||
margin-bottom: 8px;
|
|
||||||
}
|
|
||||||
.info-item__title {
|
|
||||||
font-size: 14px;
|
|
||||||
font-weight: 700;
|
|
||||||
color: #0f172a;
|
|
||||||
}
|
|
||||||
.info-item__command {
|
|
||||||
margin-bottom: 8px;
|
|
||||||
font-size: 13px;
|
|
||||||
}
|
|
||||||
.info-item__desc {
|
|
||||||
font-size: 13px;
|
|
||||||
line-height: 1.7;
|
|
||||||
color: #475569;
|
|
||||||
word-break: break-word;
|
|
||||||
}
|
|
||||||
.info-item__meta {
|
|
||||||
margin-top: 8px;
|
|
||||||
font-size: 12px;
|
|
||||||
color: #94a3b8;
|
|
||||||
}
|
|
||||||
.empty-state {
|
|
||||||
padding: 16px 12px;
|
|
||||||
text-align: center;
|
|
||||||
color: #94a3b8;
|
|
||||||
font-size: 13px;
|
|
||||||
background: rgba(248, 250, 252, 0.9);
|
|
||||||
border: 1px dashed rgba(148, 163, 184, 0.35);
|
|
||||||
border-radius: 14px;
|
|
||||||
}
|
|
||||||
@media (max-width: 900px) {
|
|
||||||
.page-hero,
|
|
||||||
.workspace-header,
|
|
||||||
.workspace-header--compact {
|
|
||||||
flex-direction: column;
|
|
||||||
align-items: flex-start;
|
|
||||||
}
|
|
||||||
.page-hero-actions,
|
|
||||||
.hero-select,
|
|
||||||
.search-input {
|
|
||||||
width: 100%;
|
|
||||||
}
|
|
||||||
.info-list--grid {
|
|
||||||
grid-template-columns: 1fr;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@media (max-width: 768px) {
|
|
||||||
.page-hero {
|
|
||||||
padding: 18px 16px;
|
|
||||||
border-radius: 20px;
|
|
||||||
}
|
|
||||||
.page-hero-copy h1 {
|
|
||||||
font-size: 24px;
|
|
||||||
}
|
|
||||||
.workspace-card .el-card__body {
|
|
||||||
padding: 14px;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
{% endblock %}
|
|
||||||
@@ -585,8 +585,7 @@
|
|||||||
|
|
||||||
- 第一阶段已完成:`菜单 指令清单 / 功能清单 / 命令清单 / 帮助` 已改为基于运行中插件快照自动生成
|
- 第一阶段已完成:`菜单 指令清单 / 功能清单 / 命令清单 / 帮助` 已改为基于运行中插件快照自动生成
|
||||||
- 第一阶段已完成:指令清单已按当前群真实可用状态过滤,管理员可额外看到未启用命令与管理命令
|
- 第一阶段已完成:指令清单已按当前群真实可用状态过滤,管理员可额外看到未启用命令与管理命令
|
||||||
- 第二阶段已完成:后台已新增“命令索引”页面,可按群查看真实可用命令、未启用命令、自动能力与管理员触发示例
|
- 后续可继续补充后台命令索引页、插件触发示例模板与更细粒度的分类标签
|
||||||
- 后续可继续补充插件触发示例模板、命令分类标签与更细粒度的使用说明
|
|
||||||
|
|
||||||
建议内容:
|
建议内容:
|
||||||
|
|
||||||
|
|||||||
@@ -297,7 +297,7 @@ class RobotMenuRenderTool:
|
|||||||
"status_label": str(normalized_snapshot.get("status_label") or "").strip(),
|
"status_label": str(normalized_snapshot.get("status_label") or "").strip(),
|
||||||
}
|
}
|
||||||
|
|
||||||
def _collect_command_catalog(self, group_id: str, requester_id: str, force_admin: Optional[bool] = None) -> dict:
|
def _collect_command_catalog(self, group_id: str, requester_id: str) -> dict:
|
||||||
"""采集当前群和当前身份视角下的命令清单。
|
"""采集当前群和当前身份视角下的命令清单。
|
||||||
|
|
||||||
输出结构分三层:
|
输出结构分三层:
|
||||||
@@ -307,10 +307,7 @@ class RobotMenuRenderTool:
|
|||||||
"""
|
"""
|
||||||
plugin_manager = self._get_plugin_manager()
|
plugin_manager = self._get_plugin_manager()
|
||||||
snapshots = plugin_manager.get_plugin_snapshots()
|
snapshots = plugin_manager.get_plugin_snapshots()
|
||||||
if force_admin is None:
|
|
||||||
is_admin = bool(GroupBotManager.is_admin_for_group(requester_id, group_id)) if group_id else bool(GroupBotManager.is_admin(requester_id))
|
is_admin = bool(GroupBotManager.is_admin_for_group(requester_id, group_id)) if group_id else bool(GroupBotManager.is_admin(requester_id))
|
||||||
else:
|
|
||||||
is_admin = bool(force_admin)
|
|
||||||
|
|
||||||
available_manual = []
|
available_manual = []
|
||||||
available_auto = []
|
available_auto = []
|
||||||
@@ -359,13 +356,9 @@ class RobotMenuRenderTool:
|
|||||||
"generated_at": time.strftime("%Y-%m-%d %H:%M:%S", time.localtime()),
|
"generated_at": time.strftime("%Y-%m-%d %H:%M:%S", time.localtime()),
|
||||||
}
|
}
|
||||||
|
|
||||||
def build_command_catalog_data(self, group_id: str, requester_id: str, force_admin: Optional[bool] = None) -> dict:
|
|
||||||
"""对外暴露统一的命令目录结构,供机器人菜单和后台页面共同复用。"""
|
|
||||||
return self._collect_command_catalog(group_id, requester_id, force_admin=force_admin)
|
|
||||||
|
|
||||||
def build_command_catalog_text(self, group_id: str, requester_id: str) -> str:
|
def build_command_catalog_text(self, group_id: str, requester_id: str) -> str:
|
||||||
"""构建适合直接发送给用户的文本版命令清单。"""
|
"""构建适合直接发送给用户的文本版命令清单。"""
|
||||||
catalog = self.build_command_catalog_data(group_id, requester_id)
|
catalog = self._collect_command_catalog(group_id, requester_id)
|
||||||
lines = [
|
lines = [
|
||||||
"📚 当前群指令清单",
|
"📚 当前群指令清单",
|
||||||
f"群ID:{catalog['group_id'] or '私聊'}",
|
f"群ID:{catalog['group_id'] or '私聊'}",
|
||||||
@@ -418,7 +411,7 @@ class RobotMenuRenderTool:
|
|||||||
|
|
||||||
def build_command_catalog_markdown(self, group_id: str, requester_id: str) -> str:
|
def build_command_catalog_markdown(self, group_id: str, requester_id: str) -> str:
|
||||||
"""构建适合图片渲染的 Markdown 版指令清单。"""
|
"""构建适合图片渲染的 Markdown 版指令清单。"""
|
||||||
catalog = self.build_command_catalog_data(group_id, requester_id)
|
catalog = self._collect_command_catalog(group_id, requester_id)
|
||||||
lines = [
|
lines = [
|
||||||
"# 机器人指令清单",
|
"# 机器人指令清单",
|
||||||
"",
|
"",
|
||||||
|
|||||||
Reference in New Issue
Block a user