alibabacloud-quickbi-smartq

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Quick BI-SmartQ — QuickBI Data Analysis Assistant

Quick BI-SmartQ — QuickBI 数据分析助手

One entry point covering all QuickBI data analysis capabilities. Automatically routes to the corresponding module based on user intent — no manual selection required.
一站式覆盖所有QuickBI数据分析能力。根据用户意图自动路由到对应模块——无需手动选择。

Scope

适用范围

Does:
  • Automatically identify user intent and route to the corresponding data analysis module
  • Perform natural-language analysis on user-uploaded Excel/CSV files via the Quick BI API (File Q&A)
  • Perform natural-language query analysis on Quick BI platform datasets, with automatic intelligent table selection and matching (Dataset Q&A)
  • Parse PDF/Word/Excel/CSV/images, extract text, and support extracting key fields to generate structured Excel (Document Parsing)
  • Auto-convert QuickBI dashboards into data query skills (Dashboard Skill Generation)
  • Perform deep insight analysis on datasets (Data Insight)
  • Auto-generate professional data reports based on analysis results (Data Report)
Does NOT:
  • Use pandas/openpyxl/csv or similar libraries to read files locally for analysis in Q&A scenarios
  • Require users to manually choose a module or provide internal parameters such as cubeId
  • Perform tasks unrelated to QuickBI data analysis
支持的功能:
  • 自动识别用户意图并路由到对应的数据分析模块
  • 通过Quick BI API对用户上传的Excel/CSV文件进行自然语言分析(文件问数)
  • 对Quick BI平台数据集进行自然语言查询分析,自动智能选表匹配(数据集问数)
  • 解析PDF/Word/Excel/CSV/图片,提取文本,支持提取关键字段生成结构化Excel(文档解析)
  • 自动将QuickBI仪表板转换为数据查询技能(仪表板技能生成)
  • 对数据集进行深度洞察分析(数据洞察)
  • 基于分析结果自动生成专业数据报告(数据报告)
不支持的功能:
  • 在问答场景中使用pandas/openpyxl/csv等库本地读取文件进行分析
  • 要求用户手动选择模块或提供cubeId等内部参数
  • 执行与QuickBI数据分析无关的任务

Task Routing

任务路由

Automatically determine intent based on user input and route to the corresponding module for execution.
根据用户输入自动判断意图,并路由到对应模块执行。

Routing Decision Table

路由决策表

User IntentRouted ModuleReference Document
Uploaded Excel/CSV file, wants to query specific metrics or answer specific data questions (e.g. TOP N, comparison, filtering)File Q&Amodule-chat-file.md
上传了 Excel/CSV 文件,要查询具体指标或回答具体数据问题(如 TOP N、对比、筛选)File Q&Amodule-chat-file.md
No file uploaded, wants to query/analyze specific metrics in platform datasetsDataset Q&Amodule-chat-dataset.md
未上传文件,要查询/分析平台数据集中的具体指标Dataset Q&Amodule-chat-dataset.md
Uploaded multiple files (PDF/Word/images etc.) or selected a folder, wants to query specific data questions (e.g. TOP N, comparison, filtering)Document Parsing → File Q&Amodule-document-parser.mdmodule-chat-file.md
上传了多个文件(PDF/word/图片等),或者选择文件夹,要查询具体数据问题(如 TOP N、对比、筛选)Document Parsing → File Q&Amodule-document-parser.mdmodule-chat-file.md
Uploaded PDF/Word/images or other unstructured documents, or selected a folder, wants to parse all file contents or extract fieldsDocument Parsingmodule-document-parser.md
上传了 PDF/Word/图片等非结构化文档,或者选择文件夹,要解析所有文件内容或提取字段Document Parsingmodule-document-parser.md
Provided a QuickBI dashboard URL, wants to generate a query skillDashboard Skill Generationmodule-dashboard.md
提供了 QuickBI 仪表板 URL,要生成查询技能Dashboard Skill Generationmodule-dashboard.md
Uploaded Excel file, wants deep interpretation/insight/trend analysis of data (not generating a report document)Data Insightmodule-data-insight.md
上传了 Excel 文件,要对数据进行深度解读/洞察/趋势分析(不生成报告文档)Data Insightmodule-data-insight.md
Uploaded multiple files (PDF/Word/images etc.) or selected a folder, wants deep interpretation/insight/trend analysis of data (not generating a report document)Document Parsing → Data Insightmodule-document-parser.mdmodule-data-insight.md
上传了多个文件(PDF/word/图片等),或者选择文件夹,要对数据进行深度解读/洞察/趋势分析(不生成报告文档)Document Parsing → Data Insightmodule-document-parser.mdmodule-data-insight.md
Wants to generate a report/analysis report/review report, regardless of whether files are uploadedData Reportmodule-data-report.md
要生成报告/分析报告/复盘报告,无论是否上传文件Data Reportmodule-data-report.md
用户意图路由模块参考文档
上传Excel/CSV文件,想要查询具体指标或解答特定数据问题(如TOP N、对比、筛选)File Q&Amodule-chat-file.md
上传了 Excel/CSV 文件,要查询具体指标或回答具体数据问题(如 TOP N、对比、筛选)File Q&Amodule-chat-file.md
未上传文件,想要查询/分析平台数据集中的具体指标Dataset Q&Amodule-chat-dataset.md
未上传文件,要查询/分析平台数据集中的具体指标Dataset Q&Amodule-chat-dataset.md
上传多个文件(PDF/Word/图片等)或选择文件夹,想要查询具体数据问题(如TOP N、对比、筛选)Document Parsing → File Q&Amodule-document-parser.mdmodule-chat-file.md
上传了多个文件(PDF/word/图片等),或者选择文件夹,要查询具体数据问题(如 TOP N、对比、筛选)Document Parsing → File Q&Amodule-document-parser.mdmodule-chat-file.md
上传PDF/Word/图片等非结构化文档或选择文件夹,想要解析所有文件内容或提取字段Document Parsingmodule-document-parser.md
上传了 PDF/Word/图片等非结构化文档,或者选择文件夹,要解析所有文件内容或提取字段Document Parsingmodule-document-parser.md
提供QuickBI仪表板URL,想要生成查询技能Dashboard Skill Generationmodule-dashboard.md
提供了 QuickBI 仪表板 URL,要生成查询技能Dashboard Skill Generationmodule-dashboard.md
上传Excel文件,想要对数据进行深度解读/洞察/趋势分析(不生成报告文档)Data Insightmodule-data-insight.md
上传了 Excel 文件,要对数据进行深度解读/洞察/趋势分析(不生成报告文档)Data Insightmodule-data-insight.md
上传多个文件(PDF/Word/图片等)或选择文件夹,想要对数据进行深度解读/洞察/趋势分析(不生成报告文档)Document Parsing → Data Insightmodule-document-parser.mdmodule-data-insight.md
上传了多个文件(PDF/word/图片等),或者选择文件夹,要对数据进行深度解读/洞察/趋势分析(不生成报告文档)Document Parsing → Data Insightmodule-document-parser.mdmodule-data-insight.md
想要生成报告/分析报告/复盘报告,无论是否上传文件Data Reportmodule-data-report.md
要生成报告/分析报告/复盘报告,无论是否上传文件Data Reportmodule-data-report.md

Routing Priority Rules

路由优先级规则

When user intent may match multiple modules, determine by the following priority:
  1. "Report" keyword takes priority (「报告」关键词优先): When user intent contains keywords like "report", "review", "summary report", "analysis report" (报告/复盘/总结报告/分析报告), ALWAYS route to the Data Report module, regardless of whether files are uploaded. Data Report module has higher priority than File Q&A and Data Insight.
  2. "Interpret", "insight", "trend" keywords (「解读」「洞察」「趋势」关键词): When user wants to understand data meaning, discover trends, or gain insights (解读/洞察/趋势), route to the Data Insight module.
  3. Specific data query (具体数据查询): When user wants to query specific metrics (TOP N, sum, comparison, etc.), route to the Q&A module (choose Dataset Q&A or File Q&A based on whether files are present).
  4. Dashboard URL (仪表板 URL): When user provides a dashboard link, route to Dashboard Skill Generation.
当用户意图可能匹配多个模块时,按以下优先级判断:
  1. 「报告」关键词优先:当用户意图包含“报告”“复盘”“总结报告”“分析报告”等关键词时,始终路由到数据报告模块,无论是否上传文件。数据报告模块优先级高于文件问数和数据洞察。
  2. 「解读」「洞察」「趋势」关键词:当用户想要理解数据含义、发现趋势或获取洞察时,路由到数据洞察模块。
  3. 具体数据查询:当用户想要查询具体指标(TOP N、求和、对比等)时,路由到问数模块(根据是否有文件选择数据集问数或文件问数)。
  4. 仪表板URL:当用户提供仪表板链接时,路由到仪表板技能生成模块。

Routing Examples

路由示例

User InputRouting ResultReasoning
"Help me find the product with the highest sales in this data" + uploaded file→ File Q&A (module-chat-file)Querying specific metric, has file
"帮我查一下这份数据中销售额最高的产品" + 上传文件→ File Q&A (module-chat-file)查具体指标,有文件
"Help me analyze this Excel data, TOP 10 headcount by department" + uploaded file→ File Q&A (module-chat-file)Querying specific metric (TOP N), has file
"帮我分析这份Excel数据,各部门人数分布TOP10" + 上传文件→ File Q&A (module-chat-file)查具体指标(TOP N),有文件
"Top 3 regions with the highest sales"→ Dataset Q&A (module-chat-dataset)Querying specific metric, no file
"销量最高的地区TOP3"→ Dataset Q&A (module-chat-dataset)查具体指标,无文件
"Parse these contracts and summarize the information" + folder→ Document Parsing (module-document-parser)
"解析这些合同并汇总信息" + 文件夹→ Document Parsing (module-document-parser)
"Convert this dashboard into a query skill" + URL→ Dashboard Skill Generation (module-dashboard)Provided dashboard URL
"把这个仪表板转化为查询技能" + URL→ Dashboard Skill Generation (module-dashboard)提供了仪表板 URL
"Help me interpret the trend in sales data" + uploaded file→ Data Insight (module-data-insight)Requests interpretation/insight, not a report
"帮我解读一下销售数据的趋势" + 上传文件→ Data Insight (module-data-insight)要求解读/洞察,非报告
"Any patterns and insights in this data" + uploaded file→ Data Insight (module-data-insight)Requests insight analysis
"这份数据有什么规律和洞察" + 上传文件→ Data Insight (module-data-insight)要求洞察分析
"Generate a sales data report for this month"→ Data Report (module-data-report)Contains "report" keyword
"生成一份本月销售数据报告"→ Data Report (module-data-report)含「报告」关键词
"Help me generate an analysis report based on this Excel" + uploaded file→ Data Report (module-data-report)Contains "report" keyword, file used as reference
"帮我基于这份Excel生成一份分析报告" + 上传文件→ Data Report (module-data-report)含「报告」关键词,文件作为参考资料
"Summarize these data, write a review report" + uploaded files→ Data Report (module-data-report)Contains "review report" keyword
"汇总这几份数据,写一份复盘报告" + 上传文件→ Data Report (module-data-report)含「复盘报告」关键词
"Combine these files to generate a data analysis report" + uploaded files→ Data Report (module-data-report)Contains "report" keyword
"结合这些文件生成数据分析报告" + 上传文件→ Data Report (module-data-report)含「报告」关键词
"Parse these 10 invoice PDFs, extract fields and generate Excel" + multiple files→ Document Parsing (module-document-parser)Contains "extract fields" related keywords
"解析这10个发票PDF,提取字段生成Excel" + 多文件→ Document Parsing (module-document-parser)含"提取字段"等相关关键字
"Help me find the product with the highest sales in this data" + multiple files or folder→ Document Parsing → File Q&A (module-chat-file)Querying specific metric, has multiple files
"帮我查一下这份数据中销售额最高的产品" + 多个文件或者文件夹→ Document Parsing → File Q&A (module-chat-file)查具体指标,有多个文件
"Any patterns and insights in these files" + multiple files or folder→ Document Parsing → Data Insight (module-data-insight)Requests insight analysis
"这些文件中的数据有什么规律和洞察" + 多个文件或者文件夹→ Document Parsing → Data Insight (module-data-insight)要求洞察分析
"Summarize these data, write a review report" + ≤5 files→ Data Report (module-data-report)Contains "review report" keyword
"汇总这几份数据,写一份复盘报告" + 5个以内文件→ Data Report (module-data-report)含「复盘报告」关键词
"Summarize these data, write a review report" + >5 files→ Document Parsing → Data Report (module-data-report)Contains "review report" keyword
"汇总这几份数据,写一份复盘报告" + >5个文件→ Document Parsing → Data Report (module-data-report)含「复盘报告」关键词
用户输入路由结果推理依据
"帮我找出这份数据中销售额最高的产品" + 上传文件→ File Q&A (module-chat-file)查询具体指标,有文件
"帮我查一下这份数据中销售额最高的产品" + 上传文件→ File Q&A (module-chat-file)查具体指标,有文件
"帮我分析这份Excel数据,各部门人数分布TOP10" + 上传文件→ File Q&A (module-chat-file)查询具体指标(TOP N),有文件
"帮我分析这份Excel数据,各部门人数分布TOP10" + 上传文件→ File Q&A (module-chat-file)查具体指标(TOP N),有文件
"销量最高的地区TOP3"→ Dataset Q&A (module-chat-dataset)查询具体指标,无文件
"销量最高的地区TOP3"→ Dataset Q&A (module-chat-dataset)查具体指标,无文件
"解析这些合同并汇总信息" + 文件夹→ Document Parsing (module-document-parser)
"解析这些合同并汇总信息" + 文件夹→ Document Parsing (module-document-parser)
"把这个仪表板转化为查询技能" + URL→ Dashboard Skill Generation (module-dashboard)提供了仪表板URL
"把这个仪表板转化为查询技能" + URL→ Dashboard Skill Generation (module-dashboard)提供了仪表板 URL
"帮我解读一下销售数据的趋势" + 上传文件→ Data Insight (module-data-insight)要求解读/洞察,非报告
"帮我解读一下销售数据的趋势" + 上传文件→ Data Insight (module-data-insight)要求解读/洞察,非报告
"这份数据有什么规律和洞察" + 上传文件→ Data Insight (module-data-insight)要求洞察分析
"这份数据有什么规律和洞察" + 上传文件→ Data Insight (module-data-insight)要求洞察分析
"生成一份本月销售数据报告"→ Data Report (module-data-report)含「报告」关键词
"生成一份本月销售数据报告"→ Data Report (module-data-report)含「报告」关键词
"帮我基于这份Excel生成一份分析报告" + 上传文件→ Data Report (module-data-report)含「报告」关键词,文件作为参考资料
"帮我基于这份Excel生成一份分析报告" + 上传文件→ Data Report (module-data-report)含「报告」关键词,文件作为参考资料
"汇总这几份数据,写一份复盘报告" + 上传文件→ Data Report (module-data-report)含「复盘报告」关键词
"汇总这几份数据,写一份复盘报告" + 上传文件→ Data Report (module-data-report)含「复盘报告」关键词
"结合这些文件生成数据分析报告" + 上传文件→ Data Report (module-data-report)含「报告」关键词
"结合这些文件生成数据分析报告" + 上传文件→ Data Report (module-data-report)含「报告」关键词
"解析这10个发票PDF,提取字段生成Excel" + 多文件→ Document Parsing (module-document-parser)含"提取字段"等相关关键字
"解析这10个发票PDF,提取字段生成Excel" + 多文件→ Document Parsing (module-document-parser)含"提取字段"等相关关键字
"帮我查一下这份数据中销售额最高的产品" + 多个文件或者文件夹→ Document Parsing → File Q&A (module-chat-file)查具体指标,有多个文件
"帮我查一下这份数据中销售额最高的产品" + 多个文件或者文件夹→ Document Parsing → File Q&A (module-chat-file)查具体指标,有多个文件
"这些文件中的数据有什么规律和洞察" + 多个文件或者文件夹→ Document Parsing → Data Insight (module-data-insight)要求洞察分析
"这些文件中的数据有什么规律和洞察" + 多个文件或者文件夹→ Document Parsing → Data Insight (module-data-insight)要求洞察分析
"汇总这几份数据,写一份复盘报告" + 5个以内文件→ Data Report (module-data-report)含「复盘报告」关键词
"汇总这几份数据,写一份复盘报告" + 5个以内文件→ Data Report (module-data-report)含「复盘报告」关键词
"汇总这几份数据,写一份复盘报告" + >5个文件→ Document Parsing → Data Report (module-data-report)含「复盘报告」关键词
"汇总这几份数据,写一份复盘报告" + >5个文件→ Document Parsing → Data Report (module-data-report)含「复盘报告」关键词

Fallback Rules

降级规则

  • When intent is unclear, default to Dataset Q&A (module-chat-dataset) (当意图不明确时,默认路由到数据集问数)
  • If the user involves multiple modules at the same time (e.g. "analyze data and generate a report" ("分析数据并生成报告")), execute them in sequence
  • Special scenario — multi-file preprocessing before Q&A (特殊场景 — 多文件问数前置处理):
    • When user uploads ≥5 unstructured documents (PDF/Word/images, etc.) and requests analysis
    • MUST execute Document Parsing first (generate structured Excel)
    • Then route to the corresponding functional module based on question intent (perform intelligent analysis on the generated Excel)
    • Example: "Analyze these invoice data" + 10 PDFs → Document Parsing (generate Excel) → File Q&A (analyze Excel)
    • 示例:"分析这些发票数据" + 10个PDF → 文档解析(生成Excel) → 文件问数(分析Excel)
  • If routing is incorrect, allow the user to manually specify the module (路由错误时允许用户手动指定模块)
  • 当意图不明确时,默认路由到数据集问数(module-chat-dataset)
  • 如果用户同时涉及多个模块(如“分析数据并生成报告”),按顺序执行
  • 特殊场景 — 多文件问数前置处理
    • 当用户上传≥5个非结构化文档(PDF/Word/图片等)并请求分析时
    • 必须先执行文档解析(生成结构化Excel)
    • 然后根据问题意图路由到对应功能模块(对生成的Excel进行智能分析)
    • 示例:"分析这些发票数据" + 10个PDF → 文档解析(生成Excel) → 文件问数(分析Excel)
  • 路由错误时允许用户手动指定模块

Configuration

配置

This skill uses a layered configuration architecture, separating user configuration from the skill package. Skill package updates will NOT overwrite user configuration.
<workspace-dir>
convention
: In this document,
<workspace-dir>
refers to the absolute path of the folder the user currently has open in the IDE / file manager. The Agent MUST confirm this path before the first operation by running a Python script with
os.getenv('CODE_AGENT_CURRENT_SESSION_WORK_DIR')
. If the script returns nothing or empty, use the absolute path of the folder selected by the user. MUST NOT infer using
$PWD
,
$CWD
, or
Path.cwd()
or similar runtime variables.
<skill-package-dir>
convention
: In this document,
<skill-package-dir>
refers to the root directory of this skill after installation (i.e. the directory containing this
SKILL.md
file). The Agent can infer it from the path of this file.
本技能采用分层配置架构,将用户配置与技能包分离。技能包更新不会覆盖用户配置
<workspace-dir>
约定
:本文档中,
<workspace-dir>
指用户当前在IDE/文件管理器中打开的文件夹的绝对路径。Agent必须在首次操作前通过运行Python脚本
os.getenv('CODE_AGENT_CURRENT_SESSION_WORK_DIR')
确认该路径。如果脚本返回空值,则使用用户选择的文件夹的绝对路径。禁止使用
$PWD
$CWD
Path.cwd()
等运行时变量进行推断。
<skill-package-dir>
约定
:本文档中,
<skill-package-dir>
指本技能安装后的根目录(即包含此
SKILL.md
文件的目录)。Agent可从此文件的路径推断得出。

Configuration Loading Priority (higher overrides lower)

配置加载优先级(优先级高的覆盖低的)

  1. Environment variable
    ACCESS_TOKEN
    (highest priority, suitable for container deployment)
  2. Workspace-level configuration
    <workspace-dir>/.qbi/smartq-chat/config.yaml
  3. QBI global configuration
    ~/.qbi/config.yaml
    (shared by all skills)
  4. Default configuration
    default_config.yaml
    inside the skill package (package defaults, updated with the package)
server_domain
,
api_key
,
api_secret
, and
user_token
can be placed in the workspace-level configuration or the global configuration. When both exist, the workspace-level configuration takes priority.
  1. 环境变量
    ACCESS_TOKEN
    (优先级最高,适用于容器部署)
  2. 工作区级配置
    <workspace-dir>/.qbi/smartq-chat/config.yaml
  3. QBI全局配置
    ~/.qbi/config.yaml
    (所有技能共享)
  4. 默认配置 技能包内的
    default_config.yaml
    (包默认配置,随包更新)
server_domain
api_key
api_secret
user_token
可放置在工作区级配置或全局配置中。当两者都存在时,工作区级配置优先。

Configuration Item Descriptions

配置项说明

  • server_domain
    : Quick BI service domain
  • api_key
    /
    api_secret
    : OpenAPI authentication key pair (if not configured, built-in defaults are used for trial mode)
  • user_token
    : Quick BI platform user ID; the Q&A interface requires
    userId
    (if not configured, it is registered automatically and written back)
If
use_env_property: true
is enabled, the configuration can be overridden through the
qbi_api_key
,
qbi_api_secret
,
qbi_server_domain
, and
qbi_user_token
fields in the
ACCESS_TOKEN
environment variable JSON.
  • server_domain
    :Quick BI服务域名
  • api_key
    /
    api_secret
    :OpenAPI认证密钥对(如果未配置,试用模式下使用内置默认值)
  • user_token
    :Quick BI平台用户ID;问答接口需要
    userId
    (如果未配置,将自动注册并写回)
如果启用
use_env_property: true
,可通过
ACCESS_TOKEN
环境变量JSON中的
qbi_api_key
qbi_api_secret
qbi_server_domain
qbi_user_token
字段覆盖配置。

Automatic Trial Credential Registration

自动试用凭证注册

When neither
api_key
nor
api_secret
is configured (regardless of whether
user_token
exists), the script will:
  1. If
    user_token
    is also not configured, print a friendly message informing the user that trial credentials will be registered automatically and trial mode will begin
  2. Use built-in default credentials to populate
    api_key
    and
    api_secret
  3. Automatically register a user based on the device's unique identifier and write the userId to the global configuration
    ~/.qbi/config.yaml
    (not affected by skill package updates)
Note:
user_token
existing alone in the global configuration (from automatic trial registration) will NOT prevent trial credential population. ONLY when
api_key
or
api_secret
exists in an external configuration will the trial flow be skipped.
Trial expiration is controlled by the server-side interface through error code
AE0579100004
— no local tracking is required.
api_key
api_secret
均未配置时(无论
user_token
是否存在),脚本将:
  1. 如果
    user_token
    也未配置,打印友好提示告知用户将自动注册试用凭证并进入试用模式
  2. 使用内置默认凭证填充
    api_key
    api_secret
  3. 根据设备唯一标识符自动注册用户,并将userId写入全局配置
    ~/.qbi/config.yaml
    (不受技能包更新影响)
注意:全局配置中单独存在
user_token
(来自自动试用注册)不会阻止试用凭证填充。只有当外部配置中存在
api_key
api_secret
时,才会跳过试用流程。
试用过期由服务器端接口通过错误码
AE0579100004
控制——无需本地跟踪。

Custom Configuration Guidance

自定义配置指引

When users want to use their own Quick BI account credentials (rather than trial credentials), sign in to the Quick BI console, click the avatar option "Copy skill configuration with one click", as shown below:
Show the configuration screenshot to the user based on current locale:
  • zh_CN: Copy Skill Config
  • en_US: Copy Skill Config
After copying, paste the configuration to the Agent. The Agent will automatically write
server_domain
,
api_key
,
api_secret
, and
user_token
into the workspace-level configuration
<workspace-dir>/.qbi/smartq-chat/config.yaml
(and decide whether to sync to the global configuration based on the
save_global_property
switch).
当用户想要使用自己的Quick BI账户凭证(而非试用凭证)时,登录Quick BI控制台,点击头像选项**「一键复制技能配置」**,如下所示:
根据当前语言环境向用户展示配置截图:
  • zh_CN: 复制技能配置
  • en_US: 复制技能配置
复制后,将配置粘贴给Agent。Agent会自动将
server_domain
api_key
api_secret
user_token
写入工作区级配置
<workspace-dir>/.qbi/smartq-chat/config.yaml
(并根据
save_global_property
开关决定是否同步到全局配置)。

Agent Configuration Update Rules (Required Reading)

Agent配置更新规则(必读)

Zero-configuration initialization for new users: If the user says "initialize configuration", "I am a new user", or similar, but has NOT provided any specific configuration values, there is no need to manually write anything to any configuration file. Tell the user to run Q&A directly — the system will automatically complete trial registration (see the Automatic Trial Credential Registration section above).
ONLY apply the following write rules when the user explicitly provides specific configuration values.
Existing configuration protection rule: Before writing, the Agent MUST first check whether the workspace-level configuration file
<workspace-dir>/.qbi/smartq-chat/config.yaml
already exists and contains valid configuration. If the file already exists and is non-empty, the Agent MUST NOT modify or overwrite any configuration items on its own, unless the user explicitly expresses intent to update (e.g. "update my configuration", "replace with this configuration", "change api_key to xxx", etc.). When existing configuration is found, inform the user that configuration already exists and ask whether to confirm overwriting.
When the user provides any one or more of
api_key
,
api_secret
,
user_token
, or
server_domain
, and the above protection rule is satisfied, the Agent MUST use a file editing tool to directly modify the corresponding user configuration file and write the provided values into the matching fields.
Write location rules:
  • server_domain
    ,
    api_key
    ,
    api_secret
    ,
    user_token
    ALWAYS write to the workspace-level configuration
    <workspace-dir>/.qbi/smartq-chat/config.yaml
  • Global configuration read/write is controlled by the
    save_global_property
    switch (default
    true
    ):
    • If the switch is
      false
      MUST NOT read or write global configuration under any circumstance, skip the global-configuration-related steps below
    • If the switch is
      true
      and the global configuration
      ~/.qbi/config.yaml
      is empty or does not exist → also write to the global configuration
    • If the switch is
      true
      and the global configuration already contains content → write ONLY to the workspace-level configuration, then ask the user "Global configuration already exists. Do you want to sync the update?" and decide whether to write based on the user's reply
Procedure:
  1. Extract configuration key-value pairs from the user message (support common formats such as
    key: value
    ,
    key:value
    , and
    key=value
    )
  2. Use a file editing tool (such as search_replace) to write the configuration into the workspace-level configuration file
  3. Read the
    save_global_property
    value in the configuration; if it is
    false
    , skip to step 5
  4. Check whether the global configuration
    ~/.qbi/config.yaml
    exists and is non-empty:
    • If it is empty or does not exist → also write to the global configuration
    • If it already contains content → ask the user "Global configuration already exists. Do you want to sync the update?" and decide whether to write based on the user's reply
  5. After the update, confirm to the user which configuration items were written and where they were written
Prohibited actions:
  • ❌ MUST NOT refuse to modify configuration citing reasons such as "limited permissions" or "unable to modify files inside the skill package"
  • ❌ MUST NOT suggest workarounds such as using environment variables or manually copying files
  • ❌ MUST NOT only output the configuration content and ask the user to modify it themselves
新用户零配置初始化:如果用户说“初始化配置”“我是新用户”或类似表述,但未提供任何具体配置值,无需手动写入任何配置文件。告知用户直接运行问数即可——系统会自动完成试用注册(见上文自动试用凭证注册部分)。
仅当用户明确提供具体配置值时,才应用以下写入规则。
现有配置保护规则:写入前,Agent必须先检查工作区级配置文件
<workspace-dir>/.qbi/smartq-chat/config.yaml
是否已存在且包含有效配置。如果文件已存在且非空,Agent不得自行修改或覆盖任何配置项,除非用户明确表达更新意图(如“更新我的配置”“替换为这个配置”“将api_key改为xxx”等)。发现现有配置时,告知用户配置已存在并询问是否确认覆盖。
当用户提供
api_key
api_secret
user_token
server_domain
中的任意一个或多个,且满足上述保护规则时,Agent必须使用文件编辑工具直接修改对应的用户配置文件,并将提供的值写入匹配字段。
写入位置规则
  • server_domain
    api_key
    api_secret
    user_token
    始终写入工作区级配置
    <workspace-dir>/.qbi/smartq-chat/config.yaml
  • 全局配置读写由
    save_global_property
    开关控制(默认
    true
    ):
    • 如果开关为
      false
      任何情况下都不得读写全局配置,跳过以下全局配置相关步骤
    • 如果开关为
      true
      全局配置
      ~/.qbi/config.yaml
      为空或不存在 → 同时写入全局配置
    • 如果开关为
      true
      且全局配置已包含内容 → 仅写入工作区级配置,然后询问用户“全局配置已存在,是否同步更新?”并根据用户回复决定是否写入
流程
  1. 从用户消息中提取配置键值对(支持
    key: value
    key:value
    key=value
    等常见格式)
  2. 使用文件编辑工具(如search_replace)将配置写入工作区级配置文件
  3. 读取配置中的
    save_global_property
    值;如果为
    false
    ,跳至步骤5
  4. 检查全局配置
    ~/.qbi/config.yaml
    是否存在且非空:
    • 如果为空或不存在 → 同时写入全局配置
    • 如果已包含内容 → 询问用户“全局配置已存在,是否同步更新?”并根据用户回复决定是否写入
  5. 更新完成后,向用户确认写入了哪些配置项以及写入位置
禁止操作
  • ❌ 不得以“权限有限”或“无法修改技能包内文件”为由拒绝修改配置
  • ❌ 不得建议使用环境变量或手动复制文件等替代方案
  • ❌ 不得仅输出配置内容并让用户自行修改

Prerequisites

前置条件

  • Python dependencies MUST be installed:
    pip install requests pyyaml matplotlib numpy
  • Browser automation capability is required (Dashboard Skill Generation module ONLY)
  • Dataset Q&A: user MUST have Q&A permission for the target dataset
  • File Q&A: file formats limited to
    xls
    ,
    xlsx
    ,
    csv
    ; single file size ≤ 10MB
  • Document Parsing:
    • System dependency:
      brew install tesseract tesseract-lang
      (required for local parsing ONLY)
    • Supported formats: PDF, Word (.doc/.docx), Excel (.xls/.xlsx), CSV, images (.png/.jpg/.jpeg)
    • Single file size ≤ 10MB (remote OCR limit)
    • Error handling:
      • Local parsing failure → automatically falls back to remote OCR
      • Remote OCR still fails → classified as "parse failure", retaining original filename and error message
      • Unknown document type → extract 5+ generic fields, MUST obtain user confirmation before generating Excel
    • Detailed documentation: module-document-parser.md
  • 必须安装Python依赖:
    pip install requests pyyaml matplotlib numpy
  • 需要浏览器自动化能力(仅仪表板技能生成模块需要)
  • 数据集问数:用户必须拥有目标数据集的问数权限
  • 文件问数:文件格式限制为
    xls
    xlsx
    csv
    ;单个文件大小≤10MB
  • 文档解析
    • 系统依赖:
      brew install tesseract tesseract-lang
      (仅本地解析需要)
    • 支持格式:PDF、Word(.doc/.docx)、Excel(.xls/.xlsx)、CSV、图片(.png/.jpg/.jpeg)
    • 单个文件大小≤10MB(远程OCR限制)
    • 错误处理
      • 本地解析失败 → 自动降级到远程OCR
      • 远程OCR仍失败 → 归类为“解析失败”,保留原文件名和错误信息
      • 未知文档类型 → 提取5个以上通用字段,生成Excel前必须获得用户确认
    • 详细文档:module-document-parser.md

Script Calling Convention (Required Reading)

脚本调用约定(必读)

When calling any Python script:
  1. The script path MUST use the absolute path of the installed skill package directory (i.e.
    <skill-package-dir>/scripts/...
    ); MUST NOT use relative paths
  2. MUST pass the absolute path of
    <workspace-dir>
    via the
    --workspace-dir
    parameter (see the conventions in the Configuration section above for how to obtain it)
  3. Wrap path parameter values in quotes (to prevent shell tokenization issues caused by Chinese characters, spaces, or other special characters)
  4. smartq_stream_query.py
    ,
    file_stream_query.py
    ,
    q_insights.py
    ,
    create_chat.py
    ,
    generate_report.py
    MUST include the
    --locale
    parameter — see User Locale Determination Rules below
Invocation examples:
bash
undefined
调用任何Python脚本时:
  1. 脚本路径必须使用已安装技能包目录的绝对路径(即
    <skill-package-dir>/scripts/...
    );禁止使用相对路径
  2. 必须通过
    --workspace-dir
    参数传递
    <workspace-dir>
    的绝对路径(获取方式见上文配置部分的约定)
  3. 路径参数值需用引号包裹(防止中文、空格或其他特殊字符导致的shell分词问题)
  4. smartq_stream_query.py
    file_stream_query.py
    q_insights.py
    create_chat.py
    generate_report.py
    必须包含
    --locale
    参数——见下文用户语言环境判断规则
调用示例
bash
undefined

File upload

文件上传

python '<skill-package-dir>/scripts/chat/upload_file.py' '/path/to/data.xlsx' --workspace-dir '<workspace-dir>'
python '<skill-package-dir>/scripts/chat/upload_file.py' '/path/to/data.xlsx' --workspace-dir '<workspace-dir>'

File Q&A

文件问数

python '<skill-package-dir>/scripts/chat/file_stream_query.py' <fileId> "各部门人数分布" --locale zh_CN --workspace-dir '<workspace-dir>'
python '<skill-package-dir>/scripts/chat/file_stream_query.py' <fileId> "各部门人数分布" --locale zh_CN --workspace-dir '<workspace-dir>'

Dataset Q&A

数据集问数

python '<skill-package-dir>/scripts/chat/smartq_stream_query.py' "TOP 3 regions by sales" --locale zh_CN --workspace-dir '<workspace-dir>'
python '<skill-package-dir>/scripts/chat/smartq_stream_query.py' "TOP 3 regions by sales" --locale zh_CN --workspace-dir '<workspace-dir>'

Dataset Q&A (with dataset name hint — enables name lookup, exact match skips intelligent table selection)

数据集问数(带数据集名称提示——启用名称查找,精确匹配跳过智能选表)

python '<skill-package-dir>/scripts/chat/smartq_stream_query.py' "Based on 'Order Sales Details', what is the sales share by platform in Q1?" --cube-name 'Order Sales Details' --locale zh_CN --workspace-dir '<workspace-dir>'
python '<skill-package-dir>/scripts/chat/smartq_stream_query.py' "Based on 'Order Sales Details', what is the sales share by platform in Q1?" --cube-name 'Order Sales Details' --locale zh_CN --workspace-dir '<workspace-dir>'

Document Parsing - local

文档解析 - 本地

python '<skill-package-dir>/scripts/document/document_local_parse.py' '/path/to/folder/' --json --workspace-dir '<workspace-dir>'
python '<skill-package-dir>/scripts/document/document_local_parse.py' '/path/to/folder/' --json --workspace-dir '<workspace-dir>'

Document Parsing - remote OCR

文档解析 - 远程OCR

python '<skill-package-dir>/scripts/document/document_remote_ocr.py' '/path/to/folder/' --workspace-dir '<workspace-dir>'
python '<skill-package-dir>/scripts/document/document_remote_ocr.py' '/path/to/folder/' --workspace-dir '<workspace-dir>'

Excel generation

Excel生成

python '<skill-package-dir>/scripts/document/generate_excel.py' '<json-path>' --workspace-dir '<workspace-dir>'
python '<skill-package-dir>/scripts/document/generate_excel.py' '<json-path>' --workspace-dir '<workspace-dir>'

Data Insight

数据洞察

python '<skill-package-dir>/scripts/insight/q_insights.py' "这个报表有什么异常?" --excel-file '/path/to/data.xlsx' --locale zh_CN --workspace-dir '<workspace-dir>'
python '<skill-package-dir>/scripts/insight/q_insights.py' "这个报表有什么异常?" --excel-file '/path/to/data.xlsx' --locale zh_CN --workspace-dir '<workspace-dir>'

Report generation

报告生成

python '<skill-package-dir>/scripts/report/generate_report.py' "本月销售分析" --locale zh_CN --workspace-dir '<workspace-dir>'
undefined
python '<skill-package-dir>/scripts/report/generate_report.py' "本月销售分析" --locale zh_CN --workspace-dir '<workspace-dir>'
undefined

User Locale Determination Rules

用户语言环境判断规则

Core principle:
--locale
MUST be determined SOLELY based on the user's input text, NOT influenced by any other source.
Valid values:
zh_CN
or
en_US
only.
Determination method:
  • Examine the user's original input message (the question or instruction the user typed)
  • Identify the question/instruction language — the language of the sentence structure, verbs, and functional words (not embedded proper nouns)
  • Chinese question language →
    zh_CN
    ; English or other question language →
    en_US
Mixed-language handling (critical):
  • When user input contains both Chinese and English, determine locale by the question framing language, NOT by embedded entity names (dataset names, field names, table names, etc.)
  • Entity names (dataset names, field names, etc.) embedded in the question are proper nouns / references — they do NOT indicate the user's language preference
  • Rule of thumb: strip out quoted names or recognizable entity references, then judge the language of the remaining sentence structure
What counts as "user input text":
  • ✅ The text the user typed in the current conversation turn
  • ✅ The user's original question when performing follow-up queries in the same session
What MUST NOT influence locale determination:
  • ❌ The Agent's own reply language (Agent may reply in a language different from the user's input)
  • ❌ API response content or error messages (these are always in a fixed language regardless of the user's language)
  • ❌ Script console output text
  • ❌ Dataset names, field names, or other metadata — whether returned by the platform OR embedded in the user's question as references
  • ❌ System prompt language or Agent configuration language
Example:
  • User input: "帮我分析销售数据" →
    --locale zh_CN
    (question language is Chinese)
  • User input: "Analyze sales data" →
    --locale en_US
    (question language is English)
  • User input: "Analyze the 销售数据集" →
    --locale en_US
    (question language is English; "销售数据集" is a dataset name reference, not the question language)
  • User input: "Show me data from 2024年度报表" →
    --locale en_US
    (question language is English; "2024年度报表" is a dataset name)
  • User input: "帮我查一下 Sales Dataset 的数据" →
    --locale zh_CN
    (question language is Chinese; "Sales Dataset" is a dataset name)
  • User input: "帮我分析销售数据", but API returns English error message →
    --locale zh_CN
    (locale is determined by user input, NOT by API response)
  • Previous Agent reply was in English, user then types "查询TOP3" →
    --locale zh_CN
    (locale is determined by user input, NOT by Agent's previous reply)
Prohibited actions:
  • ❌ MUST NOT omit the
    --workspace-dir
    parameter when calling scripts
  • ❌ MUST NOT use relative paths to call scripts (e.g.
    python3 scripts/chat/...
    )
  • ❌ MUST NOT use hard-coded paths or guessed paths
  • ❌ MUST NOT omit the
    --locale
    parameter when calling scripts that require it
  • ❌ MUST NOT determine
    --locale
    based on Agent's own output language or API/script return content
核心原则
--locale
必须仅根据用户输入文本确定,不受任何其他来源影响。
有效值:仅
zh_CN
en_US
判断方法
  • 检查用户的原始输入消息(用户输入的问题或指令)
  • 识别问题/指令语言——句子结构、动词和功能词的语言(而非嵌入的专有名词)
  • 中文问题语言 →
    zh_CN
    ;英文或其他问题语言 →
    en_US
混合语言处理(关键):
  • 当用户输入同时包含中文和英文时,根据问题框架语言确定语言环境,而非嵌入的实体名称(数据集名称、字段名称、表名等)
  • 问题中嵌入的实体名称(数据集名称、字段名称等)是专有名词/引用——不代表用户的语言偏好
  • 经验法则:剥离带引号的名称或可识别的实体引用,然后判断剩余句子结构的语言
哪些属于“用户输入文本”
  • ✅ 用户在当前对话轮次中输入的文本
  • ✅ 同一会话中进行后续查询时用户的原始问题
哪些不得影响语言环境判断
  • ❌ Agent自身的回复语言(Agent可能使用与用户输入不同的语言回复)
  • ❌ API响应内容或错误消息(这些语言固定,与用户语言无关)
  • ❌ 脚本控制台输出文本
  • ❌ 数据集名称、字段名称或其他元数据——无论是平台返回的还是用户问题中作为引用嵌入的
  • ❌ 系统提示语言或Agent配置语言
示例
  • 用户输入:"帮我分析销售数据" →
    --locale zh_CN
    (问题语言为中文)
  • 用户输入:"Analyze sales data" →
    --locale en_US
    (问题语言为英文)
  • 用户输入:"Analyze the 销售数据集" →
    --locale en_US
    (问题语言为英文;"销售数据集"是数据集名称引用,而非问题语言)
  • 用户输入:"Show me data from 2024年度报表" →
    --locale en_US
    (问题语言为英文;"2024年度报表"是数据集名称)
  • 用户输入:"帮我查一下 Sales Dataset 的数据" →
    --locale zh_CN
    (问题语言为中文;"Sales Dataset"是数据集名称)
  • 用户输入:"帮我分析销售数据",但API返回英文错误消息 →
    --locale zh_CN
    (语言环境由用户输入决定,而非API响应)
  • 之前Agent回复为英文,用户随后输入"查询TOP3" →
    --locale zh_CN
    (语言环境由用户输入决定,而非Agent之前的回复)
禁止操作
  • ❌ 调用脚本时不得省略
    --workspace-dir
    参数
  • ❌ 不得使用相对路径调用脚本(如
    python3 scripts/chat/...
  • ❌ 不得使用硬编码路径或猜测路径
  • ❌ 调用需要
    --locale
    参数的脚本时不得省略该参数
  • ❌ 不得根据Agent自身输出语言或API/脚本返回内容确定
    --locale