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.
This commit is contained in:
dal 2025-08-08 07:14:13 -06:00
parent c08fdbc30f
commit 1b70c6e2b3
No known key found for this signature in database
GPG Key ID: 16F4B0E1E9F61122
2 changed files with 2 additions and 2 deletions

View File

@ -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';

View File

@ -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 }),
};
});