@axiom-lattice/examples-deep_research 1.0.31 → 1.0.33
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.env +6 -4
- package/.turbo/turbo-build.log +5 -5
- package/CHANGELOG.md +21 -0
- package/dist/index.js +13 -5
- package/dist/index.js.map +1 -1
- package/package.json +5 -5
- package/prompts/dashboard-generation.md +364 -0
- package/prompts/data-analyst.md +20 -0
- package/prompts/data-query.md +147 -7
- package/prompts/report-writer.md +121 -57
- package/prompts/team-lead.md +1029 -493
- package/src/agents/data_agent/skills/dashboard-generation/SKILL.md +370 -0
- package/src/index.ts +19 -5
- package/src/index-with-auth.ts +0 -122
|
@@ -0,0 +1,364 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: dashboard-generation
|
|
3
|
+
description: Generate comprehensive data visualization dashboards with multiple charts, executive summaries, and key insights. Use when creating multi-chart dashboards, executive overview reports, or business intelligence visualizations that require combining trend analysis, comparisons, and KPI monitoring in a single view.
|
|
4
|
+
metadata:
|
|
5
|
+
category: data_visualization
|
|
6
|
+
author: axiom-lattice
|
|
7
|
+
version: "1.0"
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
## When to Use This Skill
|
|
11
|
+
|
|
12
|
+
Activate this skill when the user needs:
|
|
13
|
+
- **Multi-chart dashboards**: Combining 4-8 related charts in a single view
|
|
14
|
+
- **Executive summaries**: High-level KPI overview with visual context
|
|
15
|
+
- **Business intelligence**: Comprehensive data views for decision making
|
|
16
|
+
- **Trend + comparison + distribution**: Multiple analysis types in one report
|
|
17
|
+
|
|
18
|
+
**Do NOT use for:**
|
|
19
|
+
- Single chart generation (use chart-markdown skill instead)
|
|
20
|
+
- Detailed written reports (use report-writer skill instead)
|
|
21
|
+
- Simple data tables without visualization
|
|
22
|
+
|
|
23
|
+
---
|
|
24
|
+
|
|
25
|
+
## Dashboard Types
|
|
26
|
+
|
|
27
|
+
### Executive Dashboard
|
|
28
|
+
**Purpose**: High-level business overview for leadership
|
|
29
|
+
- 4-6 KPI cards with trends
|
|
30
|
+
- 2-3 trend charts for main metrics
|
|
31
|
+
- 1-2 comparison charts
|
|
32
|
+
- Key findings summary
|
|
33
|
+
|
|
34
|
+
### Operational Dashboard
|
|
35
|
+
**Purpose**: Day-to-day monitoring for operations teams
|
|
36
|
+
- Real-time or near-real-time metrics
|
|
37
|
+
- Status indicators and progress tracking
|
|
38
|
+
- Detailed breakdowns by operational dimensions
|
|
39
|
+
- Alert thresholds and anomalies
|
|
40
|
+
|
|
41
|
+
### Analytical Dashboard
|
|
42
|
+
**Purpose**: Deep-dive analysis for data analysts
|
|
43
|
+
- Multiple trend charts with different granularities
|
|
44
|
+
- Correlation and distribution charts
|
|
45
|
+
- Segment analysis
|
|
46
|
+
- Drill-down capabilities
|
|
47
|
+
|
|
48
|
+
---
|
|
49
|
+
|
|
50
|
+
## Dashboard Structure
|
|
51
|
+
|
|
52
|
+
### Required Sections
|
|
53
|
+
|
|
54
|
+
1. **Executive Summary**
|
|
55
|
+
- KPI overview table (4-6 key metrics)
|
|
56
|
+
- Critical findings (3-5 bullet points)
|
|
57
|
+
- Status indicators (✅ 🟢 🟡 🔴)
|
|
58
|
+
|
|
59
|
+
2. **Chart Sections** (2-4 sections)
|
|
60
|
+
- Each section contains 1-3 related charts
|
|
61
|
+
- Group by theme (e.g., "Performance Overview", "Regional Analysis")
|
|
62
|
+
- Charts must include brief insights
|
|
63
|
+
|
|
64
|
+
3. **Key Findings Summary**
|
|
65
|
+
- Major wins
|
|
66
|
+
- Areas of concern
|
|
67
|
+
- Recommended actions
|
|
68
|
+
|
|
69
|
+
4. **Data Sources**
|
|
70
|
+
- Reference to input files
|
|
71
|
+
- Last updated timestamp
|
|
72
|
+
|
|
73
|
+
---
|
|
74
|
+
|
|
75
|
+
## Chart Generation
|
|
76
|
+
|
|
77
|
+
**Important**: For detailed chart generation guidelines, syntax, and best practices, reference the `chart-markdown` skill.
|
|
78
|
+
|
|
79
|
+
### Quick Reference
|
|
80
|
+
|
|
81
|
+
| Purpose | Chart Type | Skill Reference |
|
|
82
|
+
|---------|-----------|----------------|
|
|
83
|
+
| Time trends | Line chart | `chart-markdown` - Line Charts |
|
|
84
|
+
| Category comparison | Bar chart | `chart-markdown` - Bar Charts |
|
|
85
|
+
| Composition | Pie/Donut | `chart-markdown` - Composition Charts |
|
|
86
|
+
| Distribution | Histogram | `chart-markdown` - Distribution Charts |
|
|
87
|
+
| Correlation | Scatter plot | `chart-markdown` - Correlation Charts |
|
|
88
|
+
| Progress tracking | Progress bar | `chart-markdown` - Progress Indicators |
|
|
89
|
+
|
|
90
|
+
### Chart Guidelines
|
|
91
|
+
- Use `chart-markdown` skill for all chart syntax and formatting rules
|
|
92
|
+
- Maximum 8 charts per dashboard
|
|
93
|
+
- Group related charts into 2-4 sections
|
|
94
|
+
- Prioritize important metrics at the top
|
|
95
|
+
|
|
96
|
+
---
|
|
97
|
+
|
|
98
|
+
## Output Format
|
|
99
|
+
|
|
100
|
+
### File Path
|
|
101
|
+
`/artifacts/dashboard-{topic}.md`
|
|
102
|
+
|
|
103
|
+
### Structure Template
|
|
104
|
+
|
|
105
|
+
```markdown
|
|
106
|
+
# [Dashboard Title]
|
|
107
|
+
|
|
108
|
+
**Dashboard Type:** [Executive/Operational/Analytical]
|
|
109
|
+
**Generated Date:** [Date]
|
|
110
|
+
**Data Period:** [Start] to [End]
|
|
111
|
+
**Data Source:** `/tmp/data-{topic}.md`
|
|
112
|
+
|
|
113
|
+
---
|
|
114
|
+
|
|
115
|
+
## Executive Summary
|
|
116
|
+
|
|
117
|
+
### Key Metrics Overview
|
|
118
|
+
|
|
119
|
+
| Metric | Current | Change | Status | Trend |
|
|
120
|
+
|--------|---------|--------|--------|-------|
|
|
121
|
+
| [Metric 1] | [Value] | [Change] | [Status] | [Trend] |
|
|
122
|
+
| [Metric 2] | [Value] | [Change] | [Status] | [Trend] |
|
|
123
|
+
|
|
124
|
+
### Critical Findings
|
|
125
|
+
|
|
126
|
+
1. **[Finding 1]**: [Description with data]
|
|
127
|
+
2. **[Finding 2]**: [Description with data]
|
|
128
|
+
3. **[Finding 3]**: [Description with data]
|
|
129
|
+
|
|
130
|
+
---
|
|
131
|
+
|
|
132
|
+
## Section 1: [Theme Name]
|
|
133
|
+
|
|
134
|
+
### Chart 1.1: [Chart Title]
|
|
135
|
+
|
|
136
|
+
```chart
|
|
137
|
+
{
|
|
138
|
+
"table": [["Category", "Value"], ["A", 10], ["B", 20]],
|
|
139
|
+
"echarts": {
|
|
140
|
+
"title": {"text": "Chart Title"},
|
|
141
|
+
"tooltip": {"trigger": "axis"},
|
|
142
|
+
"xAxis": {"type": "category", "data": ["A", "B"]},
|
|
143
|
+
"yAxis": {"type": "value"},
|
|
144
|
+
"series": [{"type": "bar", "data": [10, 20]}]
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
**Key Insights:**
|
|
150
|
+
- [Insight 1]
|
|
151
|
+
- [Insight 2]
|
|
152
|
+
|
|
153
|
+
---
|
|
154
|
+
|
|
155
|
+
## Key Findings Summary
|
|
156
|
+
|
|
157
|
+
### Major Wins
|
|
158
|
+
- [Win 1]
|
|
159
|
+
- [Win 2]
|
|
160
|
+
|
|
161
|
+
### Areas of Concern
|
|
162
|
+
- [Concern 1]
|
|
163
|
+
- [Concern 2]
|
|
164
|
+
|
|
165
|
+
### Recommended Actions
|
|
166
|
+
1. **[Priority]**: [Action]
|
|
167
|
+
2. **[Priority]**: [Action]
|
|
168
|
+
|
|
169
|
+
---
|
|
170
|
+
|
|
171
|
+
## Data Sources
|
|
172
|
+
|
|
173
|
+
- **Primary:** `/tmp/data-{topic}.md`
|
|
174
|
+
- **Analysis:** `/tmp/insight-{topic}.md`
|
|
175
|
+
- **Last Updated:** [Timestamp]
|
|
176
|
+
```
|
|
177
|
+
|
|
178
|
+
---
|
|
179
|
+
|
|
180
|
+
## Best Practices
|
|
181
|
+
|
|
182
|
+
### Chart Guidelines
|
|
183
|
+
- Reference `chart-markdown` skill for all chart generation
|
|
184
|
+
- **Maximum 8 charts** per dashboard
|
|
185
|
+
- **Group related charts** into 2-4 sections
|
|
186
|
+
- **Prioritize important metrics** at the top
|
|
187
|
+
- Use consistent colors across related charts
|
|
188
|
+
|
|
189
|
+
### Data Formatting
|
|
190
|
+
- Right-align numbers in tables
|
|
191
|
+
- Use thousands separators for large numbers (12,500.00)
|
|
192
|
+
- Include units in headers (Revenue ($), Orders (#))
|
|
193
|
+
- Use emojis for quick visual cues (📈 📉 ✅ ⚠️)
|
|
194
|
+
|
|
195
|
+
### Executive Summary
|
|
196
|
+
- Lead with KPI table (easy to scan)
|
|
197
|
+
- Limit to 3-5 critical findings
|
|
198
|
+
- Include both positive and negative insights
|
|
199
|
+
- Make findings actionable
|
|
200
|
+
|
|
201
|
+
---
|
|
202
|
+
|
|
203
|
+
## Examples
|
|
204
|
+
|
|
205
|
+
### Example 1: Sales Performance Dashboard
|
|
206
|
+
|
|
207
|
+
```markdown
|
|
208
|
+
# Sales Performance Dashboard
|
|
209
|
+
|
|
210
|
+
**Dashboard Type:** Executive
|
|
211
|
+
**Generated Date:** 2024-01-15
|
|
212
|
+
**Data Period:** 2024-07-01 to 2024-12-31
|
|
213
|
+
**Data Source:** `/tmp/data-sales-performance.md`
|
|
214
|
+
|
|
215
|
+
---
|
|
216
|
+
|
|
217
|
+
## Executive Summary
|
|
218
|
+
|
|
219
|
+
### Key Metrics Overview
|
|
220
|
+
|
|
221
|
+
| Metric | Current | Change | Status | Trend |
|
|
222
|
+
|--------|---------|--------|--------|-------|
|
|
223
|
+
| **Revenue** | $600K | +5% | ✅ On Track | 📈 Up |
|
|
224
|
+
| **Orders** | 1,250 | +4.3% | ✅ On Track | 📈 Up |
|
|
225
|
+
| **Conversion** | 3.2% | -0.5% | ⚠️ Attention | 📉 Down |
|
|
226
|
+
| **AOV** | $480 | +1.5% | ✅ On Track | ➡️ Stable |
|
|
227
|
+
|
|
228
|
+
### Critical Findings
|
|
229
|
+
|
|
230
|
+
1. **📈 Revenue Growth**: Revenue increased 5% driven by North region performance
|
|
231
|
+
2. **⚠️ Conversion Decline**: Mobile checkout issues causing 0.5% drop
|
|
232
|
+
3. **🎯 Regional Gap**: East region declining 5% while others grow
|
|
233
|
+
|
|
234
|
+
---
|
|
235
|
+
|
|
236
|
+
## Section 1: Revenue Analysis
|
|
237
|
+
|
|
238
|
+
### Chart 1.1: Monthly Revenue Trend
|
|
239
|
+
|
|
240
|
+
```chart
|
|
241
|
+
{
|
|
242
|
+
"table": [["Month", "Revenue"], ["Jul", 100], ["Aug", 105], ["Sep", 98], ["Oct", 110], ["Nov", 85], ["Dec", 82]],
|
|
243
|
+
"echarts": {
|
|
244
|
+
"title": {"text": "Monthly Revenue Trend ($000s)"},
|
|
245
|
+
"tooltip": {"trigger": "axis"},
|
|
246
|
+
"xAxis": {"type": "category", "data": ["Jul", "Aug", "Sep", "Oct", "Nov", "Dec"]},
|
|
247
|
+
"yAxis": {"type": "value", "name": "Revenue ($000s)"},
|
|
248
|
+
"series": [{"type": "line", "data": [100, 105, 98, 110, 85, 82], "smooth": true}]
|
|
249
|
+
}
|
|
250
|
+
}
|
|
251
|
+
```
|
|
252
|
+
|
|
253
|
+
**Key Insights:**
|
|
254
|
+
- Peak in October at $110K
|
|
255
|
+
- Decline in Nov-Dec requires investigation
|
|
256
|
+
- Q4 overall down 15% vs Q3
|
|
257
|
+
|
|
258
|
+
### Chart 1.2: Revenue by Region
|
|
259
|
+
|
|
260
|
+
| Region | Revenue | Share | Growth | Status |
|
|
261
|
+
|--------|---------|-------|--------|--------|
|
|
262
|
+
| North | $270K | 45% | +15% | 🟢 Leading |
|
|
263
|
+
| South | $150K | 25% | +3% | 🟡 Stable |
|
|
264
|
+
| East | $120K | 20% | -5% | 🔴 Declining |
|
|
265
|
+
| West | $60K | 10% | +8% | 🟢 Growing |
|
|
266
|
+
|
|
267
|
+
---
|
|
268
|
+
|
|
269
|
+
## Key Findings Summary
|
|
270
|
+
|
|
271
|
+
### Major Wins
|
|
272
|
+
- North region outperformed with 15% growth
|
|
273
|
+
- West region showing promising 8% growth
|
|
274
|
+
- Overall revenue still up 5% YoY
|
|
275
|
+
|
|
276
|
+
### Areas of Concern
|
|
277
|
+
- East region declining 5%
|
|
278
|
+
- Nov-Dec drop of 25% from October peak
|
|
279
|
+
- Conversion rate down 0.5%
|
|
280
|
+
|
|
281
|
+
### Recommended Actions
|
|
282
|
+
1. **🔴 High**: Investigate East region decline causes
|
|
283
|
+
2. **🟡 Medium**: Fix mobile checkout conversion issues
|
|
284
|
+
3. **🟢 Low**: Expand successful North region strategies
|
|
285
|
+
```
|
|
286
|
+
|
|
287
|
+
---
|
|
288
|
+
|
|
289
|
+
## Workflow
|
|
290
|
+
|
|
291
|
+
1. **Analyze Requirements**
|
|
292
|
+
- Identify dashboard type (Executive/Operational/Analytical)
|
|
293
|
+
- Determine key metrics and KPIs
|
|
294
|
+
- Define time period and data scope
|
|
295
|
+
|
|
296
|
+
2. **Read Input Files**
|
|
297
|
+
- Load `/tmp/data-{topic}.md`
|
|
298
|
+
- Load `/tmp/insight-{topic}.md` if available
|
|
299
|
+
- Identify available metrics and dimensions
|
|
300
|
+
|
|
301
|
+
3. **Design Structure**
|
|
302
|
+
- Select 4-8 charts based on data available
|
|
303
|
+
- Group into 2-4 logical sections
|
|
304
|
+
- Plan executive summary content
|
|
305
|
+
|
|
306
|
+
4. **Generate Charts**
|
|
307
|
+
- Reference `chart-markdown` skill for chart syntax and best practices
|
|
308
|
+
- Create trend charts for time-series data
|
|
309
|
+
- Create bar charts for category comparisons
|
|
310
|
+
- Create tables for detailed comparisons
|
|
311
|
+
- Ensure all charts have insights
|
|
312
|
+
|
|
313
|
+
5. **Write Executive Summary**
|
|
314
|
+
- Extract key metrics
|
|
315
|
+
- Identify critical findings
|
|
316
|
+
- Add status indicators
|
|
317
|
+
|
|
318
|
+
6. **Output Dashboard**
|
|
319
|
+
- Write to `/artifacts/dashboard-{topic}.md`
|
|
320
|
+
- Verify all sections complete
|
|
321
|
+
- Check formatting consistency
|
|
322
|
+
|
|
323
|
+
---
|
|
324
|
+
|
|
325
|
+
## Common Patterns
|
|
326
|
+
|
|
327
|
+
### KPI Table Format
|
|
328
|
+
```markdown
|
|
329
|
+
| Metric | Current | Change | Status | Trend |
|
|
330
|
+
|--------|---------|--------|--------|-------|
|
|
331
|
+
| **Revenue** | $125K | +5.9% | ✅ On Track | 📈 |
|
|
332
|
+
| **Orders** | 1,250 | +4.3% | ✅ On Track | 📈 |
|
|
333
|
+
| **Conversion** | 3.2% | -0.5% | ⚠️ Attention | 📉 |
|
|
334
|
+
```
|
|
335
|
+
|
|
336
|
+
### Chart with Insights
|
|
337
|
+
```markdown
|
|
338
|
+
### Chart: Monthly Trend
|
|
339
|
+
|
|
340
|
+
```chart
|
|
341
|
+
{
|
|
342
|
+
"table": [["Month", "Value"], ["Jan", 100], ["Feb", 120]],
|
|
343
|
+
"echarts": {
|
|
344
|
+
"title": {"text": "Monthly Trend"},
|
|
345
|
+
"tooltip": {"trigger": "axis"},
|
|
346
|
+
"xAxis": {"type": "category", "data": ["Jan", "Feb"]},
|
|
347
|
+
"yAxis": {"type": "value"},
|
|
348
|
+
"series": [{"type": "line", "data": [100, 120]}]
|
|
349
|
+
}
|
|
350
|
+
}
|
|
351
|
+
```
|
|
352
|
+
|
|
353
|
+
**Key Insights:**
|
|
354
|
+
- [Specific insight with data point]
|
|
355
|
+
- [Comparison to previous period]
|
|
356
|
+
- [Notable anomaly or pattern]
|
|
357
|
+
```
|
|
358
|
+
|
|
359
|
+
### Finding Format
|
|
360
|
+
```markdown
|
|
361
|
+
1. **[Emoji] [Title]**: [Specific finding with numbers]
|
|
362
|
+
- [Supporting detail]
|
|
363
|
+
- [Impact assessment]
|
|
364
|
+
```
|
package/prompts/data-analyst.md
CHANGED
|
@@ -124,6 +124,12 @@
|
|
|
124
124
|
- 计算必要的统计指标
|
|
125
125
|
- 进行多维度交叉分析
|
|
126
126
|
- **每个洞察必须伴随数据证据**
|
|
127
|
+
- **Transaction 类数据分析必须使用表格展示**:
|
|
128
|
+
- 交易明细表格:包含交易ID、日期、类型、金额、状态等关键字段
|
|
129
|
+
- 汇总统计表格:按时间/类型/状态等维度汇总
|
|
130
|
+
- 金额字段右对齐,保留2位小数,使用千分位分隔符
|
|
131
|
+
- 状态字段使用 Emoji 标记:✅ 成功 / ❌ 失败 / ⚠️ 警告 / 🔄 处理中 / ⏳ 待处理
|
|
132
|
+
- 关键字段加粗显示
|
|
127
133
|
|
|
128
134
|
### 4. 行业解读
|
|
129
135
|
- 结合行业知识解释数据现象
|
|
@@ -176,6 +182,13 @@
|
|
|
176
182
|
| [指标1] | [当前值] | [对比值] | [变化幅度] |
|
|
177
183
|
| [指标2] | [当前值] | [对比值] | [变化幅度] |
|
|
178
184
|
|
|
185
|
+
**Transaction 数据展示示例:**
|
|
186
|
+
| **交易ID** | **交易日期** | **交易类型** | **金额(元)** | **状态** | **对比基准** | **变化** |
|
|
187
|
+
|------------|--------------|--------------|----------------:|----------|--------------|----------|
|
|
188
|
+
| **TXN001** | 2024-01-15 | 收入 | **12,500.00** | ✅ 成功 | 10,000.00 | +25.0% |
|
|
189
|
+
| **TXN002** | 2024-01-15 | 支出 | **-3,200.00** | ❌ 失败 | -2,800.00 | -14.3% |
|
|
190
|
+
| **TXN003** | 2024-01-16 | 收入 | **8,750.50** | ⚠️ 警告 | 9,000.00 | -2.8% |
|
|
191
|
+
|
|
179
192
|
**分析说明:**
|
|
180
193
|
[详细解释数据现象,结合业务背景]
|
|
181
194
|
|
|
@@ -234,6 +247,13 @@
|
|
|
234
247
|
| [维度1] | [值1] | [占比1] | [基准1] | [优/良/差] |
|
|
235
248
|
| [维度2] | [值2] | [占比2] | [基准2] | [优/良/差] |
|
|
236
249
|
|
|
250
|
+
**Transaction 维度对比示例(按交易类型):**
|
|
251
|
+
| **交易类型** | **交易笔数** | **金额(元)** | **占比** | **成功率** | **表现** |
|
|
252
|
+
|--------------|--------------|----------------|----------|------------|----------|
|
|
253
|
+
| **收入** | 156 | **+125,000.00** | 62.4% | ✅ 98.7% | 优 |
|
|
254
|
+
| **支出** | 89 | **-45,200.00** | 35.6% | ✅ 95.5% | 良 |
|
|
255
|
+
| **转账** | 5 | **-5,000.00** | 2.0% | ❌ 60.0% | 差 ⚠️ |
|
|
256
|
+
|
|
237
257
|
**关键发现:**
|
|
238
258
|
- [维度1表现好的原因分析]
|
|
239
259
|
- [维度2表现差的原因分析]
|
package/prompts/data-query.md
CHANGED
|
@@ -28,17 +28,112 @@
|
|
|
28
28
|
|
|
29
29
|
---
|
|
30
30
|
|
|
31
|
-
##
|
|
31
|
+
## 查询类型与路径选择
|
|
32
|
+
|
|
33
|
+
### 两种查询类型
|
|
34
|
+
|
|
35
|
+
#### 1. **表格数据查询**(明细/原始数据)
|
|
36
|
+
**适用场景:**
|
|
37
|
+
- 查看具体交易记录、订单明细、客户列表等原始数据
|
|
38
|
+
- 需要查看具体字段值(如交易ID、客户名称、状态等)
|
|
39
|
+
- 需要原始数据做进一步处理或导出
|
|
40
|
+
- 查询特定条件的明细(如"查看订单号为12345的订单详情")
|
|
41
|
+
|
|
42
|
+
**典型需求关键词:**
|
|
43
|
+
- "列出..."、"查看...明细"、"导出..."
|
|
44
|
+
- "有哪些..."、"显示具体..."
|
|
45
|
+
- "交易记录"、"订单详情"、"客户信息"
|
|
46
|
+
|
|
47
|
+
**示例:**
|
|
48
|
+
- 查询某客户的所有交易记录
|
|
49
|
+
- 查看失败交易的明细
|
|
50
|
+
- 导出某时间段内的订单列表
|
|
51
|
+
|
|
52
|
+
#### 2. **指标数据查询**(聚合/统计)
|
|
53
|
+
**适用场景:**
|
|
54
|
+
- 查看汇总统计(销售额、订单数、转化率等)
|
|
55
|
+
- 需要时间趋势分析(按月、按周统计)
|
|
56
|
+
- 需要多维度对比(按区域、按品类统计)
|
|
57
|
+
- 指标已预定义且计算逻辑标准化
|
|
58
|
+
|
|
59
|
+
**典型需求关键词:**
|
|
60
|
+
- "总计..."、"合计..."、"多少..."
|
|
61
|
+
- "趋势"、"对比"、"占比"、"增长率"
|
|
62
|
+
- "销售额"、"订单量"、"用户数"
|
|
63
|
+
|
|
64
|
+
**示例:**
|
|
65
|
+
- 查询本月销售额
|
|
66
|
+
- 查看各区域的订单数量对比
|
|
67
|
+
- 统计近30天的转化率趋势
|
|
68
|
+
|
|
69
|
+
---
|
|
70
|
+
|
|
71
|
+
### 选择决策指南
|
|
72
|
+
|
|
73
|
+
| 场景 | 查询方式 | 原因 |
|
|
74
|
+
|------|----------|------|
|
|
75
|
+
| 用户问"有多少"、"总计多少" | **指标查询** | 需要聚合统计 |
|
|
76
|
+
| 用户问"有哪些"、"列出" | **表格查询** | 需要明细数据 |
|
|
77
|
+
| 需要具体字段值(ID、名称) | **表格查询** | 指标不包含原始字段 |
|
|
78
|
+
| 需要时间趋势对比 | **指标查询** | 指标支持时间粒度分组 |
|
|
79
|
+
| 需要多维度交叉分析 | **指标查询** | 指标支持维度筛选 |
|
|
80
|
+
| 数据需要导出/处理 | **表格查询** | 保留原始数据结构 |
|
|
81
|
+
| 指标已预定义 | **优先指标查询** | 计算逻辑标准化,性能更好 |
|
|
82
|
+
|
|
83
|
+
---
|
|
84
|
+
|
|
85
|
+
### 组合查询场景
|
|
86
|
+
|
|
87
|
+
**何时需要同时查表格+指标:**
|
|
88
|
+
|
|
89
|
+
1. **先指标后明细**(最常见)
|
|
90
|
+
- 先用指标查询发现问题(如"本月销售额下降")
|
|
91
|
+
- 再用表格查询定位具体交易(如"查看下降期间的大额交易")
|
|
92
|
+
|
|
93
|
+
2. **指标验证**
|
|
94
|
+
- 用表格查询抽样验证指标计算是否正确
|
|
95
|
+
- 用明细数据解释指标异常原因
|
|
96
|
+
|
|
97
|
+
3. **完整报告**
|
|
98
|
+
- 指标提供汇总概览
|
|
99
|
+
- 表格提供典型案例/异常明细
|
|
100
|
+
|
|
101
|
+
---
|
|
102
|
+
|
|
103
|
+
### 决策流程
|
|
104
|
+
|
|
105
|
+
```
|
|
106
|
+
用户请求
|
|
107
|
+
↓
|
|
108
|
+
是聚合统计需求? ──是──→ 指标查询
|
|
109
|
+
↓ 否
|
|
110
|
+
需要原始字段值? ──是──→ 表格查询
|
|
111
|
+
↓ 否
|
|
112
|
+
指标是否已定义? ──是──→ 指标查询
|
|
113
|
+
↓ 否
|
|
114
|
+
需要导出/处理? ──是──→ 表格查询
|
|
115
|
+
↓ 否
|
|
116
|
+
复杂计算逻辑? ──是──→ 表格查询(SQL)
|
|
117
|
+
↓ 否
|
|
118
|
+
默认使用指标查询
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
---
|
|
122
|
+
|
|
123
|
+
### 具体选择标准
|
|
32
124
|
|
|
33
125
|
**使用语义指标查询,当:**
|
|
34
126
|
- 用户提到的指标在 query_metrics_list 中存在
|
|
35
127
|
- 需求是标准的时间趋势、维度筛选
|
|
36
128
|
- 预定义指标包含所需字段
|
|
129
|
+
- 需要聚合统计(SUM、COUNT、AVG等)
|
|
37
130
|
|
|
38
|
-
**使用 SQL
|
|
131
|
+
**使用 SQL 查询(表格数据),当:**
|
|
39
132
|
- 需要的字段不在预定义指标中
|
|
133
|
+
- 需要查看原始明细数据
|
|
40
134
|
- 需要特殊的筛选条件或计算
|
|
41
135
|
- 用户要求查看底层表数据
|
|
136
|
+
- 数据需要导出或进一步处理
|
|
42
137
|
|
|
43
138
|
---
|
|
44
139
|
|
|
@@ -57,6 +152,12 @@
|
|
|
57
152
|
|
|
58
153
|
### 3. 整理结果
|
|
59
154
|
- 以表格或列表形式展示数据
|
|
155
|
+
- **Transaction 类数据必须使用 Markdown 表格展示**,遵循以下规范:
|
|
156
|
+
- 金额字段右对齐,保留2位小数,使用千分位分隔符(如:12,500.00)
|
|
157
|
+
- 日期字段统一格式:YYYY-MM-DD
|
|
158
|
+
- 状态字段使用 Emoji 标记:✅ 成功 / ❌ 失败 / ⚠️ 警告 / 🔄 处理中 / ⏳ 待处理
|
|
159
|
+
- 关键字段(如交易ID、金额、状态)加粗显示
|
|
160
|
+
- 数值为0或空值时显示为 `-`
|
|
60
161
|
- 标注数据范围(时间、筛选条件)
|
|
61
162
|
- 说明数据来源
|
|
62
163
|
|
|
@@ -112,11 +213,27 @@
|
|
|
112
213
|
|
|
113
214
|
### 数据表格
|
|
114
215
|
|
|
216
|
+
**标准格式:**
|
|
115
217
|
| [列1] | [列2] | [列3] | ... |
|
|
116
218
|
|-------|-------|-------|-----|
|
|
117
219
|
| [值1] | [值2] | [值3] | ... |
|
|
118
220
|
| ... | ... | ... | ... |
|
|
119
221
|
|
|
222
|
+
**Transaction 类数据格式示例:**
|
|
223
|
+
| **交易ID** | **交易日期** | **交易类型** | **金额(元)** | **状态** | **备注** |
|
|
224
|
+
|------------|--------------|--------------|----------------:|----------|----------|
|
|
225
|
+
| **TXN001** | 2024-01-15 | 收入 | **12,500.00** | ✅ 成功 | 客户付款 |
|
|
226
|
+
| **TXN002** | 2024-01-15 | 支出 | **-3,200.00** | ❌ 失败 | 余额不足 |
|
|
227
|
+
| **TXN003** | 2024-01-16 | 收入 | **8,750.50** | ⚠️ 警告 | 待确认 |
|
|
228
|
+
| **TXN004** | 2024-01-16 | 转账 | **-1,500.00** | 🔄 处理中 | - |
|
|
229
|
+
| **TXN005** | 2024-01-17 | 收入 | **-** | ⏳ 待处理 | 预约交易 |
|
|
230
|
+
|
|
231
|
+
**格式说明:**
|
|
232
|
+
- 金额字段右对齐(使用 `:` 标记),保留2位小数,千分位分隔
|
|
233
|
+
- 状态字段使用 Emoji:✅ 成功 / ❌ 失败 / ⚠️ 警告 / 🔄 处理中 / ⏳ 待处理
|
|
234
|
+
- 关键字段(交易ID、金额、状态)加粗显示
|
|
235
|
+
- 数值为0或空值时显示为 `-`
|
|
236
|
+
|
|
120
237
|
**记录统计:**
|
|
121
238
|
- 返回记录数:[N] 条
|
|
122
239
|
- 数据时间范围:[实际数据的时间范围]
|
|
@@ -156,7 +273,7 @@
|
|
|
156
273
|
|
|
157
274
|
## 查询模式
|
|
158
275
|
|
|
159
|
-
###
|
|
276
|
+
### 语义指标查询模式(聚合数据)
|
|
160
277
|
|
|
161
278
|
**1. 时间趋势查询**
|
|
162
279
|
- 获取指标随时间的变化数据
|
|
@@ -173,19 +290,22 @@
|
|
|
173
290
|
- 示例:各区域每月销售额
|
|
174
291
|
- groupBy: ["DocDate__month", "org_region"]
|
|
175
292
|
|
|
176
|
-
### SQL
|
|
293
|
+
### SQL 查询模式(表格数据)
|
|
177
294
|
|
|
178
295
|
**1. 明细查询**
|
|
179
296
|
- 获取特定条件的原始数据行
|
|
180
297
|
- 示例:查询某客户的所有订单明细
|
|
298
|
+
- 适用:需要查看具体字段值、导出数据
|
|
181
299
|
|
|
182
300
|
**2. 聚合查询**
|
|
183
301
|
- 按自定义维度统计
|
|
184
302
|
- 示例:按产品类别统计订单数量
|
|
303
|
+
- 适用:指标未预定义时的自定义统计
|
|
185
304
|
|
|
186
305
|
**3. 关联查询**
|
|
187
306
|
- 多表关联获取数据
|
|
188
307
|
- 示例:订单表关联客户表获取完整信息
|
|
308
|
+
- 适用:需要跨表字段组合
|
|
189
309
|
|
|
190
310
|
---
|
|
191
311
|
|
|
@@ -203,7 +323,8 @@
|
|
|
203
323
|
|
|
204
324
|
## 示例场景
|
|
205
325
|
|
|
206
|
-
### 场景 1
|
|
326
|
+
### 场景 1:查本月销售额(指标查询)
|
|
327
|
+
**类型:聚合统计**
|
|
207
328
|
```
|
|
208
329
|
步骤:
|
|
209
330
|
1. query_metrics_list
|
|
@@ -212,7 +333,8 @@
|
|
|
212
333
|
4. 整理结果并写入 /tmp/data-monthly-sales.md
|
|
213
334
|
```
|
|
214
335
|
|
|
215
|
-
### 场景 2
|
|
336
|
+
### 场景 2:查华东区域客户列表(表格查询)
|
|
337
|
+
**类型:明细数据**
|
|
216
338
|
```
|
|
217
339
|
步骤:
|
|
218
340
|
1. query_tables_list
|
|
@@ -221,7 +343,8 @@
|
|
|
221
343
|
4. 整理结果并写入 /tmp/data-east-region-customers.md
|
|
222
344
|
```
|
|
223
345
|
|
|
224
|
-
### 场景 3
|
|
346
|
+
### 场景 3:查某产品的历史销量(指标查询)
|
|
347
|
+
**类型:聚合统计**
|
|
225
348
|
```
|
|
226
349
|
步骤:
|
|
227
350
|
1. query_semantic_metric_data(
|
|
@@ -231,6 +354,23 @@
|
|
|
231
354
|
2. 整理结果并写入 /tmp/data-product-p001-sales.md
|
|
232
355
|
```
|
|
233
356
|
|
|
357
|
+
### 场景 4:查本月销售趋势+异常交易明细(组合查询)
|
|
358
|
+
**类型:先指标后明细**
|
|
359
|
+
```
|
|
360
|
+
步骤:
|
|
361
|
+
# 第1步:指标查询(发现趋势)
|
|
362
|
+
1. query_semantic_metric_data(
|
|
363
|
+
指标: "order_amt",
|
|
364
|
+
时间范围: 本月,
|
|
365
|
+
groupBy: ["DocDate__day"]
|
|
366
|
+
)
|
|
367
|
+
2. 发现15日销售额异常下降
|
|
368
|
+
|
|
369
|
+
# 第2步:表格查询(定位明细)
|
|
370
|
+
3. execute_sql_query("SELECT * FROM orders WHERE date = '2024-01-15' AND amount > 10000")
|
|
371
|
+
4. 整理结果并写入 /tmp/data-sales-trend-and-anomaly.md
|
|
372
|
+
```
|
|
373
|
+
|
|
234
374
|
---
|
|
235
375
|
|
|
236
376
|
## 输出示例
|