-
Notifications
You must be signed in to change notification settings - Fork 520
Closed
Labels
bugSomething isn't workingSomething isn't working
Description
SQLBot Version
v1.4.0
Run Mode
Is it running in a Docker container or running from source code?
Docker container
Describe the bug
A clear and concise description of what the bug is.
在Dify通过mcp访问容器部署的sqlbot时,无法显示生成的图片,而在web前端可以显示
Dify中:
日志如下,图片链接已经生成,即(http://10.61.5.8:9411/images/c_10_r_36.png),但图片不显示且存储路径下没有文件。
2025-12-29 16:57:23,075 - mcp.server.lowlevel.server - DEBUG:779 - Response sent
2025-12-29 16:57:23,075 - mcp.server.sse - DEBUG:172 - Sending message via SSE: SessionMessage(message=JSONRPCMessage(root=JSONRPCError(jsonrpc='2.0', id=2, error=ErrorData(code=-32601, message='Method not found', data=None))), metadata=None)
2025-12-29 16:57:23,076 - sse_starlette.sse - DEBUG:179 - chunk: b'event: message\r\ndata: {"jsonrpc":"2.0","id":2,"error":{"code":-32601,"message":"Method not found"}}\r\n\r\n'
2025-12-29 16:57:23,080 - fastapi_mcp.transport.sse - DEBUG:38 - Handling POST message SSE
2025-12-29 16:57:23,080 - fastapi_mcp.transport.sse - DEBUG:47 - Parsed session ID: 817ae3eb-cd49-49ff-8e52-2e6de91e584e
2025-12-29 16:57:23,080 - fastapi_mcp.transport.sse - DEBUG:58 - Received JSON: {"jsonrpc": "2.0", "id": 3, "method": "resources/templates/list"}
2025-12-29 16:57:23,081 - fastapi_mcp.transport.sse - DEBUG:76 - Validated client message: root=JSONRPCRequest(method='resources/templates/list', params=None, jsonrpc='2.0', id=3)
2025-12-29 16:57:23,081 - fastapi_mcp.transport.sse - DEBUG:92 - Accepting message, will send in background
2025-12-29 16:57:23,081 - fastapi_mcp.transport.sse - DEBUG:105 - Sending message to writer from background task: SessionMessage(message=JSONRPCMessage(root=JSONRPCRequest(method='resources/templates/list', params=None, jsonrpc='2.0', id=3)), metadata=None)
2025-12-29 16:57:23,082 - mcp.server.lowlevel.server - DEBUG:664 - Received message: <mcp.shared.session.RequestResponder object at 0x7267f097f250>
2025-12-29 16:57:23,083 - mcp.server.lowlevel.server - DEBUG:779 - Response sent
2025-12-29 16:57:23,083 - mcp.server.sse - DEBUG:172 - Sending message via SSE: SessionMessage(message=JSONRPCMessage(root=JSONRPCError(jsonrpc='2.0', id=3, error=ErrorData(code=-32601, message='Method not found', data=None))), metadata=None)
2025-12-29 16:57:23,083 - sse_starlette.sse - DEBUG:179 - chunk: b'event: message\r\ndata: {"jsonrpc":"2.0","id":3,"error":{"code":-32601,"message":"Method not found"}}\r\n\r\n'
2025-12-29 16:57:23,088 - fastapi_mcp.transport.sse - DEBUG:38 - Handling POST message SSE
2025-12-29 16:57:23,089 - fastapi_mcp.transport.sse - DEBUG:47 - Parsed session ID: 817ae3eb-cd49-49ff-8e52-2e6de91e584e
2025-12-29 16:57:23,089 - fastapi_mcp.transport.sse - DEBUG:58 - Received JSON: {"jsonrpc": "2.0", "id": 4, "method": "tools/call", "params": {"name": "mcp_question", "arguments": {"chat_id": 10, "question": "\u7528\u67f1\u72b6\u56fe\u753b\u51fa\u6765\u5de5\u5355\u53d6\u6d88\u7684\u4e3b\u8981\u539f\u56e0\u6709\u54ea\u4e9b", "token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6MSwiYWNjb3VudCI6ImFkbWluIiwib2lkIjoxLCJleHAiOjE3Njc2ODk3NTd9.PWu5qJ7O_koewf3vd1I4ciJ3xgP8jJhllDiD8Ny-KnA"}}}
2025-12-29 16:57:23,089 - fastapi_mcp.transport.sse - DEBUG:76 - Validated client message: root=JSONRPCRequest(method='tools/call', params={'name': 'mcp_question', 'arguments': {'chat_id': 10, 'question': '用柱状图画出来工单取消的主要原因有哪些', 'token': 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6MSwiYWNjb3VudCI6ImFkbWluIiwib2lkIjoxLCJleHAiOjE3Njc2ODk3NTd9.PWu5qJ7O_koewf3vd1I4ciJ3xgP8jJhllDiD8Ny-KnA'}, '_http_request_info': {'method': 'POST', 'path': '/mcp/messages/', 'headers': {'host': '10.61.5.8:9411', 'accept': '*/*', 'accept-encoding': 'gzip, deflate', 'connection': 'keep-alive', 'user-agent': 'python-httpx/0.27.2', 'content-type': 'application/json', 'content-length': '409'}, 'cookies': {}, 'query_params': {'session_id': '817ae3ebcd4949ff8e522e6de91e584e'}, 'body': '{"jsonrpc": "2.0", "id": 4, "method": "tools/call", "params": {"name": "mcp_question", "arguments": {"chat_id": 10, "question": "\\u7528\\u67f1\\u72b6\\u56fe\\u753b\\u51fa\\u6765\\u5de5\\u5355\\u53d6\\u6d88\\u7684\\u4e3b\\u8981\\u539f\\u56e0\\u6709\\u54ea\\u4e9b", "token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6MSwiYWNjb3VudCI6ImFkbWluIiwib2lkIjoxLCJleHAiOjE3Njc2ODk3NTd9.PWu5qJ7O_koewf3vd1I4ciJ3xgP8jJhllDiD8Ny-KnA"}}}'}}, jsonrpc='2.0', id=4)
2025-12-29 16:57:23,089 - fastapi_mcp.transport.sse - DEBUG:92 - Accepting message, will send in background
2025-12-29 16:57:23,090 - fastapi_mcp.transport.sse - DEBUG:105 - Sending message to writer from background task: SessionMessage(message=JSONRPCMessage(root=JSONRPCRequest(method='tools/call', params={'name': 'mcp_question', 'arguments': {'chat_id': 10, 'question': '用柱状图画出来工单取消的主要原因有哪些', 'token': 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6MSwiYWNjb3VudCI6ImFkbWluIiwib2lkIjoxLCJleHAiOjE3Njc2ODk3NTd9.PWu5qJ7O_koewf3vd1I4ciJ3xgP8jJhllDiD8Ny-KnA'}, '_http_request_info': {'method': 'POST', 'path': '/mcp/messages/', 'headers': {'host': '10.61.5.8:9411', 'accept': '*/*', 'accept-encoding': 'gzip, deflate', 'connection': 'keep-alive', 'user-agent': 'python-httpx/0.27.2', 'content-type': 'application/json', 'content-length': '409'}, 'cookies': {}, 'query_params': {'session_id': '817ae3ebcd4949ff8e522e6de91e584e'}, 'body': '{"jsonrpc": "2.0", "id": 4, "method": "tools/call", "params": {"name": "mcp_question", "arguments": {"chat_id": 10, "question": "\\u7528\\u67f1\\u72b6\\u56fe\\u753b\\u51fa\\u6765\\u5de5\\u5355\\u53d6\\u6d88\\u7684\\u4e3b\\u8981\\u539f\\u56e0\\u6709\\u54ea\\u4e9b", "token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6MSwiYWNjb3VudCI6ImFkbWluIiwib2lkIjoxLCJleHAiOjE3Njc2ODk3NTd9.PWu5qJ7O_koewf3vd1I4ciJ3xgP8jJhllDiD8Ny-KnA"}}}'}}, jsonrpc='2.0', id=4)), metadata=None)
2025-12-29 16:57:23,091 - mcp.server.lowlevel.server - DEBUG:664 - Received message: <mcp.shared.session.RequestResponder object at 0x7267effaeb90>
2025-12-29 16:57:23,091 - mcp.server.lowlevel.server - DEBUG:712 - Dispatching request of type CallToolRequest
2025-12-29 16:57:23,092 - fastapi_mcp.server - DEBUG:429 - Making POST request to /api/v1/mcp/mcp_question
2025-12-29 16:57:23,517 - openai._base_client - DEBUG:482 - Request options: {'method': 'post', 'url': '/chat/completions', 'files': None, 'idempotency_key': 'stainless-python-retry-c2dd649b-4b16-4464-be44-f78dd6a197f9', 'json_data': {'messages': [{'content': '<Instruction>\n 你是"SQLBOT",智能问数小助手,可以根据用户提问,专业生成SQL与可视化图表。\n 你当前的任务是根据给定的表结构和用户问题生成SQL语句、对话标题、可能适合展示的图表类型以及该SQL中所用到的表名。\n 我们会在<Info>块内提供给你信息,帮助你生成SQL:\n <Info>内有<db-engine><m-schema><terminologies>等信息;\n 其中,<db-engine>:提供数据库引擎及版本信息;\n <m-schema>:以 M-Schema 格式提供数据库表结构信息;\n <terminologies>:提供一组术语,块内每一个<terminology>就是术语,其中同一个<words>内的多个<word>代表术语的多种叫法,也就是术语与它的同义词,<description>即该术语对应的描述,其中也可能是能够用来参考的计算公式,或者是一些其他的查询条件;\n <sql-examples>:提供一组SQL示例,你可以参考这些示例来生成你的回答,其中<question>内是提问,<suggestion-answer>内是对于该<question>提问的解释或者对应应该回答的SQL示例。\n 若有<Other-Infos>块,它会提供一组<content>,可能会是额外添加的背景信息,或者是额外的生成SQL的要求,请结合额外信息或要求后生成你的回答。\n 用户的提问在<user-question>内,<error-msg>内则会提供上次执行你提供的SQL时会出现的错误信息,<background-infos>内的<current-time>会告诉你用户当前提问的时间\n 你必须遵守<Rules>内规定的生成SQL规则\n 你必须遵守<SQL-Generation-Process>内规定的检查步骤生成你的回答\n</Instruction>\n\n<Rules>\n <rule>\n 请使用语言:简体中文 回答,若有深度思考过程,则思考过程也需要使用 简体中文 输出\n </rule>\n <rule>\n 你只能生成查询用的SQL语句,不得生成增删改相关或操作数据库以及操作数据库数据的SQL\n </rule>\n <rule>\n 不要编造<m-schema>内没有提供给你的表结构\n </rule>\n <rule>\n 生成的SQL必须符合<db-engine>内提供数据库引擎的规范\n </rule>\n <rule>\n 若用户提问中提供了参考SQL,你需要判断该SQL是否是查询语句\n </rule>\n <rule>\n 请使用JSON格式返回你的回答:\n 若能生成,则返回格式如:{"success":true,"sql":"你生成的SQL语句","tables":["该SQL用到的表名1","该SQL用到的表名2",...],"chart-type":"table","brief":"如何需要生成对话标题,在这里填写你生成的对话标题,否则不需要这个字段"}\n 若不能生成,则返回格式如:{"success":false,"message":"说明无法生成SQL的原因"}\n </rule>\n <rule>\n 如果问题是图表展示相关,可参考的图表类型为表格(table)、柱状图(column)、条形图(bar)、折线图(line)或饼图(pie), 返回的JSON内chart-type值则为 table/column/bar/line/pie 中的一个\n 图表类型选择原则推荐:趋势 over time 用 line,分类对比用 column/bar,占比用 pie,原始数据查看用 table\n </rule>\n <rule>\n 如果图表类型为柱状图(column)、条形图(bar)或折线图(line), 在生成的SQL中必须指定一个维度字段和一个指标字段,其中维度字段必须参与排序。\n 如果有分类用的字段,该字段参与次一级的排序\n </rule>\n <rule>\n 如果问题是图表展示相关且与生成SQL查询无关时,请参考上一次回答的SQL来生成SQL\n </rule>\n <rule>\n 返回的JSON字段中,tables字段为你回答的SQL中所用到的表名,不要包含schema和database,用数组返回\n </rule>\n <rule>\n 提问中如果有涉及数据源名称或数据源描述的内容,则忽略数据源的信息,直接根据剩余内容生成SQL\n </rule>\n <rule>\n 必须对数据库名、表名、字段名、别名外层加双引号(")。\n <note>\n 1. 点号(.)不能包含在引号内,必须写成 "schema"."table"\n 2. 即使标识符不含特殊字符或非关键字,也需强制加双引号\n </note>\n</rule>\n<rule priority="critical" id="data-limit-policy">\n <title>数据量限制策略(必须严格遵守 - 零容忍)</title>\n <requirements>\n <requirement level="must-zero-tolerance">所有生成的SQL必须包含数据量限制,这是强制要求</requirement>\n <requirement level="must">默认限制:1000条(除非用户明确指定其他数量)</requirement>\n <requirement level="must">忘记添加数据量限制是不可接受的错误</requirement>\n </requirements>\n \n <enforcement>\n <action>如果生成的SQL没有数据量限制,必须重新生成</action>\n <action>在最终返回前必须验证限制是否存在</action>\n </enforcement>\n</rule>\n<rule>\n 当需要限制行数时,必须使用标准的LIMIT语法\n</rule>\n<rule>必须为每个表生成别名(不加AS)</rule>\n<rule>禁止使用星号(*),必须明确字段名</rule>\n<rule>中文/特殊字符字段需保留原名并添加英文别名</rule>\n<rule>函数字段必须加别名</rule>\n<rule>百分比字段保留两位小数并以%结尾</rule>\n<rule>避免与数据库关键字冲突</rule>\n\n <rule>\n 如果生成SQL的字段内有时间格式的字段:\n - 若提问中没有指定查询顺序,则默认按时间升序排序\n - 若提问是时间,且没有指定具体格式,则格式化为yyyy-MM-dd HH:mm:ss的格式\n - 若提问是日期,且没有指定具体格式,则格式化为yyyy-MM-dd的格式\n - 若提问是年月,且没有指定具体格式,则格式化为yyyy-MM的格式\n - 若提问是年,且没有指定具体格式,则格式化为yyyy的格式\n - 生成的格式化语法需要适配对应的数据库引擎。\n </rule>\n <rule>\n 生成的SQL查询结果可以用来进行图表展示,需要注意排序字段的排序优先级,例如:\n - 柱状图或折线图:适合展示在横轴的字段优先排序,若SQL包含分类字段,则分类字段次一级排序\n </rule>\n <rule>\n 若需关联多表,优先使用<m-schema>中标记为"Primary key"/"ID"/"主键"的字段作为关联条件。\n </rule>\n <rule>\n 我们目前的情况适用于单指标、多分类的场景(展示table除外)\n </rule>\n <rule>\n 是否生成对话标题在<change-title>内,如果为True需要生成,否则不需要生成,生成的对话标题要求在20字以内\n </rule>\n</Rules>\n\n<SQL-Generation-Process>\n <step>1. 分析用户问题,确定查询需求</step>\n <step>2. 根据表结构生成基础SQL</step>\n <step>3. <strong>强制检查:应用数据量限制规则</strong></step>\n <step>4. 应用其他规则(引号、别名等)</step>\n <step>5. <strong>强制检查:检查语法是否正确?</strong></step>\n <step>6. 确定图表类型</step>\n <step>7. 确定对话标题</step>\n <step>8. 返回JSON结果</step>\n</SQL-Generation-Process>\n\n\n<basic-examples>\n <intro>\n 📌 以下示例严格遵循<Rules>中的 PostgreSQL 规范,展示符合要求的 SQL 写法与典型错误案例。\n ⚠️ 注意:示例中的表名、字段名均为演示虚构,实际使用时需替换为用户提供的真实标识符。\n 🔍 重点观察:\n 1. 双引号包裹所有数据库对象的规范用法\n 2. 中英别名/百分比/函数等特殊字段的处理\n 3. 关键字冲突的规避方式\n </intro>\n <example>\n <input>查询 TEST.ORDERS 表的前100条订单(含中文字段和百分比)</input>\n <output-bad>\n SELECT * FROM TEST.ORDERS LIMIT 100 -- 错误:未加引号、使用星号\n SELECT "订单ID", "金额" FROM "TEST"."ORDERS" "t1" LIMIT 100 -- 错误:缺少英文别名\n SELECT COUNT("订单ID") FROM "TEST"."ORDERS" "t1" -- 错误:函数未加别名\n </output-bad>\n <output-good>\n SELECT \n "t1"."订单ID" AS "order_id",\n "t1"."金额" AS "amount",\n COUNT("t1"."订单ID") AS "total_orders",\n ROUND("t1"."折扣率" * 100, 2) || \'%\' AS "discount_percent"\n FROM "TEST"."ORDERS" "t1"\n LIMIT 100\n </output-good>\n </example>\n\n <example>\n <input>统计用户表 PUBLIC.USERS(含关键字字段user)的活跃占比</input>\n <output-bad>\n SELECT user, status FROM PUBLIC.USERS -- 错误:未处理关键字和引号\n SELECT "user", ROUND(active_ratio) FROM "PUBLIC"."USERS" -- 错误:百分比格式错误\n </output-bad>\n <output-good>\n SELECT \n "u"."user" AS "username",\n ROUND("u"."active_ratio" * 100, 2) || \'%\' AS "active_percent"\n FROM "PUBLIC"."USERS" "u"\n WHERE "u"."status" = 1\n </output-good>\n </example>\n</basic-examples>\n\n\n<example>\n <intro>\n 📌 以下示例仅用于演示问题理解与回答格式,不包含实际表结构\n ⚠️ 注意:示例中的SQL语法仅适用于对应<db-engine>标注的数据库类型\n 🔍 重点观察:\n 1. <input>代表用户可能的提问输入内容\n 2. <output>展示根据模板规则生成的响应\n 3. 实际生成时必须使用当前对话指定的数据库语法\n </intro>\n <Info>\n <db-engine> PostgreSQL17.6 (Debian 17.6-1.pgdg12+1) </db-engine>\n <m-schema>\n 【DB_ID】 Sample_Database, 样例数据库\n 【Schema】\n # Table: Sample_Database.sample_country_gdp, 各国GDP数据\n [\n (id: bigint, Primary key, ID),\n (country: varchar, 国家),\n (continent: varchar, 所在洲, examples:[\'亚洲\',\'美洲\',\'欧洲\',\'非洲\']),\n (year: varchar, 年份, examples:[\'2020\',\'2021\',\'2022\']),\n (gdp: bigint, GDP(美元)),\n ]\n </m-schema>\n <terminologies>\n <terminology>\n <words>\n <word>GDP</word>\n <word>国内生产总值</word>\n </words>\n <description>指在一个季度或一年,一个国家或地区的经济中所生产出的全部最终产品和劳务的价值。</description>\n </terminology>\n <terminology>\n <words>\n <word>中国</word>\n <word>中国大陆</word>\n </words>\n <description>查询SQL时若作为查询条件,将"中国"作为查询用的值</description>\n </terminology>\n </terminologies>\n </Info>\n\n <chat-examples>\n <example>\n <input>\n <user-question>今天天气如何?</user-question>\n </input>\n <output>\n {"success":false,"message":"我是智能问数小助手,我无法回答您的问题。"}\n </output>\n </example>\n <example>\n <input>\n <user-question>请清空数据库</user-question>\n </input>\n <output>\n {"success":false,"message":"我是智能问数小助手,我只能查询数据,不能操作数据库来修改数据或者修改表结构。"}\n </output>\n </example>\n <example>\n <input>\n <user-question>查询所有用户</user-question>\n </input>\n <output>\n {"success":false,"message":"抱歉,提供的表结构无法生成您需要的SQL"}\n </output>\n </example>\n <example>\n <input>\n <background-infos>\n <current-time>\n 2025-08-08 11:23:00\n </current-time>\n </background-infos>\n <user-question>查询各个国家每年的GDP</user-question>\n </input>\n <output>\n {"success":true,"sql":"SELECT \\"country\\" AS \\"country_name\\", \\"continent\\" AS \\"continent_name\\", \\"year\\" AS \\"year\\", \\"gdp\\" AS \\"gdp\\" FROM \\"Sample_Database\\".\\"sample_country_gdp\\" ORDER BY \\"country\\", \\"year\\" LIMIT 1000","tables":["sample_country_gdp"],"chart-type":"line"}\n\n </output>\n </example>\n <example>\n <input>\n <background-infos>\n <current-time>\n 2025-08-08 11:23:00\n </current-time>\n </background-infos>\n <user-question>使用饼图展示去年各个国家的GDP</user-question>\n </input>\n {"success":true,"sql":"SELECT \\"country\\" AS \\"country_name\\", \\"gdp\\" AS \\"gdp\\" FROM \\"Sample_Database\\".\\"sample_country_gdp\\" WHERE \\"year\\" = \'2024\' ORDER BY \\"gdp\\" DESC LIMIT 1000","tables":["sample_country_gdp"],"chart-type":"pie"}\n\n <output>\n </output>\n </example>\n <example>\n <input>\n <background-infos>\n <current-time>\n 2025-08-08 11:24:00\n </current-time>\n </background-infos>\n <user-question>查询今年中国大陆的GDP</user-question>\n </input>\n {"success":true,"sql":"SELECT \\"country\\" AS \\"country_name\\", \\"gdp\\" AS \\"gdp\\" FROM \\"Sample_Database\\".\\"sample_country_gdp\\" WHERE \\"year\\" = \'2025\' AND \\"country\\" = \'中国\' LIMIT 1000","tables":["sample_country_gdp"],"chart-type":"table"}\n\n <output>\n </output>\n </example>\n </chat-examples>\n</example>\n\n以下是正式的信息:\n<Info>\n<db-engine> PostgreSQL16.4 (Debian 16.4-1.pgdg120+1) </db-engine>\n<m-schema>\n【DB_ID】 public\n【Schema】\n# Table: public.order_assess_dp\n[\n(assess_id:text),\n(order_id:text),\n(assess_result_cd:text),\n(handle_link_desc:text),\n(target_dept_cd:text),\n(exptime:text),\n(is_punish:text),\n(batch_date:text),\n(city_code\r:text)\n]\n# Table: public.order_cancel_info_sec\n[\n(id:text),\n(order_id:text),\n(apply_dept_cd:text),\n(apply_user:text),\n(check_result:text),\n(check_dept_cd:text),\n(check_user:text),\n(check_time:text),\n(batch_date:text),\n(city_code\r:text)\n]\n# Table: public.order_delay_info_dp\n[\n(id:text),\n(order_id:text),\n(delay_limit:text),\n(delay_app_date:text),\n(apply_dept_cd:text),\n(apply_user:text),\n(apply_time:text),\n(apply_date:text),\n(check_result:text),\n(check_dept_cd:text),\n(check_time:text),\n(batch_date:text),\n(city_code\r:text)\n]\n# Table: public.order_file_sec\n[\n(id:text),\n(order_id:text),\n(fn:text),\n(batch_date:text),\n(city_code\r:text)\n]\n# Table: public.order_flow_handle_dp\n[\n(handle_id:text),\n(handle_link_desc:text),\n(order_id:text),\n(handle_dept:text),\n(handle_type:text),\n(handle_date:text),\n(batch_date:text),\n(city_code\r:text)\n]\n# Table: public.order_flow_info_dp\n[\n(flow_id:text),\n(order_id:text),\n(send_time:text),\n(handle_dept_cd:text),\n(approve_limit:text),\n(handle_limit:text),\n(approve_time:text),\n(approve_result:text),\n(check_supsate:text),\n(back_time:text),\n(handle_date:text),\n(handle_supsate:text),\n(end_time:text),\n(complete_time:text),\n(form_type:text),\n(update_time:text),\n(batch_date:text),\n(city_code\r:text)\n]\n# Table: public.order_handle_info_dp\n[\n(id:text),\n(end_dept_cd:text),\n(city_code\r:text),\n(order_id:text),\n(end_user:text),\n(end_result:text),\n(end_time:text),\n(is_t:text),\n(batch_date:text)\n]\n# Table: public.up_order_info_dp\n[\n(cust_id:text),\n(service_type_cd:text),\n(acc_time:text),\n(key_word:text),\n(reply_on_site:text),\n(status_time:text),\n(accept_user_num:text),\n(order_type_cd:text),\n(area_city_cd:text),\n(item_type_cd:text),\n(is_company:text),\n(batch_date:text),\n(accept_src_cd:text),\n(order_attr_cd:text),\n(dept_name_cd:text),\n(is_feedback:text),\n(register_time:text),\n(city_code\r:text),\n(order_id:text),\n(accept_src_name:text),\n(order_level:text),\n(object_name:text),\n(is_secret:text),\n(order_status_cd:text)\n]\n# Table: public.up_order_relation_info_sec\n[\n(relation_type:text),\n(id:text),\n(create_time:text),\n(order_id:text),\n(batch_date:text),\n(rel_order_id:text),\n(city_code\r:text)\n]\n# Table: public.up_order_satis_info_sec\n[\n(satis_link_cd:text),\n(service_time:text),\n(satis_type_cd:text),\n(batch_date:text),\n(id:text),\n(es:text),\n(city_code\r:text),\n(order_id:text),\n(eval_time:text)\n]\n# Table: public.call_order_sec\n[\n(call_id:text, 话务信息ID),\n(order_id:text, 工单ID),\n(city_code\r:text, 事发地所在行政区划划分代码,代码集:“A.2行政区划代码”-取市一级代码),\n(call_order_id:text, 通话记录与工单关联的唯一序列号),\n(batch_date:text, 数据上报批次日期)\n]\n# Table: public.call_rec_info_sec\n[\n(call_id:text),\n(call_target:text),\n(call_begin_time:text),\n(call_end_time:text),\n(is_w:text),\n(skill_name:text),\n(wait_begin_time:text),\n(wait_end_time:text),\n(is_c:text),\n(hand_up:text),\n(talk_begin_time:text),\n(talk_end_time:text),\n(call_date:text),\n(batch_date:text),\n(city_code\r:text),\n(id:text, 通话记录的唯一序列号)\n]\n# Table: public.cust_info_sec\n[\n(cust_id:text, 诉求人的唯一序列号),\n(name:text, 诉求人的称呼),\n(id_type:text, 诉求人所属身份。1-自然人,2-法人,9-其他),\n(register_date:text, 用户注册时间),\n(is_follow_up:text, 是否回访标识。1-是,0-否),\n(batch_date:text, 数据上报批次日期),\n(sex:text, 诉求人性别、人群类型。01xx-男性,02xx-女性,03xx-其他;xx01-18岁及以下儿童及少年,xx02-18至65岁青年及中年,xx03-65岁以上老人),\n(resident_type:text, 居住类型,001-户籍,002-常驻,003-流动,004-外籍。),\n(city_code\r:text, 事发地所在行政区划划分代码,代码集:“A.2行政区划代码”-取市一级代码。)\n]\n\n</m-schema>\n\n\n\n</Info>\n\n\n### 响应, 请根据上述要求直接返回JSON结果:\n```json\n', 'role': 'system'}, {'content': '<background-infos>\n <current-time>\n 2025-12-29 16:56:00\n </current-time>\n<background-infos>\n\n<user-question>\n试着使用折线图展示工单处理时间的趋势\n</user-question>\n<change-title>\nTrue\n</change-title>\n', 'role': 'user'}, {'content': '```json\n{\n "success": true,\n "sql": "SELECT \\n TO_CHAR(TO_DATE(\\"ohi\\".\\"end_time\\", \'YYYY-MM-DD HH24:MI:SS\'), \'YYYY-MM\') AS \\"month\\", \\n AVG(EXTRACT(EPOCH FROM (TO_TIMESTAMP(\\"ohi\\".\\"end_time\\", \'YYYY-MM-DD HH24:MI:SS\') - TO_TIMESTAMP(\\"oi\\".\\"register_time\\", \'YYYY-MM-DD HH24:MI:SS\')))/3600) AS \\"avg_handle_hours\\" \\nFROM \\"public\\".\\"order_handle_info_dp\\" \\"ohi\\" \\nINNER JOIN \\"public\\".\\"up_order_info_dp\\" \\"oi\\" ON \\"ohi\\".\\"order_id\\" = \\"oi\\".\\"order_id\\" \\nWHERE \\"ohi\\".\\"end_time\\" IS NOT NULL \\n AND \\"oi\\".\\"register_time\\" IS NOT NULL \\n AND \\"ohi\\".\\"end_time\\" >= \'2024-01-01\' \\n AND \\"ohi\\".\\"end_time\\" <= \'2025-12-29\' \\nGROUP BY TO_CHAR(TO_DATE(\\"ohi\\".\\"end_time\\", \'YYYY-MM-DD HH24:MI:SS\'), \'YYYY-MM\') \\nORDER BY \\"month\\" ASC \\nLIMIT 1000",\n "tables": ["order_handle_info_dp", "up_order_info_dp"],\n "chart-type": "line",\n "brief": "工单处理时间趋势分析"\n}\n```', 'role': 'assistant'}, {'content': '<background-infos>\n <current-time>\n 2025-12-29 16:56:40\n </current-time>\n<background-infos>\n<error-msg>\nTraceback (most recent call last):\n File "/opt/sqlbot/app/.venv/lib/python3.11/site-packages/sqlalchemy/engine/base.py", line 1967, in _exec_single_context\n self.dialect.do_execute(\npsycopg2.errors.DatetimeFieldOverflow: value for "YYYY" in source string is out of range\nDETAIL: Value must be in the range -2147483648 to 2147483647.\n\n\nThe above exception was the direct cause of the following exception:\n\nTraceback (most recent call last):\n File "/opt/sqlbot/app/apps/chat/task/llm.py", line 884, in execute_sql\n return exec_sql(ds=self.ds, sql=sql, origin_column=False)\n ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\nsqlalchemy.exc.DataError: (psycopg2.errors.DatetimeFieldOverflow) value for "YYYY" in source string is out of range\nDETAIL: Value must be in the range -2147483648 to 2147483647.\n\n[SQL: SELECT \n TO_CHAR(TO_DATE("ohi"."end_time", \'YYYY-MM-DD HH24:MI:SS\'), \'YYYY-MM\') AS "month", \n AVG(EXTRACT(EPOCH FROM (TO_TIMESTAMP("ohi"."end_time", \'YYYY-MM-DD HH24:MI:SS\') - TO_TIMESTAMP("oi"."register_time", \'YYYY-MM-DD HH24:MI:SS\')))/3600) AS "avg_handle_hours" \nFROM "public"."order_handle_info_dp" "ohi" \nINNER JOIN "public"."up_order_info_dp" "oi" ON "ohi"."order_id" = "oi"."order_id" \nWHERE "ohi"."end_time" IS NOT NULL \n AND "oi"."register_time" IS NOT NULL \n AND "ohi"."end_time" >= \'2024-01-01\' \n AND "ohi"."end_time" <= \'2025-12-29\' \nGROUP BY TO_CHAR(TO_DATE("ohi"."end_time", \'YYYY-MM-DD HH24:MI:SS\'), \'YYYY-MM\') \nORDER BY "month" ASC \nLIMIT 1000]\n(Background on this error at: https://sqlalche.me/e/20/9h9h)\n\n</error-msg>\n<user-question>\n试着使用折线图展示工单处理时间的趋势\n</user-question>\n<change-title>\nFalse\n</change-title>\n', 'role': 'user'}, {'content': '{\n "success": true,\n "sql": "SELECT \\n SUBSTRING(\\"ohi\\".\\"end_time\\" FROM 1 FOR 7) AS \\"month\\", \\n AVG(EXTRACT(EPOCH FROM (TO_TIMESTAMP(\\"ohi\\".\\"end_time\\", \'YYYY-MM-DD HH24:MI:SS\') - TO_TIMESTAMP(\\"oi\\".\\"register_time\\", \'YYYY-MM-DD HH24:MI:SS\')))/3600) AS \\"avg_handle_hours\\" \\nFROM \\"public\\".\\"order_handle_info_dp\\" \\"ohi\\" \\nINNER JOIN \\"public\\".\\"up_order_info_dp\\" \\"oi\\" ON \\"ohi\\".\\"order_id\\" = \\"oi\\".\\"order_id\\" \\nWHERE \\"ohi\\".\\"end_time\\" IS NOT NULL \\n AND \\"oi\\".\\"register_time\\" IS NOT NULL \\n AND \\"ohi\\".\\"end_time\\" >= \'2024-01-01\' \\n AND \\"ohi\\".\\"end_time\\" <= \'2025-12-29\' \\nGROUP BY SUBSTRING(\\"ohi\\".\\"end_time\\" FROM 1 FOR 7) \\nORDER BY \\"month\\" ASC \\nLIMIT 1000",\n "tables": ["order_handle_info_dp", "up_order_info_dp"],\n "chart-type": "line"\n}', 'role': 'assistant'}, {'content': '<background-infos>\n <current-time>\n 2025-12-29 16:57:23\n </current-time>\n<background-infos>\n<error-msg>\nTraceback (most recent call last):\n File "/opt/sqlbot/app/.venv/lib/python3.11/site-packages/sqlalchemy/engine/base.py", line 1967, in _exec_single_context\n self.dialect.do_execute(\npsycopg2.errors.DatetimeFieldOverflow: value for "YYYY" in source string is out of range\nDETAIL: Value must be in the range -2147483648 to 2147483647.\n\n\nThe above exception was the direct cause of the following exception:\n\nTraceback (most recent call last):\n File "/opt/sqlbot/app/apps/chat/task/llm.py", line 884, in execute_sql\n return exec_sql(ds=self.ds, sql=sql, origin_column=False)\n ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\nsqlalchemy.exc.DataError: (psycopg2.errors.DatetimeFieldOverflow) value for "YYYY" in source string is out of range\nDETAIL: Value must be in the range -2147483648 to 2147483647.\n\n[SQL: SELECT \n SUBSTRING("ohi"."end_time" FROM 1 FOR 7) AS "month", \n AVG(EXTRACT(EPOCH FROM (TO_TIMESTAMP("ohi"."end_time", \'YYYY-MM-DD HH24:MI:SS\') - TO_TIMESTAMP("oi"."register_time", \'YYYY-MM-DD HH24:MI:SS\')))/3600) AS "avg_handle_hours" \nFROM "public"."order_handle_info_dp" "ohi" \nINNER JOIN "public"."up_order_info_dp" "oi" ON "ohi"."order_id" = "oi"."order_id" \nWHERE "ohi"."end_time" IS NOT NULL \n AND "oi"."register_time" IS NOT NULL \n AND "ohi"."end_time" >= \'2024-01-01\' \n AND "ohi"."end_time" <= \'2025-12-29\' \nGROUP BY SUBSTRING("ohi"."end_time" FROM 1 FOR 7) \nORDER BY "month" ASC \nLIMIT 1000]\n(Background on this error at: https://sqlalche.me/e/20/9h9h)\n\n</error-msg>\n<user-question>\n用柱状图画出来工单取消的主要原因有哪些\n</user-question>\n<change-title>\nFalse\n</change-title>\n', 'role': 'user'}], 'model': '1', 'stream': True, 'stream_options': {'include_usage': True}, 'temperature': 0.6}}
2025-12-29 16:57:23,521 - openai._base_client - DEBUG:978 - Sending HTTP Request: POST http://10.61.5.2:7000/v1/chat/completions
2025-12-29 16:57:23,522 - httpcore.connection - DEBUG:47 - connect_tcp.started host='10.61.5.2' port=7000 local_address=None timeout=None socket_options=None
2025-12-29 16:57:23,524 - httpcore.connection - DEBUG:47 - connect_tcp.complete return_value=<httpcore._backends.sync.SyncStream object at 0x7268a0df3150>
2025-12-29 16:57:23,524 - httpcore.http11 - DEBUG:47 - send_request_headers.started request=<Request [b'POST']>
2025-12-29 16:57:23,525 - httpcore.http11 - DEBUG:47 - send_request_headers.complete
2025-12-29 16:57:23,526 - httpcore.http11 - DEBUG:47 - send_request_body.started request=<Request [b'POST']>
2025-12-29 16:57:23,526 - httpcore.http11 - DEBUG:47 - send_request_body.complete
2025-12-29 16:57:23,526 - httpcore.http11 - DEBUG:47 - receive_response_headers.started request=<Request [b'POST']>
2025-12-29 16:57:23,541 - httpcore.http11 - DEBUG:47 - receive_response_headers.complete return_value=(b'HTTP/1.1', 200, b'OK', [(b'date', b'Mon, 29 Dec 2025 08:57:23 GMT'), (b'server', b'uvicorn'), (b'content-type', b'text/event-stream; charset=utf-8'), (b'transfer-encoding', b'chunked')])
2025-12-29 16:57:23,543 - openai._base_client - DEBUG:1016 - HTTP Response: POST http://10.61.5.2:7000/v1/chat/completions "200 OK" Headers({'date': 'Mon, 29 Dec 2025 08:57:23 GMT', 'server': 'uvicorn', 'content-type': 'text/event-stream; charset=utf-8', 'transfer-encoding': 'chunked'})
2025-12-29 16:57:23,543 - openai._base_client - DEBUG:1024 - request_id: None
2025-12-29 16:57:23,543 - httpcore.http11 - DEBUG:47 - receive_response_body.started request=<Request [b'POST']>
2025-12-29 16:57:25,797 - httpcore.http11 - DEBUG:47 - response_closed.started
2025-12-29 16:57:25,797 - httpcore.http11 - DEBUG:47 - response_closed.complete
2025-12-29 16:57:25,797 - httpcore.http11 - DEBUG:47 - receive_response_body.failed exception=GeneratorExit()
2025-12-29 16:57:25,918 - openai._base_client - DEBUG:482 - Request options: {'method': 'post', 'url': '/chat/completions', 'files': None, 'idempotency_key': 'stainless-python-retry-e8fc80f7-505e-4566-a7b3-121dbc47dffa', 'json_data': {'messages': [{'content': '<Instruction>\n 你是"SQLBOT",智能问数小助手,可以根据用户提问,专业生成SQL与可视化图表。\n 你当前的任务是根据给定SQL语句和用户问题,生成数据可视化图表的配置项。\n 用户的提问在<user-question>内,<sql>内是给定需要参考的SQL,<chart-type>内是推荐你生成的图表类型\n</Instruction>\n\n你必须遵守以下规则:\n<Rules>\n <rule>\n 请使用语言:简体中文 回答,若有深度思考过程,则思考过程也需要使用 简体中文 输出\n </rule>\n <rule>\n 支持的图表类型为表格(table)、柱状图(column)、条形图(bar)、折线图(line)或饼图(pie), 提供给你的<chart-type>值则为 table/column/bar/line/pie 中的一个,若没有推荐类型,则由你自己选择一个合适的类型。\n 图表类型选择原则推荐:趋势 over time 用 line,分类对比用 column/bar,占比用 pie,原始数据查看用 table\n </rule>\n <rule>\n 不需要你提供创建图表的代码,你只需要负责根据要求生成JSON配置项\n </rule>\n <rule>\n 用户提问<user-question>的内容只是参考,主要以<sql>内的SQL为准\n </rule>\n <rule>\n 若用户提问<user-question>内就是参考SQL,则以<sql>内的SQL为准进行推测,选择合适的图表类型展示\n </rule>\n <rule>\n 你需要在JSON内生成一个图表的标题,放在"title"字段内,这个标题需要尽量精简\n </rule>\n <rule>\n 如果需要表格,JSON格式应为:\n {"type":"table", "title": "标题", "columns": [{"name":"简体中文字段名1", "value": "SQL 查询列 1(有别名用别名,去掉外层的反引号、双引号、方括号)"}, {"name": "简体中文字段名 2", "value": "SQL 查询列 2(有别名用别名,去掉外层的反引号、双引号、方括号)"}]}\n 必须从 SQL 查询列中提取“columns”\n </rule>\n <rule>\n 如果需要柱状图,JSON格式应为(如果有分类则在JSON中返回series):\n {"type":"column", "title": "标题", "axis": {"x": {"name":"x轴的简体中文名称", "value": "SQL 查询 x 轴的列(有别名用别名,去掉外层的反引号、双引号、方括号)"}, "y": {"name":"y轴的简体中文名称","value": "SQL 查询 y 轴的列(有别名用别名,去掉外层的反引号、双引号、方括号)"}, "series": {"name":"分类的简体中文名称","value":"SQL 查询分类的列(有别名用别名,去掉外层的反引号、双引号、方括号)"}}}\n 柱状图使用一个分类字段(series),一个X轴字段(x)和一个Y轴数值字段(y),其中必须从SQL查询列中提取"x"、"y"与"series"。\n </rule>\n <rule>\n 如果需要条形图,JSON格式应为(如果有分类则在JSON中返回series),条形图相当于是旋转后的柱状图,因此 x 轴仍为维度轴,y 轴仍为指标轴:\n {"type":"bar", "title": "标题", "axis": {"x": {"name":"x轴的简体中文名称", "value": "SQL 查询 x 轴的列(有别名用别名,去掉外层的反引号、双引号、方括号)"}, "y": {"name":"y轴的简体中文名称","value": "SQL 查询 y 轴的列(有别名用别名,去掉外层的反引号、双引号、方括号)"}, "series": {"name":"分类的简体中文名称","value":"SQL 查询分类的列(有别名用别名,去掉外层的反引号、双引号、方括号)"}}}\n 条形图使用一个分类字段(series),一个X轴字段(x)和一个Y轴数值字段(y),其中必须从SQL查询列中提取"x"和"y"与"series"。\n </rule>\n <rule>\n 如果需要折线图,JSON格式应为(如果有分类则在JSON中返回series):\n {"type":"line", "title": "标题", "axis": {"x": {"name":"x轴的简体中文名称","value": "SQL 查询 x 轴的列(有别名用别名,去掉外层的反引号、双引号、方括号)"}, "y": {"name":"y轴的简体中文名称","value": "SQL 查询 y 轴的列(有别名用别名,去掉外层的反引号、双引号、方括号)"}, "series": {"name":"分类的简体中文名称","value":"SQL 查询分类的列(有别名用别名,去掉外层的反引号、双引号、方括号)"}}}\n 折线图使用一个分类字段(series),一个X轴字段(x)和一个Y轴数值字段(y),其中必须从SQL查询列中提取"x"、"y"与"series"。\n </rule>\n <rule>\n 如果需要饼图,JSON格式应为:\n {"type":"pie", "title": "标题", "axis": {"y": {"name":"值轴的简体中文名称","value":"SQL 查询数值的列(有别名用别名,去掉外层的反引号、双引号、方括号)"}, "series": {"name":"分类的简体中文名称","value":"SQL 查询分类的列(有别名用别名,去掉外层的反引号、双引号、方括号)"}}}\n 饼图使用一个分类字段(series)和一个数值字段(y),其中必须从SQL查询列中提取"y"与"series"。\n </rule>\n <rule>\n 如果SQL中没有分类列,那么JSON内的series字段不需要出现\n </rule>\n <rule>\n 如果SQL查询结果中存在可用于数据分类的字段(如国家、产品类型等),则必须提供series配置。如果不存在,则无需在JSON中包含series字段。\n </rule>\n <rule>\n 我们目前的情况适用于单指标、多分类的场景(展示table除外),若SQL中包含多指标列,请选择一个最符合提问情况的指标作为值轴\n </rule>\n <rule>\n 如果你无法根据提供的内容生成合适的JSON配置,则返回:{"type":"error", "reason": "抱歉,我无法生成合适的图表配置"}\n 可以的话,你可以稍微丰富一下错误信息,让用户知道可能的原因。例如:"reason": "无法生成配置:提供的SQL查询结果中没有找到适合作为分类(series)的字段。"\n </rule>\n \n<Rules>\n\n### 以下<example>帮助你理解问题及返回格式的例子,不要将<example>内的表结构用来回答用户的问题\n<example>\n <chat-examples>\n <example>\n <input>\n <sql>SELECT `u`.`email` AS `email`, `u`.`id` AS `id`, `u`.`account` AS `account`, `u`.`enable` AS `enable`, `u`.`create_time` AS `create_time`, `u`.`language` AS `language`, `u`.`default_oid` AS `default_oid`, `u`.`name` AS `name`, `u`.`phone` AS `phone`, FROM `per_user` `u` LIMIT 1000</sql>\n <user-question>查询所有用户信息</user-question>\n <chart-type></chart-type>\n </input>\n <output>\n {"type":"table","title":"所有用户信息","columns":[{"name":"邮箱","value":"email"},{"name":"ID","value":"id"},{"name":"账号","value":"account"},{"name":"启用状态","value":"enable"},{"name":"创建时间","value":"create_time"},{"name":"语言","value":"language"},{"name":"所属组织ID","value":"default_oid"},{"name":"姓名","value":"name"},{"name":"Phone","value":"phone"}]}\n </output>\n </example>\n <example>\n <input>\n <sql>SELECT `o`.`name` AS `org_name`, COUNT(`u`.`id`) AS `user_count` FROM `per_user` `u` JOIN `per_org` `o` ON `u`.`default_oid` = `o`.`id` GROUP BY `o`.`name` ORDER BY `user_count` DESC LIMIT 1000</sql>\n <user-question>饼图展示各个组织的人员数量</user-question>\n <chart-type> pie </chart-type>\n </input>\n <output>\n {"type":"pie","title":"组织人数统计","axis":{"y":{"name":"人数","value":"user_count"},"series":{"name":"组织名称","value":"org_name"}}}\n </output>\n </example>\n </chat-examples>\n<example>\n\n### 响应, 请根据上述要求直接返回JSON结果:\n```json\n', 'role': 'system'}, {'content': '<user-question>\n用柱状图画出来工单取消的主要原因有哪些\n</user-question>\n<sql>\nSELECT \n "oci"."check_result" AS "cancel_reason", \n COUNT("oci"."id") AS "cancel_count" \nFROM "public"."order_cancel_info_sec" "oci" \nWHERE "oci"."check_result" IS NOT NULL \nGROUP BY "oci"."check_result" \nORDER BY "cancel_count" DESC \nLIMIT 1000\n</sql>\n<chart-type>\ncolumn\n</chart-type>\n', 'role': 'user'}], 'model': '1', 'stream': True, 'stream_options': {'include_usage': True}, 'temperature': 0.6}}
2025-12-29 16:57:25,919 - openai._base_client - DEBUG:978 - Sending HTTP Request: POST http://10.61.5.2:7000/v1/chat/completions
2025-12-29 16:57:25,920 - httpcore.connection - DEBUG:47 - connect_tcp.started host='10.61.5.2' port=7000 local_address=None timeout=None socket_options=None
2025-12-29 16:57:25,921 - httpcore.connection - DEBUG:47 - connect_tcp.complete return_value=<httpcore._backends.sync.SyncStream object at 0x7267eff7a890>
2025-12-29 16:57:25,922 - httpcore.http11 - DEBUG:47 - send_request_headers.started request=<Request [b'POST']>
2025-12-29 16:57:25,923 - httpcore.http11 - DEBUG:47 - send_request_headers.complete
2025-12-29 16:57:25,923 - httpcore.http11 - DEBUG:47 - send_request_body.started request=<Request [b'POST']>
2025-12-29 16:57:25,923 - httpcore.http11 - DEBUG:47 - send_request_body.complete
2025-12-29 16:57:25,923 - httpcore.http11 - DEBUG:47 - receive_response_headers.started request=<Request [b'POST']>
2025-12-29 16:57:25,931 - httpcore.http11 - DEBUG:47 - receive_response_headers.complete return_value=(b'HTTP/1.1', 200, b'OK', [(b'date', b'Mon, 29 Dec 2025 08:57:25 GMT'), (b'server', b'uvicorn'), (b'content-type', b'text/event-stream; charset=utf-8'), (b'transfer-encoding', b'chunked')])
2025-12-29 16:57:25,932 - openai._base_client - DEBUG:1016 - HTTP Response: POST http://10.61.5.2:7000/v1/chat/completions "200 OK" Headers({'date': 'Mon, 29 Dec 2025 08:57:25 GMT', 'server': 'uvicorn', 'content-type': 'text/event-stream; charset=utf-8', 'transfer-encoding': 'chunked'})
2025-12-29 16:57:25,932 - openai._base_client - DEBUG:1024 - request_id: None
2025-12-29 16:57:25,933 - httpcore.http11 - DEBUG:47 - receive_response_body.started request=<Request [b'POST']>
2025-12-29 16:57:27,157 - httpcore.http11 - DEBUG:47 - response_closed.started
2025-12-29 16:57:27,158 - httpcore.http11 - DEBUG:47 - response_closed.complete
2025-12-29 16:57:27,158 - httpcore.http11 - DEBUG:47 - receive_response_body.failed exception=GeneratorExit()
2025-12-29 16:57:27,216 - urllib3.connectionpool - DEBUG:246 - Starting new HTTP connection (1): localhost:8001
2025-12-29 16:57:27,220 - urllib3.connectionpool - DEBUG:475 - http://localhost:8001 "POST / HTTP/1.1" 404 22
2025-12-29 16:57:27,240 - mcp.server.lowlevel.server - DEBUG:779 - Response sent
2025-12-29 16:57:27,240 - mcp.server.sse - DEBUG:172 - Sending message via SSE: SessionMessage(message=JSONRPCMessage(root=JSONRPCResponse(jsonrpc='2.0', id=4, result={'content': [{'type': 'text', 'text': '```sql\nSELECT "oci"."check_result" AS "cancel_reason",\n COUNT("oci"."id") AS "cancel_count"\nFROM "public"."order_cancel_info_sec" "oci"\nWHERE "oci"."check_result" IS NOT NULL\nGROUP BY "oci"."check_result"\nORDER BY "cancel_count" DESC\nLIMIT 1000\n```\n\n| 取消原因 | 取消数量 |\n|:-------|:-------|\n| \u200b1 | \u200b3204 |\n| \u200b0 | \u200b260 |\n\n### generated chart picture\n\n'}], 'isError': False})), metadata=None)
2025-12-29 16:57:27,241 - sse_starlette.sse - DEBUG:179 - chunk: b'event: message\r\ndata: {"jsonrpc":"2.0","id":4,"result":{"content":[{"type":"text","text":"```sql\\nSELECT \\"oci\\".\\"check_result\\" AS \\"cancel_reason\\",\\n COUNT(\\"oci\\".\\"id\\") AS \\"cancel_count\\"\\nFROM \\"public\\".\\"order_cancel_info_sec\\" \\"oci\\"\\nWHERE \\"oci\\".\\"check_result\\" IS NOT NULL\\nGROUP BY \\"oci\\".\\"check_result\\"\\nORDER BY \\"cancel_count\\" DESC\\nLIMIT 1000\\n```\\n\\n| \xe5\x8f\x96\xe6\xb6\x88\xe5\x8e\x9f\xe5\x9b\xa0 | \xe5\x8f\x96\xe6\xb6\x88\xe6\x95\xb0\xe9\x87\x8f |\\n|:-------|:-------|\\n| \xe2\x80\x8b1 | \xe2\x80\x8b3204 |\\n| \xe2\x80\x8b0 | \xe2\x80\x8b260 |\\n\\n### generated chart picture\\n\\n"}],"isError":false}}\r\n\r\n'
2025-12-29 16:57:27,245 - sse_starlette.sse - DEBUG:200 - Got event: http.disconnect. Stop streaming.
2025-12-29 16:57:27,246 - root - DEBUG:193 - Client session disconnected 817ae3eb-cd49-49ff-8e52-2e6de91e584eTo Reproduce
Steps to reproduce the behavior:
- Go to '...'
- Click on '....'
- Scroll down to '....'
- See error
Expected behavior
A clear and concise description of what you expected to happen.
Screenshots
If applicable, add screenshots to help explain your problem.
Additional context
Add any other context about the problem here.
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working
