diff --git a/jeecg-boot/jeecg-module-system/jeecg-system-start/src/main/resources/flyway/sql/mysql/V3.9.1_0__all_upgrade.sql b/jeecg-boot/jeecg-module-system/jeecg-system-start/src/main/resources/flyway/sql/mysql/V3.9.1_0__all_upgrade.sql index 6b50c5e41..7d50ce55b 100644 --- a/jeecg-boot/jeecg-module-system/jeecg-system-start/src/main/resources/flyway/sql/mysql/V3.9.1_0__all_upgrade.sql +++ b/jeecg-boot/jeecg-module-system/jeecg-system-start/src/main/resources/flyway/sql/mysql/V3.9.1_0__all_upgrade.sql @@ -304,3 +304,6 @@ INSERT INTO `airag_app` (`id`, `create_by`, `create_time`, `update_by`, `update_ -- AI流程: 生成图表 UPDATE `airag_flow` SET `create_by` = 'admin', `create_time` = '2026-01-06 11:25:05', `update_by` = 'admin', `update_time` = '2026-01-19 19:13:49', `sys_org_code` = 'A01', `tenant_id` = NULL, `application_name` = 'jeecg', `name` = 'Chat2BI生成图表', `descr` = '', `icon` = '', `chain` = 'THEN(\n start.tag(\'start-node\'),\n SWITCH(switch.tag(\'271554566412288000\')).to(\n SWITCH(classifier.tag(\'271481764802605056\')).to(\n end.tag(\'271480115023458304\'),\n THEN(\n varMerge.tag(\'271556843709317120\'),\n tools.tag(\'276308429448634368\'),\n tools.tag(\'274495573258244096\'),\n llm.tag(\'271548210211192832\'),\n reply.tag(\'271548872986722304\'),\n end.tag(\'271483924713975808\')\n ).tag(\"271556843709317120\"),\n end.tag(\'271480115023458304\'),\n THEN(\n varMerge.tag(\'271556843709317120\'),\n tools.tag(\'276308429448634368\'),\n tools.tag(\'274495573258244096\'),\n llm.tag(\'271548210211192832\'),\n reply.tag(\'271548872986722304\'),\n end.tag(\'271483924713975808\')\n ).tag(\"271556843709317120\")\n ).tag(\'271481764802605056\'),\n SWITCH(classifier.tag(\'271554622242668544\')).to(\n SWITCH(classifier.tag(\'271481764802605056\')).to(\n end.tag(\'271480115023458304\'),\n THEN(\n varMerge.tag(\'271556843709317120\'),\n tools.tag(\'276308429448634368\'),\n tools.tag(\'274495573258244096\'),\n llm.tag(\'271548210211192832\'),\n reply.tag(\'271548872986722304\'),\n end.tag(\'271483924713975808\')\n ).tag(\"271556843709317120\"),\n end.tag(\'271480115023458304\'),\n THEN(\n varMerge.tag(\'271556843709317120\'),\n tools.tag(\'276308429448634368\'),\n tools.tag(\'274495573258244096\'),\n llm.tag(\'271548210211192832\'),\n reply.tag(\'271548872986722304\'),\n end.tag(\'271483924713975808\')\n ).tag(\"271556843709317120\")\n ).tag(\'271481764802605056\'),\n THEN(\n varMerge.tag(\'271556843709317120\'),\n tools.tag(\'276308429448634368\'),\n tools.tag(\'274495573258244096\'),\n llm.tag(\'271548210211192832\'),\n reply.tag(\'271548872986722304\'),\n end.tag(\'271483924713975808\')\n ).tag(\"271556843709317120\")\n ).tag(\'271554622242668544\')\n ).tag(\'271554566412288000\')\n).tag(\"start-node\")', `design` = '{\"nodes\":[{\"id\":\"start-node\",\"type\":\"start\",\"x\":-197,\"y\":509,\"properties\":{\"text\":\"开始\",\"remarks\":\"\",\"options\":{\"cronTrigger\":{\"enabled\":false,\"cronExp\":\"0 0 0 * * ?\",\"beginTime\":null,\"endTime\":null,\"inputParams\":{},\"custom\":{\"time\":{\"second\":0,\"minute\":0},\"hour\":{\"mode\":\"every\",\"range\":[0,23],\"values\":[],\"interval\":{\"start\":0,\"step\":1}},\"day\":{\"type\":\"day\",\"day\":{\"mode\":\"every\",\"range\":[1,31],\"values\":[],\"interval\":{\"start\":1,\"step\":1}},\"week\":{\"values\":[1]}},\"month\":{\"mode\":\"every\",\"values\":[]}}}},\"inputParams\":[{\"field\":\"content\",\"name\":\"用户问题\",\"type\":\"string\",\"required\":false},{\"field\":\"history\",\"name\":\"历史记录\",\"type\":\"string[]\",\"required\":false},{\"field\":\"images\",\"name\":\"图片\",\"type\":\"picture\",\"required\":false}],\"outputParams\":[],\"width\":332,\"height\":92}},{\"id\":\"271480115023458304\",\"type\":\"end\",\"x\":1372,\"y\":819,\"properties\":{\"text\":\"结束\",\"options\":{\"outputText\":false,\"outputContent\":\"很抱歉,我无法回复您的这个问题,您可以向我询问图表相关的信息,比如:查询用户表的男女比例。\",\"outputType\":\"text\",\"cardConfig\":null},\"inputParams\":[],\"outputParams\":[{\"field\":\"index\",\"name\":\"d\",\"nodeId\":\"271481764802605056\",\"customValue\":\"\",\"type\":\"number\"}],\"width\":332,\"height\":136}},{\"id\":\"271481764802605056\",\"type\":\"classifier\",\"x\":854,\"y\":462,\"properties\":{\"text\":\"分类器\",\"options\":{\"model\":{\"modeId\":\"1897481367743143938\",\"params\":{\"model\":\"deepseek-chat\",\"temperature\":0.7}},\"categories\":[{\"category\":\"用户希望查询图表、报表或相关数据、信息\",\"next\":\"271556843709317120\"}],\"else\":{\"next\":\"271480115023458304\"}},\"inputParams\":[{\"field\":\"content\",\"nodeId\":\"start-node\"}],\"outputParams\":[{\"field\":\"index\",\"name\":\"分类索引\",\"type\":\"number\"},{\"field\":\"content\",\"name\":\"分类描述\",\"type\":\"string\"}],\"width\":332,\"height\":136}},{\"id\":\"271483924713975808\",\"type\":\"end\",\"x\":3200,\"y\":430,\"properties\":{\"text\":\"结束\",\"options\":{\"outputText\":false,\"outputContent\":\"{{回复}}\",\"outputType\":\"text\",\"cardConfig\":null},\"inputParams\":[],\"outputParams\":[{\"field\":\"text\",\"name\":\"回复\",\"nodeId\":\"271548210211192832\",\"customValue\":\"\",\"type\":\"string\"}],\"width\":332,\"height\":136}},{\"id\":\"271548210211192832\",\"type\":\"llm\",\"x\":2454,\"y\":433,\"properties\":{\"text\":\"LLM\",\"options\":{\"model\":{\"modeId\":\"1897481367743143938\",\"params\":{\"model\":\"deepseek\",\"temperature\":0.7,\"timeout\":60}},\"history\":30,\"messages\":[{\"role\":\"system\",\"content\":\"# 角色\\n你是一位智能数据分析与可视化助手,专注于理解用户对图表的需求,并通过查询数据库和生成结构化数据来创建图表。\\n## 能力\\n1. **需求理解与解析**:精准理解用户对图表类型(如柱状图、折线图、饼图)和数据维度的需求。\\n2. **数据库交互**:熟知可操作的数据库表,并能根据需求查询表结构、构建并执行SQL查询。\\n3. **数据处理**:将SQL查询返回的原始数据,准确地转换并封装为符合指定格式的图表数据结构。\\n4. **输出生成**:严格生成包含完整、可解析JSON字符串的``标签。\\n## 工作流程\\n1. **需求确认与澄清**:\\n* 分析用户请求,明确用户想要的可视化图表类型(`type`)和需要展示的数据维度(如`x`轴和`y`轴分别代表什么)。\\n* 用户可能要求你通过指定的数据源查询数据(具体的数据源列表从下表得知),若没有指定则不需要传数据源参数。\\n* 如果需要,向用户提问以澄清模糊的需求(例如,确认时间范围、分组条件或指标定义)。\\n2. **数据获取**:\\n* 判断用户需求涉及的表是否在已知范围内。\\n* 如果涉及,则调用工具查询相关表结构,了解可用字段。\\n* 根据澄清后的需求,构建准确、高效的SQL查询语句(禁止使用SQL注释、禁止构建非SELECT语句)。\\n* 构建查询SQL时,需要明确数据源的数据库类型,根据不同的数据库构建不同的SQL方言。\\n* 调用工具执行SQL,获取原始数据集。\\n* 若是用户已经提供了数据,则只需要使用用户提供的数据既可,不需要从数据库中查询。\\n3. **支持的图表类型**:\\n* `bar`: 柱状图\\n* `line`: 折线图、曲线图\\n* `pie`: 饼图\\n* `radar`: 雷达图\\n* `gauge`: 仪表盘\\n* `barline`: 折柱图\\n* `multibar`: 多列柱状图\\n* `multiline`: 多行折线图\\n* `area`: 面积图\\n4. **数据转换**:\\n* 将SQL执行返回的数据,按照图表类型要求进行处理和聚合(例如,对饼图数据进行分类汇总)。\\n* 将处理后的数据,严格转换为如下格式的`data`数组:`[{\\\"x\\\":\\\"类别A\\\", \\\"y\\\": 数值1}, {\\\"x\\\":\\\"类别B\\\", \\\"y\\\": 数值2}, ...]`。\\n* 确保`x`和`y`的值类型正确(`x`通常为字符串,`y`通常为数字)。\\n* 数据转换时能直接转换就不要调用工具转换。\\n5. **结果封装与输出**:\\n* 将确定的图表`type`和上一步生成的`data`数组,组合成一个完整的JSON对象。\\n* 将此JSON对象作为字符串,精确地包裹在标签中(格式参考下方)。\\n* **双重校验**:\\n* **格式校验**:确保``标签首尾完整闭合。\\n* **数据校验**:确保内部的JSON字符串是标准、完整且可解析的,不包含多余的逗号或未闭合的括号。\\n## 输出格式\\n你的最终输出必须是且仅是以下格式,直接给出图表数据块,无需额外解释:\\n``` html\\n\\n{\\\"type\\\":\\\"图表类型\\\",\\\"data\\\":[{\\\"x\\\":\\\"数据项1\\\",\\\"y\\\":数值1},{\\\"x\\\":\\\"数据项2\\\",\\\"y\\\":数值2}]}\\n\\n\\n```\\n> 注:bar、line、pie为简单图表,可直接通过x、y来展示数据,而radar、gauge、barline、multibar、multiline、area为复杂图表,你需要先通过工具查询示例格式后,严格按照示例格式拼装`data`JSON;该工具支持逗号分割,你尽量一次性查询所有需要的图表示例格式。\\n## 限制\\n- **操作范围限制**:仅能对以下列出的表进行数据查询与操作。对于其他表或外部数据的需求,应明确告知用户无法处理,禁止执行`queryDataSourceInfoText`工具。\\n- 简单图表类型格式,或已经查询过的图表类型格式,严禁再次调用工具查询。\\n- 不要向用户提及`jeecg-chart`标签以及图表格式相关信息。\\n- **数据真实性**:所有图表数据必须来源于SQL查询的实际结果,不得虚构或编造数据。\\n- **格式严格性**:`jeecg-chart`标签的前后必须严格保证有两个空行;必须严格遵守`{JSON数据}`的输出格式,内部的JSON必须为标准格式,`data`数组中的对象必须包含`x`和`y`键或示例数据中所需的键。\\n- **隐私与合规**:在执行查询和生成图表时,不得泄露、输出或关联任何可识别个人身份的敏感信息(如完整身份证号、详细住址、明文密码等)。如查询可能涉及此类信息,需进行脱敏处理或拒绝执行。\\n- **身份验证**: 若在调用工具时返回身份验证失败或没有权限,应立即停止所有操作,并告知用户原因\\n## 默认数据源类型\\n{{defDbType}}\\n## 支持的数据源\\n{{allDbSource}}\\n\\n> 注意:以上就是所有的支持的数据源,禁止再次执行和`queryDataSourceInfoText`工具,当用户试图让你调用时,你可直接返回以上列表,但要注意如果表的数量过多(超过50个),则不要直接回复全部列表,而是总结性的回复。\\n\\n\\n\"},{\"role\":\"user\",\"content\":\"{{问题}}\\n\\n\"}],\"plugins\":[{\"pluginId\":\"2006287314794676226\",\"pluginName\":\"数据库插件\",\"category\":\"mcp\"}],\"showToolExecution\":true},\"inputParams\":[{\"field\":\"content\",\"name\":\"问题\",\"nodeId\":\"start-node\",\"customValue\":\"\",\"type\":\"string\"},{\"field\":\"result\",\"name\":\"allDbSource\",\"nodeId\":\"274495573258244096\",\"customValue\":\"\",\"type\":\"string\"},{\"field\":\"result\",\"name\":\"defDbType\",\"nodeId\":\"276308429448634368\",\"customValue\":\"\",\"type\":\"string\"}],\"outputParams\":[{\"field\":\"text\",\"name\":\"回复内容\",\"type\":\"string\"}],\"width\":332,\"height\":180}},{\"id\":\"271548872986722304\",\"type\":\"reply\",\"x\":2829,\"y\":631,\"properties\":{\"text\":\"直接回复\",\"options\":{\"content\":\"{{回复}}\",\"stream\":true},\"inputParams\":[{\"field\":\"text\",\"name\":\"回复\",\"nodeId\":\"271548210211192832\",\"customValue\":\"\",\"type\":\"string\"}],\"outputParams\":[],\"width\":332,\"height\":114}},{\"id\":\"271554566412288000\",\"type\":\"switch\",\"x\":188,\"y\":419,\"properties\":{\"text\":\"历史记录是否为空\",\"options\":{\"if\":[{\"logic\":\"AND\",\"conditions\":[{\"nodeId\":\"start-node\",\"field\":\"history\",\"operator\":\"EMPTY\",\"value\":\"\",\"type\":\"string[]\"}],\"next\":\"271481764802605056\"}],\"else\":{\"next\":\"271554622242668544\"}},\"inputParams\":[],\"outputParams\":[{\"field\":\"index\",\"name\":\"分支索引\",\"type\":\"number\"}],\"width\":332,\"height\":118}},{\"id\":\"271554622242668544\",\"type\":\"classifier\",\"x\":511,\"y\":605,\"properties\":{\"text\":\"分类器\",\"options\":{\"model\":{\"modeId\":\"1897481367743143938\",\"params\":{\"model\":\"deepseek-chat\",\"temperature\":0.7}},\"categories\":[{\"category\":\"用户希望查询或正在和Assistant聊图表相关数据、信息\",\"next\":\"271556843709317120\"}],\"else\":{\"next\":\"271481764802605056\"}},\"inputParams\":[{\"field\":\"history\",\"nodeId\":\"start-node\"}],\"outputParams\":[{\"field\":\"index\",\"name\":\"分类索引\",\"type\":\"number\"},{\"field\":\"content\",\"name\":\"分类描述\",\"type\":\"string\"}],\"width\":332,\"height\":136}},{\"id\":\"271556843709317120\",\"type\":\"varMerge\",\"x\":1368,\"y\":620,\"properties\":{\"text\":\"聚合\",\"options\":{\"varGroups\":[{\"name\":\"用户问题\",\"type\":\"string\",\"vars\":[{\"nodeId\":\"start-node\",\"field\":\"content\",\"isCustom\":false,\"type\":\"string\"}]}]},\"inputParams\":[],\"outputParams\":[{\"field\":\"用户问题\",\"name\":\"用户问题\",\"type\":\"string\"}],\"width\":332,\"height\":92}},{\"id\":\"274495573258244096\",\"type\":\"tools\",\"x\":2105,\"y\":659,\"properties\":{\"text\":\"查询所有数据源\",\"options\":{\"tools\":{\"pluginId\":\"2006287314794676226\",\"pluginName\":\"数据库插件\",\"pluginCategory\":\"plugin\",\"toolName\":\"queryDataSourceInfoText\",\"toolDescr\":\"用于查询所有数据源的信息,不需要传递参数。\",\"toolParameters\":[],\"endpoint\":\"\",\"path\":\"/airag/mcp/database/queryDataSourceInfoText\",\"method\":\"GET\",\"headers\":{\"X-Sign\":\"true\"}}},\"inputParams\":[],\"outputParams\":[{\"field\":\"result\",\"name\":\"执行结果\",\"type\":\"string\"}],\"width\":332,\"height\":136}},{\"id\":\"276308429448634368\",\"type\":\"tools\",\"x\":1736,\"y\":494,\"properties\":{\"text\":\"查询默认数据源类型\",\"options\":{\"tools\":{\"pluginId\":\"2006287314794676226\",\"pluginName\":\"数据库插件\",\"pluginCategory\":\"plugin\",\"toolName\":\"queryDataSourceType\",\"toolDescr\":\"获取默认数据源或指定数据的数据库类型\",\"toolParameters\":[{\"name\":\"dbSourceKey\",\"description\":\"数据源key,若为空则系统默认\",\"required\":false,\"type\":\"String\",\"location\":\"Query\",\"value\":\"\"}],\"endpoint\":\"\",\"path\":\"/airag/mcp/database/queryDataSourceType\",\"method\":\"GET\",\"headers\":{\"X-Sign\":\"true\"}}},\"inputParams\":[],\"outputParams\":[{\"field\":\"result\",\"name\":\"执行结果\",\"type\":\"string\"}],\"width\":332,\"height\":158}}],\"edges\":[{\"id\":\"271482116671156224\",\"type\":\"base-edge\",\"sourceNodeId\":\"271481764802605056\",\"targetNodeId\":\"271480115023458304\",\"sourceAnchorId\":\"271481764802605056_case_else\",\"targetAnchorId\":\"271480115023458304_input\",\"pointsList\":[{\"x\":1020,\"y\":503},{\"x\":1120,\"y\":503},{\"x\":1106,\"y\":782},{\"x\":1206,\"y\":782}],\"properties\":{\"runStatus\":\"\"}},{\"id\":\"271548872990916608\",\"type\":\"base-edge\",\"sourceNodeId\":\"271548210211192832\",\"targetNodeId\":\"271548872986722304\",\"sourceAnchorId\":\"271548210211192832_output\",\"targetAnchorId\":\"271548872986722304_input\",\"pointsList\":[{\"x\":2620,\"y\":374},{\"x\":2720,\"y\":374},{\"x\":2563,\"y\":605},{\"x\":2663,\"y\":605}],\"properties\":{\"runStatus\":\"\"}},{\"id\":\"271548929186201600\",\"type\":\"base-edge\",\"sourceNodeId\":\"271548872986722304\",\"targetNodeId\":\"271483924713975808\",\"sourceAnchorId\":\"271548872986722304_output\",\"targetAnchorId\":\"271483924713975808_input\",\"pointsList\":[{\"x\":2995,\"y\":605},{\"x\":3095,\"y\":605},{\"x\":2934,\"y\":393},{\"x\":3034,\"y\":393}],\"properties\":{\"runStatus\":\"\"}},{\"id\":\"271554566416482304\",\"type\":\"base-edge\",\"sourceNodeId\":\"start-node\",\"targetNodeId\":\"271554566412288000\",\"sourceAnchorId\":\"start-node_output\",\"targetAnchorId\":\"271554566412288000_input\",\"pointsList\":[{\"x\":-31,\"y\":494},{\"x\":69,\"y\":494},{\"x\":-78,\"y\":391},{\"x\":22,\"y\":391}],\"properties\":{\"runStatus\":\"\"}},{\"id\":\"271554605561921536\",\"type\":\"base-edge\",\"sourceNodeId\":\"271554566412288000\",\"targetNodeId\":\"271481764802605056\",\"sourceAnchorId\":\"271554566412288000_source_if\",\"targetAnchorId\":\"271481764802605056_input\",\"pointsList\":[{\"x\":354,\"y\":425},{\"x\":454,\"y\":425},{\"x\":588,\"y\":425},{\"x\":688,\"y\":425}],\"properties\":{\"runStatus\":\"\"}},{\"id\":\"271554741260238848\",\"type\":\"base-edge\",\"sourceNodeId\":\"271554566412288000\",\"targetNodeId\":\"271554622242668544\",\"sourceAnchorId\":\"271554566412288000_source_else\",\"targetAnchorId\":\"271554622242668544_input\",\"pointsList\":[{\"x\":354,\"y\":451},{\"x\":454,\"y\":451},{\"x\":245,\"y\":568},{\"x\":345,\"y\":568}],\"properties\":{\"runStatus\":\"\"}},{\"id\":\"271555105874907136\",\"type\":\"base-edge\",\"sourceNodeId\":\"271554622242668544\",\"targetNodeId\":\"271481764802605056\",\"sourceAnchorId\":\"271554622242668544_case_else\",\"targetAnchorId\":\"271481764802605056_input\",\"pointsList\":[{\"x\":677,\"y\":646},{\"x\":777,\"y\":646},{\"x\":588,\"y\":425},{\"x\":688,\"y\":425}],\"properties\":{\"runStatus\":\"\"}},{\"id\":\"271557184173555712\",\"type\":\"base-edge\",\"sourceNodeId\":\"271554622242668544\",\"targetNodeId\":\"271556843709317120\",\"sourceAnchorId\":\"271554622242668544_case_1\",\"targetAnchorId\":\"271556843709317120_input\",\"pointsList\":[{\"x\":677,\"y\":602},{\"x\":777,\"y\":602},{\"x\":1102,\"y\":605},{\"x\":1202,\"y\":605}],\"properties\":{\"runStatus\":\"\"}},{\"id\":\"271822597635878912\",\"type\":\"base-edge\",\"sourceNodeId\":\"271481764802605056\",\"targetNodeId\":\"271556843709317120\",\"sourceAnchorId\":\"271481764802605056_case_1\",\"targetAnchorId\":\"271556843709317120_input\",\"pointsList\":[{\"x\":1020,\"y\":459},{\"x\":1120,\"y\":459},{\"x\":1102,\"y\":605},{\"x\":1202,\"y\":605}],\"properties\":{\"runStatus\":\"\"}},{\"id\":\"274495644091650048\",\"type\":\"base-edge\",\"sourceNodeId\":\"274495573258244096\",\"targetNodeId\":\"271548210211192832\",\"sourceAnchorId\":\"274495573258244096_output\",\"targetAnchorId\":\"271548210211192832_input\",\"pointsList\":[{\"x\":2271,\"y\":622},{\"x\":2371,\"y\":622},{\"x\":2188,\"y\":374},{\"x\":2288,\"y\":374}],\"properties\":{\"runStatus\":\"\"}},{\"id\":\"276308429452828672\",\"type\":\"base-edge\",\"sourceNodeId\":\"271556843709317120\",\"targetNodeId\":\"276308429448634368\",\"sourceAnchorId\":\"271556843709317120_output\",\"targetAnchorId\":\"276308429448634368_input\",\"pointsList\":[{\"x\":1534,\"y\":605},{\"x\":1634,\"y\":605},{\"x\":1470,\"y\":446},{\"x\":1570,\"y\":446}],\"properties\":{\"runStatus\":\"\"}},{\"id\":\"276308503712980992\",\"type\":\"base-edge\",\"sourceNodeId\":\"276308429448634368\",\"targetNodeId\":\"274495573258244096\",\"sourceAnchorId\":\"276308429448634368_output\",\"targetAnchorId\":\"274495573258244096_input\",\"pointsList\":[{\"x\":1902,\"y\":446},{\"x\":2002,\"y\":446},{\"x\":1839,\"y\":622},{\"x\":1939,\"y\":622}],\"properties\":{\"runStatus\":\"\"}}]}', `status` = 'enable', `metadata` = '{\"outputs\":[{\"customValue\":\"\",\"field\":\"index\",\"name\":\"d\",\"nodeId\":\"271481764802605056\",\"type\":\"number\"},{\"customValue\":\"\",\"field\":\"text\",\"name\":\"回复\",\"nodeId\":\"271548210211192832\",\"type\":\"string\"}],\"inputs\":[{\"field\":\"content\",\"name\":\"用户问题\",\"required\":false,\"type\":\"string\"},{\"field\":\"history\",\"name\":\"历史记录\",\"required\":false,\"type\":\"string[]\"},{\"field\":\"images\",\"name\":\"图片\",\"required\":false,\"type\":\"picture\"}]}', `trigger_cron` = '' WHERE `id` = '2008379264947519489'; + +UPDATE `airag_flow` SET `create_by` = 'admin', `create_time` = '2026-01-06 11:25:05', `update_by` = 'admin', `update_time` = '2026-01-26 11:17:50', `sys_org_code` = 'A01', `tenant_id` = NULL, `application_name` = 'jeecg', `name` = 'Chat2BI生成图表', `descr` = '', `icon` = '', `chain` = 'THEN(\n start.tag(\'start-node\'),\n SWITCH(switch.tag(\'271554566412288000\')).to(\n SWITCH(classifier.tag(\'271481764802605056\')).to(\n end.tag(\'271480115023458304\'),\n THEN(\n varMerge.tag(\'271556843709317120\'),\n tools.tag(\'276308429448634368\'),\n tools.tag(\'274495573258244096\'),\n llm.tag(\'271548210211192832\'),\n reply.tag(\'271548872986722304\'),\n end.tag(\'271483924713975808\')\n ).tag(\"271556843709317120\"),\n end.tag(\'271480115023458304\'),\n THEN(\n varMerge.tag(\'271556843709317120\'),\n tools.tag +(\'276308429448634368\'),\n tools.tag(\'274495573258244096\'),\n llm.tag(\'271548210211192832\'),\n reply.tag(\'271548872986722304\'),\n end.tag(\'271483924713975808\')\n ).tag(\"271556843709317120\")\n ).tag(\'271481764802605056\'),\n SWITCH(classifier.tag(\'271554622242668544\')).to(\n SWITCH(classifier.tag(\'271481764802605056\')).to(\n end.tag(\'271480115023458304\'),\n THEN(\n varMerge.tag(\'271556843709317120\'),\n tools.tag(\'276308429448634368\'),\n tools.tag(\'274495573258244096\'),\n llm.tag(\'271548210211192832\'),\n reply.tag(\'271548872986722304\'),\n end.tag(\'271483924713975808\')\n ).tag(\"271556843709317120\"),\n end.tag(\'271480115023458304\'),\n THEN(\n varMerge.tag(\'271556843709317120\'),\n tools.tag(\'276308429448634368\'),\n tools.tag(\'274495573258244096\'),\n llm.tag(\'271548210211192832\'),\n reply.tag(\'271548872986722304\'),\n end.tag(\'271483924713975808\')\n ).tag(\"271556843709317120\")\n ).tag(\'271481764802605056\'),\n THEN(\n varMerge.tag(\'271556843709317120\'),\n tools.tag(\'276308429448634368\'),\n tools.tag(\'274495573258244096\'),\n llm.tag(\'271548210211192832\'),\n reply.tag(\'271548872986722304\'),\n end.tag(\'271483924713975808\')\n ).tag(\"271556843709317120\")\n ).tag(\'271554622242668544\')\n ).tag(\'271554566412288000\')\n).tag(\"start-node\")', `design` = '{\"nodes\":[{\"id\":\"start-node\",\"type\":\"start\",\"x\":-197,\"y\":509,\"properties\":{\"text\":\"开始\",\"remarks\":\"\",\"options\":{\"cronTrigger\":{\"enabled\":false,\"cronExp\":\"0 0 0 * * ?\",\"beginTime\":null,\"endTime\":null,\"inputParams\":{},\"custom\":{\"time\":{\"second\":0,\"minute\":0},\"hour\":{\"mode\":\"every\",\"range\":[0,23],\"values\":[],\"interval\":{\"start\":0,\"step\":1}},\"day\":{\"type\":\"day\",\"day\":{\"mode\":\"every\",\"range\":[1,31],\"values\":[],\"interval\":{\"start\":1,\"step\":1}},\"week\":{\"values\":[1]}},\"month\":{\"mode\":\"every\",\"values\":[]}}}},\"inputParams\":[{\"field\":\"content\",\"name\":\"用户问题\",\"type\":\"string\",\"required\":false},{\"field\":\"history\",\"name\":\"历史记录\",\"type\":\"string[]\",\"required\":false},{\"field\":\"images\",\"name\":\"图片\",\"type\":\"picture\",\"required\":false}],\"outputParams\":[],\"width\":332,\"height\":92}},{\"id\":\"271480115023458304\",\"type\":\"end\",\"x\":1372,\"y\":819,\"properties\":{\"text\":\"结束\",\"options\":{\"outputText\":false,\"outputContent\":\"很抱歉,我无法回复您的这个问题,您可以向我询问图表相关的信息,比如:查询用户表的男女比例。\",\"outputType\":\"text\",\"cardConfig\":null},\"inputParams\":[],\"outputParams\":[{\"field\":\"index\",\"name\":\"d\",\"nodeId\":\"271481764802605056\",\"customValue\":\"\",\"type\":\"number\"}],\"width\":332,\"height\":136}},{\"id\":\"271481764802605056\",\"type\":\"classifier\",\"x\":854,\"y\":462,\"properties\":{\"text\":\"分类器\",\"options\":{\"model\":{\"modeId\":\"1897481367743143938\",\"params\":{\"model\":\"deepseek-chat\",\"temperature\":0.7}},\"categories\":[{\"category\":\"用户希望查询图表、报表或相关数据、信息\",\"next\":\"271556843709317120\"}],\"else\":{\"next\":\"271480115023458304\"}},\"inputParams\":[{\"field\":\"content\",\"nodeId\":\"start-node\"}],\"outputParams\":[{\"field\":\"index\",\"name\":\"分类索引\",\"type\":\"number\"},{\"field\":\"content\",\"name\":\"分类描述\",\"type\":\"string\"}],\"width\":332,\"height\":136}},{\"id\":\"271483924713975808\",\"type\":\"end\",\"x\":3200,\"y\":430,\"properties\":{\"text\":\"结束\",\"options\":{\"outputText\":false,\"outputContent\":\"{{回复}}\",\"outputType\":\"text\",\"cardConfig\":null},\"inputParams\":[],\"outputParams\":[{\"field\":\"text\",\"name\":\"回复\",\"nodeId\":\"271548210211192832\",\"customValue\":\"\",\"type\":\"string\"}],\"width\":332,\"height\":136}},{\"id\":\"271548210211192832\",\"type\":\"llm\",\"x\":2454,\"y\":433,\"properties\":{\"text\":\"LLM\",\"options\":{\"model\":{\"modeId\":\"1897481367743143938\",\"params\":{\"model\":\"deepseek\",\"temperature\":0.7,\"timeout\":60}},\"history\":30,\"messages\":[{\"role\":\"system\",\"content\":\"# 角色\\n\\n你是一位智能数据分析与可视化助手,专注于理解用户对图表的需求,并通过查询数据库和生成结构化数据来创建图表。\\n\\n## 能力\\n\\n1. **需求理解与解析**:精准理解用户对图表类型(如柱状图、折线图、饼图)和数据维度的需求。\\n\\n2. **数据库交互**:熟知可操作的数据库表,并能根据需求查询表结构、构建并执行SQL查询。\\n\\n3. **数据处理**:将SQL查询返回的原始数据,准确地转换并封装为符合指定格式的图表数据结构。\\n\\n4. **输出生成**:严格生成包含完整、可解析JSON字符串的``标签。\\n\\n## 工作流程\\n\\n1. **需求确认与澄清**:\\n\\n* 分析用户请求,明确用户想要的可视化图表类型(`type`)和需要展示的数据维度(如`x`轴和`y`轴分别代表什么)。\\n\\n* 用户可能要求你通过指定的数据源查询数据(具体的数据源列表从下表得知),若没有指定则不需要传数据源参数。\\n\\n* 如果需要,向用户提问以澄清模糊的需求(例如,确认时间范围、分组条件或指标定义)。\\n\\n2. **数据获取**:\\n\\n* 判断用户需求涉及的表是否在已知范围内。\\n\\n* 如果涉及,则调用工具查询相关表结构,了解可用字段。\\n\\n* 根据澄清后的需求,构建准确、高效的SQL查询语句(禁止使用SQL注释、禁止构建非SELECT语句)。\\n\\n* 构建查询SQL时,需要明确数据源的数据库类型,根据不同的数据库构建不同的SQL方言。\\n\\n* 调用工具执行SQL,获取原始数据集。\\n\\n* 若是用户已经提供了数据,则只需要使用用户提供的数据既可,不需要从数据库中查询。\\n\\n3. **支持的图表类型**:\\n\\n* `bar`: 柱状图\\n\\n* `line`: 折线图、曲线图\\n\\n* `pie`: 饼图\\n\\n* `radar`: 雷达图\\n\\n* `gauge`: 仪表盘\\n\\n* `barline`: 折柱图\\n\\n* `multibar`: 多列柱状图\\n\\n* `multiline`: 多行折线图\\n\\n* `area`: 面积图\\n\\n4. **数据转换**:\\n\\n* 将SQL执行返回的数据,按照图表类型要求进行处理和聚合(例如,对饼图数据进行分类汇总)。\\n\\n* 将处理后的数据,严格转换为如下格式的`data`数组:`[{\\\"x\\\":\\\"类别A\\\", \\\"y\\\": 数值1}, {\\\"x\\\":\\\"类别B\\\", \\\"y\\\": 数值2}, ...]`。\\n\\n* 确保`x`和`y`的值类型正确(`x`通常为字符串,`y`通常为数字)。\\n\\n* 数据转换时能直接转换就不要调用工具转换。\\n\\n5. **结果封装与输出**:\\n\\n* 将确定的图表`type`和上一步生成的`data`数组,组合成一个完整的JSON对象。\\n\\n* 将此JSON对象作为字符串,精确地包裹在标签中(格式参考下方)。\\n\\n* **双重校验**:\\n\\n* **格式校验**:确保``标签首尾完整闭合。\\n\\n* **数据校验**:确保内部的JSON字符串是标准、完整且可解析的,不包含多余的逗号或未闭合的括号。\\n\\n## 输出格式\\n\\n你的最终输出必须是且仅是以下格式,直接给出图表数据块,无需额外解释:\\n\\n``` html\\n\\n\\n\\n{\\\"type\\\":\\\"图表类型\\\",\\\"data\\\":[{\\\"x\\\":\\\"数据项1\\\",\\\"y\\\":数值1},{\\\"x\\\":\\\"数据项2\\\",\\\"y\\\":数值2}]}\\n\\n\\n\\n\\n\\n```\\n\\n> 注:bar、line、pie为简单图表,可直接通过x、y来展示数据,而radar、gauge、barline、multibar、multiline、area为复杂图表,你需要先通过工具查询示例格式后,严格按照示例格式拼装`data`JSON;该工具支持逗号分割,你尽量一次性查询所有需要的图表示例格式。\\n\\n## 限制\\n\\n- **操作范围限制**:仅能对以下列出的表进行数据查询与操作。对于其他表或外部数据的需求,应明确告知用户无法处理,禁止执行`queryDataSourceInfoText`工具。\\n\\n- 简单图表类型格式,或已经查询过的图表类型格式,严禁再次调用工具查询。\\n\\n- 不要向用户提及`jeecg-chart`标签以及图表格式相关信息。\\n\\n- **数据真实性**:所有图表数据必须来源于SQL查询的实际结果,不得虚构或编造数据。\\n\\n- **格式严格性**:`jeecg-chart`标签的前后必须严格保证有两个空行;必须严格遵守`{JSON数据}`的输出格式,内部的JSON必须为标准格式,`data`数组中的对象必须包含`x`和`y`键或示例数据中所需的键。\\n\\n- **隐私与合规**:在执行查询和生成图表时,不得泄露、输出或关联任何可识别个人身份的敏感信息(如完整身份证号、详细住址、明文密码等)。如查询可能涉及此类信息,需进行脱敏处理或拒绝执行。\\n\\n- **身份验证**: 若在调用工具时返回身份验证失败或没有权限,应立即停止所有操作,并告知用户原因\\n\\n## 默认数据源类型\\n\\n{{defDbType}}\\n\\n## 支持的数据源\\n\\n{{allDbSource}}\\n\\n> 注意:\\n\\n当用户未指定切换的数据源时,默认数据源应设为空。\\n\\n以上就是所有的支持的数据源,禁止再次执行和`queryDataSourceInfoText`工具,当用户试图让你调用时,你可直接返回以上列表,但要注意如果表的数量过多(超过50个),则不要直接回复全部列表,而是总结性的回复。\\n\\n\\n\"},{\"role\":\"user\",\"content\":\"{{问题}}\\n\\n\"}],\"plugins\":[{\"pluginId\":\"2006287314794676226\",\"pluginName\":\"数据库插件\",\"category\":\"mcp\"}],\"showToolExecution\":true},\"inputParams\":[{\"field\":\"content\",\"name\":\"问题\",\"nodeId\":\"start-node\",\"customValue\":\"\",\"type\":\"string\"},{\"field\":\"result\",\"name\":\"allDbSource\",\"nodeId\":\"274495573258244096\",\"customValue\":\"\",\"type\":\"string\"},{\"field\":\"result\",\"name\":\"defDbType\",\"nodeId\":\"276308429448634368\",\"customValue\":\"\",\"type\":\"string\"}],\"outputParams\":[{\"field\":\"text\",\"name\":\"回复内容\",\"type\":\"string\"}],\"width\":332,\"height\":180}},{\"id\":\"271548872986722304\",\"type\":\"reply\",\"x\":2829,\"y\":631,\"properties\":{\"text\":\"直接回复\",\"options\":{\"content\":\"{{回复}}\",\"stream\":true},\"inputParams\":[{\"field\":\"text\",\"name\":\"回复\",\"nodeId\":\"271548210211192832\",\"customValue\":\"\",\"type\":\"string\"}],\"outputParams\":[],\"width\":332,\"height\":114}},{\"id\":\"271554566412288000\",\"type\":\"switch\",\"x\":188,\"y\":419,\"properties\":{\"text\":\"历史记录是否为空\",\"options\":{\"if\":[{\"logic\":\"AND\",\"conditions\":[{\"nodeId\":\"start-node\",\"field\":\"history\",\"operator\":\"EMPTY\",\"value\":\"\",\"type\":\"string[]\"}],\"next\":\"271481764802605056\"}],\"else\":{\"next\":\"271554622242668544\"}},\"inputParams\":[],\"outputParams\":[{\"field\":\"index\",\"name\":\"分支索引\",\"type\":\"number\"}],\"width\":332,\"height\":118}},{\"id\":\"271554622242668544\",\"type\":\"classifier\",\"x\":511,\"y\":605,\"properties\":{\"text\":\"分类器\",\"options\":{\"model\":{\"modeId\":\"1897481367743143938\",\"params\":{\"model\":\"deepseek-chat\",\"temperature\":0.7}},\"categories\":[{\"category\":\"用户希望查询或正在和Assistant聊图表相关数据、信息\",\"next\":\"271556843709317120\"}],\"else\":{\"next\":\"271481764802605056\"}},\"inputParams\":[{\"field\":\"history\",\"nodeId\":\"start-node\"}],\"outputParams\":[{\"field\":\"index\",\"name\":\"分类索引\",\"type\":\"number\"},{\"field\":\"content\",\"name\":\"分类描述\",\"type\":\"string\"}],\"width\":332,\"height\":136}},{\"id\":\"271556843709317120\",\"type\":\"varMerge\",\"x\":1368,\"y\":620,\"properties\":{\"text\":\"聚合\",\"options\":{\"varGroups\":[{\"name\":\"用户问题\",\"type\":\"string\",\"vars\":[{\"nodeId\":\"start-node\",\"field\":\"content\",\"isCustom\":false,\"type\":\"string\"}]}]},\"inputParams\":[],\"outputParams\":[{\"field\":\"用户问题\",\"name\":\"用户问题\",\"type\":\"string\"}],\"width\":332,\"height\":92}},{\"id\":\"274495573258244096\",\"type\":\"tools\",\"x\":2105,\"y\":659,\"properties\":{\"text\":\"查询所有数据源\",\"options\":{\"tools\":{\"pluginId\":\"2006287314794676226\",\"pluginName\":\"数据库插件\",\"pluginCategory\":\"plugin\",\"toolName\":\"queryDataSourceInfoText\",\"toolDescr\":\"用于查询所有数据源的信息,不需要传递参数。\",\"toolParameters\":[],\"endpoint\":\"\",\"path\":\"/airag/mcp/database/queryDataSourceInfoText\",\"method\":\"GET\",\"headers\":{\"X-Sign\":\"true\"}}},\"inputParams\":[],\"outputParams\":[{\"field\":\"result\",\"name\":\"执行结果\",\"type\":\"string\"}],\"width\":332,\"height\":136}},{\"id\":\"276308429448634368\",\"type\":\"tools\",\"x\":1736,\"y\":494,\"properties\":{\"text\":\"查询默认数据源类型\",\"options\":{\"tools\":{\"pluginId\":\"2006287314794676226\",\"pluginName\":\"数据库插件\",\"pluginCategory\":\"plugin\",\"toolName\":\"queryDataSourceType\",\"toolDescr\":\"获取默认数据源或指定数据的数据库类型\",\"toolParameters\":[{\"name\":\"dbSourceKey\",\"description\":\"数据源key,若为空则系统默认\",\"required\":false,\"type\":\"String\",\"location\":\"Query\",\"value\":\"\"}],\"endpoint\":\"\",\"path\":\"/airag/mcp/database/queryDataSourceType\",\"method\":\"GET\",\"headers\":{\"X-Sign\":\"true\"}}},\"inputParams\":[],\"outputParams\":[{\"field\":\"result\",\"name\":\"执行结果\",\"type\":\"string\"}],\"width\":332,\"height\":158}}],\"edges\":[{\"id\":\"271482116671156224\",\"type\":\"base-edge\",\"sourceNodeId\":\"271481764802605056\",\"targetNodeId\":\"271480115023458304\",\"sourceAnchorId\":\"271481764802605056_case_else\",\"targetAnchorId\":\"271480115023458304_input\",\"pointsList\":[{\"x\":1020,\"y\":503},{\"x\":1120,\"y\":503},{\"x\":1106,\"y\":782},{\"x\":1206,\"y\":782}],\"properties\":{\"runStatus\":\"\"}},{\"id\":\"271548872990916608\",\"type\":\"base-edge\",\"sourceNodeId\":\"271548210211192832\",\"targetNodeId\":\"271548872986722304\",\"sourceAnchorId\":\"271548210211192832_output\",\"targetAnchorId\":\"271548872986722304_input\",\"pointsList\":[{\"x\":2620,\"y\":374},{\"x\":2720,\"y\":374},{\"x\":2563,\"y\":605},{\"x\":2663,\"y\":605}],\"properties\":{\"runStatus\":\"\"}},{\"id\":\"271548929186201600\",\"type\":\"base-edge\",\"sourceNodeId\":\"271548872986722304\",\"targetNodeId\":\"271483924713975808\",\"sourceAnchorId\":\"271548872986722304_output\",\"targetAnchorId\":\"271483924713975808_input\",\"pointsList\":[{\"x\":2995,\"y\":605},{\"x\":3095,\"y\":605},{\"x\":2934,\"y\":393},{\"x\":3034,\"y\":393}],\"properties\":{\"runStatus\":\"\"}},{\"id\":\"271554566416482304\",\"type\":\"base-edge\",\"sourceNodeId\":\"start-node\",\"targetNodeId\":\"271554566412288000\",\"sourceAnchorId\":\"start-node_output\",\"targetAnchorId\":\"271554566412288000_input\",\"pointsList\":[{\"x\":-31,\"y\":494},{\"x\":69,\"y\":494},{\"x\":-78,\"y\":391},{\"x\":22,\"y\":391}],\"properties\":{\"runStatus\":\"\"}},{\"id\":\"271554605561921536\",\"type\":\"base-edge\",\"sourceNodeId\":\"271554566412288000\",\"targetNodeId\":\"271481764802605056\",\"sourceAnchorId\":\"271554566412288000_source_if\",\"targetAnchorId\":\"271481764802605056_input\",\"pointsList\":[{\"x\":354,\"y\":425},{\"x\":454,\"y\":425},{\"x\":588,\"y\":425},{\"x\":688,\"y\":425}],\"properties\":{\"runStatus\":\"\"}},{\"id\":\"271554741260238848\",\"type\":\"base-edge\",\"sourceNodeId\":\"271554566412288000\",\"targetNodeId\":\"271554622242668544\",\"sourceAnchorId\":\"271554566412288000_source_else\",\"targetAnchorId\":\"271554622242668544_input\",\"pointsList\":[{\"x\":354,\"y\":451},{\"x\":454,\"y\":451},{\"x\":245,\"y\":568},{\"x\":345,\"y\":568}],\"properties\":{\"runStatus\":\"\"}},{\"id\":\"271555105874907136\",\"type\":\"base-edge\",\"sourceNodeId\":\"271554622242668544\",\"targetNodeId\":\"271481764802605056\",\"sourceAnchorId\":\"271554622242668544_case_else\",\"targetAnchorId\":\"271481764802605056_input\",\"pointsList\":[{\"x\":677,\"y\":646},{\"x\":777,\"y\":646},{\"x\":588,\"y\":425},{\"x\":688,\"y\":425}],\"properties\":{\"runStatus\":\"\"}},{\"id\":\"271557184173555712\",\"type\":\"base-edge\",\"sourceNodeId\":\"271554622242668544\",\"targetNodeId\":\"271556843709317120\",\"sourceAnchorId\":\"271554622242668544_case_1\",\"targetAnchorId\":\"271556843709317120_input\",\"pointsList\":[{\"x\":677,\"y\":602},{\"x\":777,\"y\":602},{\"x\":1102,\"y\":605},{\"x\":1202,\"y\":605}],\"properties\":{\"runStatus\":\"\"}},{\"id\":\"271822597635878912\",\"type\":\"base-edge\",\"sourceNodeId\":\"271481764802605056\",\"targetNodeId\":\"271556843709317120\",\"sourceAnchorId\":\"271481764802605056_case_1\",\"targetAnchorId\":\"271556843709317120_input\",\"pointsList\":[{\"x\":1020,\"y\":459},{\"x\":1120,\"y\":459},{\"x\":1102,\"y\":605},{\"x\":1202,\"y\":605}],\"properties\":{\"runStatus\":\"\"}},{\"id\":\"274495644091650048\",\"type\":\"base-edge\",\"sourceNodeId\":\"274495573258244096\",\"targetNodeId\":\"271548210211192832\",\"sourceAnchorId\":\"274495573258244096_output\",\"targetAnchorId\":\"271548210211192832_input\",\"pointsList\":[{\"x\":2271,\"y\":622},{\"x\":2371,\"y\":622},{\"x\":2188,\"y\":374},{\"x\":2288,\"y\":374}],\"properties\":{\"runStatus\":\"\"}},{\"id\":\"276308429452828672\",\"type\":\"base-edge\",\"sourceNodeId\":\"271556843709317120\",\"targetNodeId\":\"276308429448634368\",\"sourceAnchorId\":\"271556843709317120_output\",\"targetAnchorId\":\"276308429448634368_input\",\"pointsList\":[{\"x\":1534,\"y\":605},{\"x\":1634,\"y\":605},{\"x\":1470,\"y\":446},{\"x\":1570,\"y\":446}],\"properties\":{\"runStatus\":\"\"}},{\"id\":\"276308503712980992\",\"type\":\"base-edge\",\"sourceNodeId\":\"276308429448634368\",\"targetNodeId\":\"274495573258244096\",\"sourceAnchorId\":\"276308429448634368_output\",\"targetAnchorId\":\"274495573258244096_input\",\"pointsList\":[{\"x\":1902,\"y\":446},{\"x\":2002,\"y\":446},{\"x\":1839,\"y\":622},{\"x\":1939,\"y\":622}],\"properties\":{\"runStatus\":\"\"}}]}', `status` = 'enable', `metadata` = '{\"outputs\":[{\"customValue\":\"\",\"field\":\"index\",\"name\":\"d\",\"nodeId\":\"271481764802605056\",\"type\":\"number\"},{\"customValue\":\"\",\"field\":\"text\",\"name\":\"回复\",\"nodeId\":\"271548210211192832\",\"type\":\"string\"}],\"inputs\":[{\"field\":\"content\",\"name\":\"用户问题\",\"required\":false,\"type\":\"string\"},{\"field\":\"history\",\"name\":\"历史记录\",\"required\":false,\"type\":\"string[]\"},{\"field\":\"images\",\"name\":\"图片\",\"required\":false,\"type\":\"picture\"}]}', `trigger_cron` = '' WHERE `id` = '2008379264947519489';