Repository navigation
zh dev star guides plugin views index
github-actions[bot] edited this page Nov 17, 2026
·
2 revisions
在插件中提供 HTML 界面,并通过 Bridge 与 AstrBot 通信。根据界面的使用位置选择 metadata 中的 target:
| 界面 | target |
适用场景 | 打开方式 |
|---|---|---|---|
| 独立插件页面 | plugin_page |
设置、管理面板、日志 | WebUI 插件入口 |
| 消息交互组件 | chat_message |
结果列表、选择器、确认表单 | 命令、消息处理器或工具返回 event.view_result()
|
| 工作台页面 | chat_workbench |
文件预览、笔记、会话分析 | event.view_result() |
| 双入口工作台 | chat_workbench_with_launcher |
笔记、会话分析 |
event.view_result() 或工作台「+」入口 |
在插件的 metadata.yaml 中通过 views 声明视图。name 在插件内唯一,入口固定为 views/<name>/index.html,无需声明 entry。Python 只负责创建视图、处理 action 或提供 Web API。
views:
- name: context_usage
target: chat_workbench_with_launcher
title: 上下文用量
description: 查看当前会话的 token 使用情况target 默认是 plugin_page,保留旧页面声明的行为。消息组件填写 chat_message;只由插件打开的工作台填写 chat_workbench;同时允许从「+」打开的工作台填写 chat_workbench_with_launcher。所有 ChatUI target 都不会出现在独立插件页面列表中,未声明的目录仍自动发现为独立页面。
title、description 是默认文案;i18n 按字段覆盖,规则见视图文案。version 默认为 1;actions 声明消息实例允许调用的 action,默认为空。独立页面不声明 actions。
如果只需要几个配置项,使用插件配置即可。
-
消息组件、消息创建的工作台页面:使用
bridge.view.action()调用@filter.ui_action,通过event.view_result(data=...)更新视图数据。 -
独立页面、常驻工作台页面:使用
bridge.apiGet()、apiPost()等调用插件的后端 Web API。
所有界面共享Bridge API中的初始化、主题和国际化接口。各宿主支持的操作见能力表。
::: details 文档入口调整
| 原入口 | 当前入口 |
|---|---|
插件可视化视图(plugin-pages.md) |
本节下的「独立插件页面」「共享 Bridge API」「后端 Web API」 |
ChatUI 交互卡片(chatui-views.md) |
本节下的「消息交互组件」「工作台页面」 |
旧链接保留跳转。 :::
- 首页
- 文档入口
- Top Level
- community events
- config
- deploy
- dev
- others
- platform
- 接入 OneBot v11 协议实现
- 接入钉钉 DingTalk
- 接入 Discord
- 接入 Kook
- 接入飞书
- 接入 LINE
- 接入 Matrix
- 接入 Mattermost
- 接入 Misskey 平台
- 接入 QQ 官方机器人平台
- 通过 QQ官方机器人 接入 QQ (Webhook)
- 通过 QQ官方机器人 接入 QQ (Websockets)
- 接入 Satori 协议
- 接入 server-satori (基于 Koishi)
- 接入 Slack
- 接入消息平台
- 接入 Telegram
- 接入 VoceChat
- AstrBot 接入企业微信
- 接入企业微信智能机器人平台
- AstrBot 接入微信公众平台
- 接入个人微信
- providers
- use
- Home
- Docs Entry
- Top Level
- config
- deploy
- Deploy AstrBot on 1Panel
- Deploy AstrBot on BT Panel
- Deploy AstrBot on CasaOS
- Deploy AstrBot from Source Code
- Community-Provided Deployment Methods
- Deploy via Compshare
- Deploy with AstrBot Desktop Client
- Deploy AstrBot with Docker
- Deploy AstrBot with Kubernetes
- Deploy AstrBot with AstrBot Launcher
- Other Deployments
- Script Deployment
- Installation via System Package Manager
- Preface
- dev
- AstrBot Configuration File
- API Scope–Endpoint Reference
- AstrBot HTTP API
- AstrBot Plugin Market JSON Specification
- AstrBot Plugin Market JSON Specification
- Developing a Platform Adapter
- plugin
- AI
- Agents
- Sessions and Conversations
- Models
- Other APIs
- Tools
- Documentation moved
- Text to Image
- Handling Message Events
- Plugin Configuration
- Plugin Internationalization
- Documentation moved
- Shared Bridge API
- Interactive message component
- Standalone plugin page
- Backend Web APIs
- Workbench page
- Sending Messages
- Session Control
- Minimal Example
- Plugin Storage
- AstrBot Plugin Development Guide 🌠
- Publishing Plugins to the Plugin Marketplace
- ospp
- others
- platform
- Connect OneBot v11 Protocol Implementations
- Connect to DingTalk
- Connecting to Discord
- Connect to KOOK
- Connecting to Lark
- Connecting to LINE
- Connecting to Matrix
- Connecting to Mattermost
- Connecting to Misskey Platform
- Connect QQ Official Bot
- Connect QQ via QQ Official Bot (Webhook)
- Connect QQ via QQ Official Bot (Websockets)
- Connect to Satori Protocol
- Connect server-satori (Koishi)
- Connecting to Slack
- Messaging Platforms
- Connecting to Telegram
- Connect to VoceChat
- Connect AstrBot to WeCom
- Connect to WeCom AI Bot Platform
- Connect AstrBot to WeChat Official Account Platform
- Connect Personal WeChat
- providers
- Connect 302.AI
- Agent Runners
- Built-in Agent Runner
- Connect to Coze
- Connect to Alibaba Cloud Bailian Application
- Connect to DeerFlow
- Connect to Dify
- Connect AIHubMix
- coze
- dashscope
- DeepSeek STT Integration
- DeepSeek TTS Integration
- dify
- Model input images
- Large Language Model Providers
- Connect MiraRouter
- NewAPI
- Connect PPIO Cloud
- Connect LM Studio to Use DeepSeek-R1 and Other Models
- Integrating Ollama
- Connect ShengSuanYun
- Connecting to SiliconFlow
- Connecting Model Services
- Connecting to TokenPony
- use
- Agent Execution Mode {#agent-runner}
- Agent Sandbox Environment
- astrbot sandbox
- AstrBot CLI {#cli-commands}
- Docker-based Code Interpreter
- Built-in Commands
- computer
- Context Compression
- Session Configuration Mappings (formerly Custom Rules)
- AstrBot Knowledge Base
- MCP
- AstrBot Plugins {#astrbot-star}
- Proactive Capabilities
- Skills {#anthropic-skills}
- Subagents {#agent-handsoff-and-subagent}
- Unified Webhook Mode
- Web Search
- DeepSeek Search API
- SerpApi
- WebUI