Skip to content

Commit bd7b06c

Browse files
authored
fix: remove empty fields from dashboard chat context (#8798)
1 parent 46ae375 commit bd7b06c

File tree

2 files changed

+34
-34
lines changed

2 files changed

+34
-34
lines changed

runtime/ai/analyst_agent.go

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -25,17 +25,17 @@ var _ Tool[*AnalystAgentArgs, *AnalystAgentResult] = (*AnalystAgent)(nil)
2525

2626
type AnalystAgentArgs struct {
2727
Prompt string `json:"prompt"`
28-
Explore string `json:"explore" yaml:"explore" jsonschema:"Optional explore dashboard name. If provided, the exploration will be limited to this dashboard."`
29-
Dimensions []string `json:"dimensions" yaml:"dimensions" jsonschema:"Optional list of dimensions for queries. If provided, the queries will be limited to these dimensions."`
30-
Measures []string `json:"measures" yaml:"measures" jsonschema:"Optional list of measures for queries. If provided, the queries will be limited to these measures."`
28+
Explore string `json:"explore,omitempty" yaml:"explore" jsonschema:"Optional explore dashboard name. If provided, the exploration will be limited to this dashboard."`
29+
Dimensions []string `json:"dimensions,omitempty" yaml:"dimensions" jsonschema:"Optional list of dimensions for queries. If provided, the queries will be limited to these dimensions."`
30+
Measures []string `json:"measures,omitempty" yaml:"measures" jsonschema:"Optional list of measures for queries. If provided, the queries will be limited to these measures."`
3131

32-
Canvas string `json:"canvas" yaml:"canvas" jsonschema:"Optional canvas name. If provided, the exploration will be limited to this canvas."`
33-
CanvasComponent string `json:"canvas_component" yaml:"canvas_component" jsonschema:"Optional canvas component name. If provided, the exploration will be limited to this canvas component."`
34-
WherePerMetricsView map[string]*metricsview.Expression `json:"where_per_metrics_view" yaml:"where_per_metrics_view" jsonschema:"Optional filter for queries per metrics view. If provided, this filter will be applied to queries for each metrics view."`
32+
Canvas string `json:"canvas,omitempty" yaml:"canvas" jsonschema:"Optional canvas name. If provided, the exploration will be limited to this canvas."`
33+
CanvasComponent string `json:"canvas_component,omitempty" yaml:"canvas_component" jsonschema:"Optional canvas component name. If provided, the exploration will be limited to this canvas component."`
34+
WherePerMetricsView map[string]*metricsview.Expression `json:"where_per_metrics_view,omitempty" yaml:"where_per_metrics_view" jsonschema:"Optional filter for queries per metrics view. If provided, this filter will be applied to queries for each metrics view."`
3535

36-
Where *metricsview.Expression `json:"where" yaml:"where" jsonschema:"Optional filter for queries. If provided, this filter will be applied to all queries."`
37-
TimeStart time.Time `json:"time_start" yaml:"time_start" jsonschema:"Optional start time for queries. time_end must be provided if time_start is provided."`
38-
TimeEnd time.Time `json:"time_end" yaml:"time_end" jsonschema:"Optional end time for queries. time_start must be provided if time_end is provided."`
36+
Where *metricsview.Expression `json:"where,omitempty" yaml:"where" jsonschema:"Optional filter for queries. If provided, this filter will be applied to all queries."`
37+
TimeStart time.Time `json:"time_start,omitempty" yaml:"time_start" jsonschema:"Optional start time for queries. time_end must be provided if time_start is provided."`
38+
TimeEnd time.Time `json:"time_end,omitempty" yaml:"time_end" jsonschema:"Optional end time for queries. time_start must be provided if time_end is provided."`
3939
}
4040

4141
func (a *AnalystAgentArgs) ToLLM() *aiv1.ContentBlock {

runtime/metricsview/query.go

Lines changed: 25 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -31,33 +31,33 @@ type Query struct {
3131
}
3232

3333
type Dimension struct {
34-
Name string `json:"name" mapstructure:"name"`
35-
Compute *DimensionCompute `json:"compute" mapstructure:"compute"`
34+
Name string `json:"name,omitempty" mapstructure:"name"`
35+
Compute *DimensionCompute `json:"compute,omitempty" mapstructure:"compute"`
3636
}
3737

3838
type DimensionCompute struct {
39-
TimeFloor *DimensionComputeTimeFloor `json:"time_floor" mapstructure:"time_floor"`
39+
TimeFloor *DimensionComputeTimeFloor `json:"time_floor,omitempty" mapstructure:"time_floor"`
4040
}
4141

4242
type DimensionComputeTimeFloor struct {
43-
Dimension string `json:"dimension" mapstructure:"dimension"`
44-
Grain TimeGrain `json:"grain" mapstructure:"grain"`
43+
Dimension string `json:"dimension,omitempty" mapstructure:"dimension"`
44+
Grain TimeGrain `json:"grain,omitempty" mapstructure:"grain"`
4545
}
4646

4747
type Measure struct {
48-
Name string `json:"name" mapstructure:"name"`
49-
Compute *MeasureCompute `json:"compute" mapstructure:"compute"`
48+
Name string `json:"name,omitempty" mapstructure:"name"`
49+
Compute *MeasureCompute `json:"compute,omitempty" mapstructure:"compute"`
5050
}
5151

5252
type MeasureCompute struct {
53-
Count bool `json:"count" mapstructure:"count"`
54-
CountDistinct *MeasureComputeCountDistinct `json:"count_distinct" mapstructure:"count_distinct"`
55-
ComparisonValue *MeasureComputeComparisonValue `json:"comparison_value" mapstructure:"comparison_value"`
56-
ComparisonDelta *MeasureComputeComparisonDelta `json:"comparison_delta" mapstructure:"comparison_delta"`
57-
ComparisonRatio *MeasureComputeComparisonRatio `json:"comparison_ratio" mapstructure:"comparison_ratio"`
58-
PercentOfTotal *MeasureComputePercentOfTotal `json:"percent_of_total" mapstructure:"percent_of_total"`
59-
URI *MeasureComputeURI `json:"uri" mapstructure:"uri"`
60-
ComparisonTime *MeasureComputeComparisonTime `json:"comparison_time" mapstructure:"comparison_time"`
53+
Count bool `json:"count,omitempty" mapstructure:"count"`
54+
CountDistinct *MeasureComputeCountDistinct `json:"count_distinct,omitempty" mapstructure:"count_distinct"`
55+
ComparisonValue *MeasureComputeComparisonValue `json:"comparison_value,omitempty" mapstructure:"comparison_value"`
56+
ComparisonDelta *MeasureComputeComparisonDelta `json:"comparison_delta,omitempty" mapstructure:"comparison_delta"`
57+
ComparisonRatio *MeasureComputeComparisonRatio `json:"comparison_ratio,omitempty" mapstructure:"comparison_ratio"`
58+
PercentOfTotal *MeasureComputePercentOfTotal `json:"percent_of_total,omitempty" mapstructure:"percent_of_total"`
59+
URI *MeasureComputeURI `json:"uri,omitempty" mapstructure:"uri"`
60+
ComparisonTime *MeasureComputeComparisonTime `json:"comparison_time,omitempty" mapstructure:"comparison_time"`
6161
}
6262

6363
func (q *Query) AsMap() (map[string]any, error) {
@@ -221,10 +221,10 @@ func (tr *TimeRange) AsMap() (map[string]any, error) {
221221
}
222222

223223
type Expression struct {
224-
Name string `json:"name" mapstructure:"name"`
225-
Value any `json:"val" mapstructure:"val"`
226-
Condition *Condition `json:"cond" mapstructure:"cond"`
227-
Subquery *Subquery `json:"subquery" mapstructure:"subquery"`
224+
Name string `json:"name,omitempty" mapstructure:"name"`
225+
Value any `json:"val,omitempty" mapstructure:"val"`
226+
Condition *Condition `json:"cond,omitempty" mapstructure:"cond"`
227+
Subquery *Subquery `json:"subquery,omitempty" mapstructure:"subquery"`
228228
}
229229

230230
func (e *Expression) AsMap() (map[string]any, error) {
@@ -244,15 +244,15 @@ func (e *Expression) AsMap() (map[string]any, error) {
244244
}
245245

246246
type Condition struct {
247-
Operator Operator `json:"op" mapstructure:"op"`
248-
Expressions []*Expression `json:"exprs" mapstructure:"exprs"`
247+
Operator Operator `json:"op,omitempty" mapstructure:"op"`
248+
Expressions []*Expression `json:"exprs,omitempty" mapstructure:"exprs"`
249249
}
250250

251251
type Subquery struct {
252-
Dimension Dimension `json:"dimension" mapstructure:"dimension"`
253-
Measures []Measure `json:"measures" mapstructure:"measures"`
254-
Where *Expression `json:"where" mapstructure:"where"`
255-
Having *Expression `json:"having" mapstructure:"having"`
252+
Dimension Dimension `json:"dimension,omitempty" mapstructure:"dimension"`
253+
Measures []Measure `json:"measures,omitempty" mapstructure:"measures"`
254+
Where *Expression `json:"where,omitempty" mapstructure:"where"`
255+
Having *Expression `json:"having,omitempty" mapstructure:"having"`
256256
}
257257

258258
type Operator string

0 commit comments

Comments
 (0)