feat(model): generate models from table metadata

This commit is contained in:
二丫讲梵 authored and GitHub committed 2026-10-05 02:09:13 +08:00
1 parent bf68b93b05
commit 95138e5a68
22 files changed
+1114 -1

No files matched your search

+5
View File
@@ -1,3 +1,4 @@
import { normalizeModelTemplates, type ModelTemplate } from "@/lib/model/modelTemplates";
import { normalizePluginShortcutSettings, type PluginShortcutSettings } from "@/lib/plugins/pluginShortcuts";
import { defineStore } from "pinia";
import { computed, ref } from "vue";
@@ -1067,6 +1068,7 @@ export interface EditorSettings {
globalDateTimeImportFormat: string;
snippets: SqlSnippet[];
sqlShortcuts: SqlShortcutAction[];
modelGenerationTemplates: ModelTemplate[];
tableColumnTemplateFields: string[];
exportBatchSize: number;
preferredExportPath: string;
@@ -1376,6 +1378,7 @@ export const DEFAULT_EDITOR_SETTINGS: EditorSettings = {
globalDateTimeImportFormat: "",
snippets: DEFAULT_SQL_SNIPPETS,
sqlShortcuts: DEFAULT_SQL_SHORTCUTS,
modelGenerationTemplates: [],
tableColumnTemplateFields: [...DEFAULT_TABLE_COLUMN_TEMPLATE_FIELDS],
exportBatchSize: 2000,
preferredExportPath: "",
@@ -2045,6 +2048,7 @@ export function normalizeEditorSettings(settings: Partial<EditorSettings>, exist
globalDateTimeImportFormat: normalizeGlobalDateTimePattern(settings.globalDateTimeImportFormat),
snippets: normalizeSqlSnippets(settings.snippets, existing?.snippets),
sqlShortcuts: normalizeSqlShortcuts(settings.sqlShortcuts, existing?.sqlShortcuts),
modelGenerationTemplates: normalizeModelTemplates(settings.modelGenerationTemplates),
tableColumnTemplateFields: normalizeTableColumnTemplateFields(settings.tableColumnTemplateFields),
exportBatchSize: typeof settings.exportBatchSize === "number" && settings.exportBatchSize >= 100 && settings.exportBatchSize <= 100000 ? Math.round(settings.exportBatchSize) : DEFAULT_EDITOR_SETTINGS.exportBatchSize,
preferredExportPath: typeof settings.preferredExportPath === "string" ? settings.preferredExportPath.trim() : DEFAULT_EDITOR_SETTINGS.preferredExportPath,
@@ -2876,6 +2880,7 @@ export const useSettingsStore = defineStore("settings", () => {
if (partial.globalDateTimeImportFormat !== undefined) editorSettings.value.globalDateTimeImportFormat = normalizeGlobalDateTimePattern(partial.globalDateTimeImportFormat);
if (partial.snippets !== undefined) editorSettings.value.snippets = normalizeSqlSnippets(partial.snippets);
if (partial.sqlShortcuts !== undefined) editorSettings.value.sqlShortcuts = normalizeSqlShortcuts(partial.sqlShortcuts);
if (partial.modelGenerationTemplates !== undefined) editorSettings.value.modelGenerationTemplates = normalizeModelTemplates(partial.modelGenerationTemplates);
if (partial.tableColumnTemplateFields !== undefined) editorSettings.value.tableColumnTemplateFields = normalizeTableColumnTemplateFields(partial.tableColumnTemplateFields);
if (partial.exportBatchSize !== undefined) editorSettings.value.exportBatchSize = Math.min(100000, Math.max(100, Math.round(partial.exportBatchSize)));
if (partial.preferredExportPath !== undefined) editorSettings.value.preferredExportPath = typeof partial.preferredExportPath === "string" ? partial.preferredExportPath.trim() : "";