@@ -220,6 +232,9 @@ const logout = async () => {
+
+
+
diff --git a/frontend/src/i18n/en.json b/frontend/src/i18n/en.json
index bb7208c46..f4a3ef248 100644
--- a/frontend/src/i18n/en.json
+++ b/frontend/src/i18n/en.json
@@ -877,7 +877,9 @@
"FILTER_SQL_EXAMPLE": "Match SQL Examples",
"FILTER_CUSTOM_PROMPT": "Match Custom Prompts",
"EXECUTE_SQL": "Execute SQL",
- "GENERATE_PICTURE": "Generate Picture"
+ "GENERATE_PICTURE": "Generate Picture",
+ "ANALYSIS_PLAN": "Plan Analysis Calculations",
+ "ANALYSIS_QUERY": "Execute Analysis SQL"
},
"log_system": "Conversation Template",
"log_question": "Current Question",
@@ -1057,5 +1059,27 @@
"create": "Create",
"to_doc": "View API",
"trigger_limit": "Supports up to {0} API Keys"
+ },
+ "agent_token": {
+ "title": "Agent tokens",
+ "info_tips": "Agent tokens let external agents such as Claude or Codex query data through sqlbot-mcp. They act with your identity and permissions and can only call sqlbot-mcp query tools. A token is shown only once when created; keep it safe and disable or delete it immediately if it leaks.",
+ "create": "Create token",
+ "name": "Name",
+ "name_placeholder": "e.g. My Claude",
+ "name_required": "Enter a token name",
+ "token": "Token",
+ "scope": "Datasources",
+ "scope_all": "All datasources I can access",
+ "scope_selected": "Selected datasources only",
+ "datasource_placeholder": "Select datasources",
+ "datasource_required": "Select at least one datasource",
+ "last_used": "Last used",
+ "never_used": "Never",
+ "trigger_limit": "You can create at most {0} agent tokens",
+ "delete_confirm": "Agents using this token will lose access immediately. Delete token {msg}?",
+ "created_title": "Token created",
+ "created_tip": "Copy and store the token now. It will not be shown again:",
+ "claude_config": "Add the MCP server in Claude Code:",
+ "done": "I have saved it"
}
}
diff --git a/frontend/src/i18n/ko-KR.json b/frontend/src/i18n/ko-KR.json
index e6d863bae..00908199e 100644
--- a/frontend/src/i18n/ko-KR.json
+++ b/frontend/src/i18n/ko-KR.json
@@ -877,7 +877,9 @@
"FILTER_SQL_EXAMPLE": "SQL 예시 매칭",
"FILTER_CUSTOM_PROMPT": "사용자 정의 프롬프트 매칭",
"EXECUTE_SQL": "SQL 실행",
- "GENERATE_PICTURE": "이미지 생성"
+ "GENERATE_PICTURE": "이미지 생성",
+ "ANALYSIS_PLAN": "분석 계산 계획",
+ "ANALYSIS_QUERY": "분석 계산 SQL 실행"
},
"log_system": "대화 템플릿",
"log_question": "현재 질문",
@@ -1057,5 +1059,27 @@
"create": "생성",
"to_doc": "API 보기",
"trigger_limit": "최대 {0}개의 API 키 생성 지원"
+ },
+ "agent_token": {
+ "title": "에이전트 토큰",
+ "info_tips": "에이전트 토큰을 사용하면 Claude, Codex 같은 외부 에이전트가 sqlbot-mcp로 데이터를 조회할 수 있습니다. 토큰은 사용자의 신원과 권한으로 동작하며 sqlbot-mcp 조회 도구만 호출할 수 있습니다. 토큰은 생성할 때 한 번만 표시되므로 안전하게 보관하고, 유출되면 즉시 비활성화하거나 삭제하세요.",
+ "create": "토큰 생성",
+ "name": "이름",
+ "name_placeholder": "예: 내 Claude",
+ "name_required": "토큰 이름을 입력하세요",
+ "token": "토큰",
+ "scope": "데이터 소스 범위",
+ "scope_all": "내가 접근할 수 있는 모든 데이터 소스",
+ "scope_selected": "선택한 데이터 소스만",
+ "datasource_placeholder": "데이터 소스 선택",
+ "datasource_required": "데이터 소스를 하나 이상 선택하세요",
+ "last_used": "마지막 사용",
+ "never_used": "사용 기록 없음",
+ "trigger_limit": "에이전트 토큰은 최대 {0}개까지 만들 수 있습니다",
+ "delete_confirm": "이 토큰을 사용하는 에이전트는 즉시 접근할 수 없게 됩니다. 토큰 {msg}을(를) 삭제할까요?",
+ "created_title": "토큰이 생성되었습니다",
+ "created_tip": "지금 토큰을 복사해 보관하세요. 다시 표시되지 않습니다:",
+ "claude_config": "Claude Code에 MCP 서버 추가:",
+ "done": "저장했습니다"
}
}
diff --git a/frontend/src/i18n/th-TH.json b/frontend/src/i18n/th-TH.json
index a1fa56236..715235060 100644
--- a/frontend/src/i18n/th-TH.json
+++ b/frontend/src/i18n/th-TH.json
@@ -877,7 +877,9 @@
"FILTER_SQL_EXAMPLE": "จับคู่ตัวอย่าง SQL",
"FILTER_CUSTOM_PROMPT": "จับคู่พรอมป์ต์ที่กำหนดเอง",
"EXECUTE_SQL": "ดำเนินการ SQL",
- "GENERATE_PICTURE": "สร้างรูปภาพ"
+ "GENERATE_PICTURE": "สร้างรูปภาพ",
+ "ANALYSIS_PLAN": "วางแผนการคำนวณเพื่อวิเคราะห์",
+ "ANALYSIS_QUERY": "รัน SQL คำนวณเพื่อวิเคราะห์"
},
"log_system": "เทมเพลตบทสนทนา",
"log_question": "คำถามครั้งนี้",
@@ -1057,5 +1059,27 @@
"create": "สร้าง",
"to_doc": "ดู API",
"trigger_limit": "รองรับการสร้าง API Key ได้สูงสุด {0} คีย์"
+ },
+ "agent_token": {
+ "title": "โทเค็นเอเจนต์",
+ "info_tips": "โทเค็นเอเจนต์ช่วยให้เอเจนต์ภายนอก เช่น Claude หรือ Codex สืบค้นข้อมูลผ่าน sqlbot-mcp โดยใช้ตัวตนและสิทธิ์ของคุณ และเรียกได้เฉพาะเครื่องมือสืบค้นของ sqlbot-mcp โทเค็นจะแสดงเพียงครั้งเดียวตอนสร้าง โปรดเก็บรักษาให้ปลอดภัย และปิดใช้งานหรือลบทันทีหากรั่วไหล",
+ "create": "สร้างโทเค็น",
+ "name": "ชื่อ",
+ "name_placeholder": "เช่น Claude ของฉัน",
+ "name_required": "กรุณาระบุชื่อโทเค็น",
+ "token": "โทเค็น",
+ "scope": "ขอบเขตแหล่งข้อมูล",
+ "scope_all": "แหล่งข้อมูลทั้งหมดที่ฉันเข้าถึงได้",
+ "scope_selected": "เฉพาะแหล่งข้อมูลที่เลือก",
+ "datasource_placeholder": "เลือกแหล่งข้อมูล",
+ "datasource_required": "เลือกแหล่งข้อมูลอย่างน้อยหนึ่งรายการ",
+ "last_used": "ใช้ล่าสุด",
+ "never_used": "ยังไม่เคยใช้",
+ "trigger_limit": "สร้างโทเค็นเอเจนต์ได้สูงสุด {0} รายการ",
+ "delete_confirm": "เอเจนต์ที่ใช้โทเค็นนี้จะเข้าถึงไม่ได้ทันที ต้องการลบโทเค็น {msg} หรือไม่",
+ "created_title": "สร้างโทเค็นแล้ว",
+ "created_tip": "คัดลอกและเก็บโทเค็นไว้ตอนนี้ ระบบจะไม่แสดงอีก:",
+ "claude_config": "เพิ่มเซิร์ฟเวอร์ MCP ใน Claude Code:",
+ "done": "บันทึกแล้ว"
}
}
diff --git a/frontend/src/i18n/zh-CN.json b/frontend/src/i18n/zh-CN.json
index 65398fb38..58b7f8262 100644
--- a/frontend/src/i18n/zh-CN.json
+++ b/frontend/src/i18n/zh-CN.json
@@ -877,7 +877,9 @@
"FILTER_SQL_EXAMPLE": "匹配 SQL 示例",
"FILTER_CUSTOM_PROMPT": "匹配自定义提示词",
"EXECUTE_SQL": "执行 SQL",
- "GENERATE_PICTURE": "生成图片"
+ "GENERATE_PICTURE": "生成图片",
+ "ANALYSIS_PLAN": "规划分析计算",
+ "ANALYSIS_QUERY": "执行分析计算 SQL"
},
"log_system": "对话模板",
"log_question": "本次提问",
@@ -1057,5 +1059,27 @@
"create": "创建",
"to_doc": "查看 API",
"trigger_limit": "最多支持创建 {0} 个 API Key"
+ },
+ "agent_token": {
+ "title": "Agent 令牌",
+ "info_tips": "Agent 令牌供 Claude、Codex 等外部 Agent 通过 sqlbot-mcp 查询数据,以你的身份和权限访问,只能调用 sqlbot-mcp 的查询工具。令牌只在创建时显示一次,请妥善保管;泄露后请立即停用或删除。",
+ "create": "创建令牌",
+ "name": "名称",
+ "name_placeholder": "例如:我的 Claude",
+ "name_required": "请输入令牌名称",
+ "token": "令牌",
+ "scope": "数据源范围",
+ "scope_all": "跟随我的全部数据源权限",
+ "scope_selected": "仅限选定的数据源",
+ "datasource_placeholder": "选择数据源",
+ "datasource_required": "请至少选择一个数据源",
+ "last_used": "最近使用",
+ "never_used": "从未使用",
+ "trigger_limit": "最多支持创建 {0} 个 Agent 令牌",
+ "delete_confirm": "删除后使用该令牌的 Agent 将立即无法访问,是否删除令牌:{msg}?",
+ "created_title": "令牌已创建",
+ "created_tip": "请立即复制并保存令牌,关闭后将无法再次查看:",
+ "claude_config": "在 Claude Code 中添加 MCP:",
+ "done": "我已保存"
}
}
diff --git a/frontend/src/i18n/zh-TW.json b/frontend/src/i18n/zh-TW.json
index b2a472180..43f6c455f 100644
--- a/frontend/src/i18n/zh-TW.json
+++ b/frontend/src/i18n/zh-TW.json
@@ -877,7 +877,9 @@
"FILTER_SQL_EXAMPLE": "匹配 SQL 範例",
"FILTER_CUSTOM_PROMPT": "匹配自訂提示詞",
"EXECUTE_SQL": "執行 SQL",
- "GENERATE_PICTURE": "產生圖片"
+ "GENERATE_PICTURE": "產生圖片",
+ "ANALYSIS_PLAN": "規劃分析計算",
+ "ANALYSIS_QUERY": "執行分析計算 SQL"
},
"log_system": "對話範本",
"log_question": "本次提問",
@@ -1057,5 +1059,27 @@
"create": "建立",
"to_doc": "檢視 API",
"trigger_limit": "最多支援建立 {0} 個 API Key"
+ },
+ "agent_token": {
+ "title": "Agent 權杖",
+ "info_tips": "Agent 權杖供 Claude、Codex 等外部 Agent 透過 sqlbot-mcp 查詢資料,以你的身分和權限存取,只能呼叫 sqlbot-mcp 的查詢工具。權杖只在建立時顯示一次,請妥善保管;外洩後請立即停用或刪除。",
+ "create": "建立權杖",
+ "name": "名稱",
+ "name_placeholder": "例如:我的 Claude",
+ "name_required": "請輸入權杖名稱",
+ "token": "權杖",
+ "scope": "資料來源範圍",
+ "scope_all": "跟隨我的全部資料來源權限",
+ "scope_selected": "僅限選定的資料來源",
+ "datasource_placeholder": "選擇資料來源",
+ "datasource_required": "請至少選擇一個資料來源",
+ "last_used": "最近使用",
+ "never_used": "從未使用",
+ "trigger_limit": "最多支援建立 {0} 個 Agent 權杖",
+ "delete_confirm": "刪除後使用該權杖的 Agent 將立即無法存取,是否刪除權杖:{msg}?",
+ "created_title": "權杖已建立",
+ "created_tip": "請立即複製並保存權杖,關閉後將無法再次查看:",
+ "claude_config": "在 Claude Code 中新增 MCP:",
+ "done": "我已保存"
}
}
diff --git a/frontend/src/views/chat/ExecutionDetails.vue b/frontend/src/views/chat/ExecutionDetails.vue
index 81b2e1bd7..2bd652aa9 100644
--- a/frontend/src/views/chat/ExecutionDetails.vue
+++ b/frontend/src/views/chat/ExecutionDetails.vue
@@ -134,7 +134,11 @@ defineExpose({
:item="ele"
:error="error"
/>
-
+
+ reasoningName:
+ | 'sql_answer'
+ | 'chart_answer'
+ | 'analysis_thinking'
+ | Array<'sql_answer' | 'chart_answer' | 'analysis_thinking'>
}>(),
{
recordId: undefined,
@@ -120,6 +125,8 @@ const sendMessage = async () => {
let sql_answer = ''
let chart_answer = ''
+ let analysis_answer = ''
+ let analysis_answer_thinking = ''
let tempResult = ''
@@ -211,6 +218,15 @@ const sendMessage = async () => {
case 'chart':
_currentChat.value.records[index.value].chart = data.content
break
+ case 'analysis-result':
+ analysis_answer += data.content ?? ''
+ analysis_answer_thinking += data.reasoning_content ?? ''
+ _currentChat.value.records[index.value].analysis = analysis_answer
+ _currentChat.value.records[index.value].analysis_thinking = analysis_answer_thinking
+ break
+ case 'analysis-error':
+ _currentChat.value.records[index.value].analysis = data.content
+ break
case 'datasource':
if (!_currentChat.value.datasource) {
_currentChat.value.datasource = data.id
@@ -291,6 +307,11 @@ defineExpose({ sendMessage, index: () => index.value, stop })
:record-id="recordId"
:loading-data="loadingData"
/>
+
diff --git a/frontend/src/views/chat/chat-block/ChartBlock.vue b/frontend/src/views/chat/chat-block/ChartBlock.vue
index 25493fadf..f2b2a4df3 100644
--- a/frontend/src/views/chat/chat-block/ChartBlock.vue
+++ b/frontend/src/views/chat/chat-block/ChartBlock.vue
@@ -153,6 +153,19 @@ const chartType = computed({
},
})
+// 表格的单元格和表头固定 30px 一行(S2 默认值);行数少时按内容收缩高度,避免大片空白
+const TABLE_ROW_HEIGHT = 30
+const TABLE_EXTRA_SPACE = 18 // 边框和横向滚动条的空间
+const CHART_BLOCK_HEIGHT = 352
+const chartBlockStyle = computed(() => {
+ const rowCount = data.value?.length ?? 0
+ if (props.enlarge || chartType.value !== 'table' || rowCount === 0) {
+ return undefined
+ }
+ const contentHeight = (rowCount + 1) * TABLE_ROW_HEIGHT + TABLE_EXTRA_SPACE
+ return { height: `${Math.min(contentHeight, CHART_BLOCK_HEIGHT)}px` }
+})
+
const chartTypeList = computed(() => {
const _list = []
if (chartObject.value) {
@@ -610,7 +623,7 @@ function getBaseAxis() {