Introduction¶
DeepSeek Harness (DSH) extends capabilities through its plugin mechanism. The dsh-mysql plugin provides basic MySQL connection management and query tools. Building on this, the dsh-plugin-nlbi plugin adds natural language query (Text2SQL) and business intelligence (BI) reporting features. This plugin aims to lower the barrier to writing SQL, enabling developers or business users to interact with databases through natural language and directly generate visual charts.
This plugin is maintained by 1byteone and built on the connection foundation of dsh-mysql (v0.1.4). It retains the original connection management capabilities while adding intelligent querying, chart generation, and report favoriting.
Core Features¶
The plugin provides the following main capabilities:
- Natural Language Query (
nl_query): Based on Text2SQL technology, it converts natural language into SQL statements. The generation process includes AST syntax tree validation and regex validation to ensure safety. - BI Chart Generation (
sql_to_chart): Automatically generates chart specifications based on query results, supporting multiple chart types. - Report Favoriting and Management: Provides interfaces such as
save_report,list_reports,delete_report, andrerun_reportfor managing generated reports. - Data Browser: Includes SchemaTree (table structure navigation tree) and GridPanel (data grid), supporting table structure browsing, data preview, pagination, sorting, and WHERE filtering in the right sidebar.
- Intelligent Querying and Sidebar Workbench: Provides a right sidebar workbench that integrates intelligent querying, data browsing, and reporting features.
- Inherited Connection Management Tools: Inherits the tools from
dsh-mysql, includingmysql_query(read-only queries),mysql_tables(inspect table structures), andmysql_execute(write operations).
Installation and Activation¶
Before installation, make sure Node.js >= 18 is installed.
# 安装最新稳定版插件
dsh plugin --profile web add dsh-plugin-nlbi@latest
After installation, you need to restart the DeepSeek Harness Web process:
dsh web
If a port-in-use error is reported during startup (for example, EADDRINUSE: address already in use 127.0.0.1:3080), it means the service is already running. Simply visit http://127.0.0.1:3080; there is no need to run the installation command again.
Typical Usage¶
1. Natural Language Database Querying in Conversation¶
Enter natural language in the DSH conversation input box. The system will invoke the nl_query tool. The generated SQL is displayed as a draft, and the user must explicitly click the “Run” button to execute it.
- Example:
用户:上个月每天的订单量是多少?
系统调用:nl_query
结果:返回表格数据及对应的 BI 图表
2. All-in-One Right Sidebar Workbench¶
The right sidebar features depend on the betterSidebar or dsh-web-ui-all plugin. If the prerequisite plugin is not installed, the system automatically falls back, and core features remain available from the settings page.
Open the right sidebar and go to the Nlbi Database tab, which contains three sub-areas:
- Intelligent Querying: Enter natural language to instantly return tables and charts, with one-click “Send to Conversation” support.
- Data Browsing: Select a table through the left-side SchemaTree; the right-side GridPanel displays the data.
- Reports: Generate charts with natural language, with support for favoriting, rerunning, and exporting.
Notes¶
- LLM Dependency: The Text2SQL feature of
nl_querydepends on an LLM service (such as DeepSeek or OpenAI). - MySQL Only: The plugin inherits from
dsh-mysqland currently supports MySQL databases only. - Security:
nl_queryenforces read-only operations, even if the database connection has write permissions enabled. SQL generation goes through dual validation (AST + regex) to prevent write operations from slipping through. - Chart Export: Chart export currently supports exporting SQL only (in Markdown format).
- Sidebar Dependency: The intelligent querying, data browsing, and report features in the right sidebar require support from the
betterSidebarordsh-web-ui-allplugin, but fallback handling has been implemented. Without the sidebar, the features remain usable.
References¶
- Plugin Directory: https://www.skillhub.cn/plugins/1byteone/dsh-plugin-nlbi
- GitHub Repository: https://github.com/1byteone/dsh-plugin-nlbi
- License: MIT