From 1b70c6e2b3c638f969f98f06c47309f9bbb2795b Mon Sep 17 00:00:00 2001 From: dal Date: Fri, 8 Aug 2025 07:14:13 -0600 Subject: [PATCH] fix: clean up imports and enhance dashboard file handling - Removed duplicate import of ModelMessage in create-dashboards-execute.ts for clarity. - Updated createDashboardsReasoningMessage function to conditionally include version_number only if defined, improving the handling of dashboard file properties. All changes aim to streamline the code and enhance maintainability. --- .../create-dashboards-tool/create-dashboards-execute.ts | 2 +- .../helpers/create-dashboards-tool-transform-helper.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/ai/src/tools/visualization-tools/create-dashboards-tool/create-dashboards-execute.ts b/packages/ai/src/tools/visualization-tools/create-dashboards-tool/create-dashboards-execute.ts index ce38d17da..d7f53a142 100644 --- a/packages/ai/src/tools/visualization-tools/create-dashboards-tool/create-dashboards-execute.ts +++ b/packages/ai/src/tools/visualization-tools/create-dashboards-tool/create-dashboards-execute.ts @@ -6,9 +6,9 @@ import { metricFiles, metricFilesToDashboardFiles, } from '@buster/database'; +import type { ModelMessage } from 'ai'; import { wrapTraced } from 'braintrust'; import { inArray } from 'drizzle-orm'; -import type { ModelMessage } from 'ai'; import * as yaml from 'yaml'; import { z } from 'zod'; import { trackFileAssociations } from '../file-tracking-helper'; diff --git a/packages/ai/src/tools/visualization-tools/create-dashboards-tool/helpers/create-dashboards-tool-transform-helper.ts b/packages/ai/src/tools/visualization-tools/create-dashboards-tool/helpers/create-dashboards-tool-transform-helper.ts index a4fab8139..16fde7ca9 100644 --- a/packages/ai/src/tools/visualization-tools/create-dashboards-tool/helpers/create-dashboards-tool-transform-helper.ts +++ b/packages/ai/src/tools/visualization-tools/create-dashboards-tool/helpers/create-dashboards-tool-transform-helper.ts @@ -34,11 +34,11 @@ export function createDashboardsReasoningMessage( id: fileId, file_type: 'dashboard', file_name: file.name, - version_number: file.version || undefined, status: file.status || 'loading', file: { text: file.yml_content, }, + ...(file.version !== undefined ? { version_number: file.version } : {}), ...(file.error && { error: file.error }), }; });