UNPKG

@directus/api

Version:

Directus is a real-time API and App dashboard for managing SQL database content

47 lines (46 loc) 1.67 kB
//#region src/database/migrations/20260110A-add-ai-provider-settings.ts const DEFAULT_OPENAI_MODELS = [ "gpt-5.4-nano", "gpt-5.4-mini", "gpt-5.4" ]; const DEFAULT_ANTHROPIC_MODELS = ["claude-haiku-4-5", "claude-sonnet-4-6"]; const DEFAULT_GOOGLE_MODELS = [ "gemini-3-pro-preview", "gemini-3-flash-preview", "gemini-2.5-pro", "gemini-2.5-flash" ]; async function up(knex) { await knex.schema.alterTable("directus_settings", (table) => { table.text("ai_google_api_key"); table.text("ai_openai_compatible_api_key"); table.text("ai_openai_compatible_base_url"); table.text("ai_openai_compatible_name"); table.json("ai_openai_compatible_models"); table.json("ai_openai_compatible_headers"); table.json("ai_openai_allowed_models"); table.json("ai_anthropic_allowed_models"); table.json("ai_google_allowed_models"); }); await knex("directus_settings").update({ ai_openai_allowed_models: JSON.stringify(DEFAULT_OPENAI_MODELS), ai_anthropic_allowed_models: JSON.stringify(DEFAULT_ANTHROPIC_MODELS), ai_google_allowed_models: JSON.stringify(DEFAULT_GOOGLE_MODELS) }); } async function down(knex) { await knex.schema.alterTable("directus_settings", (table) => { table.dropColumn("ai_google_api_key"); table.dropColumn("ai_openai_compatible_api_key"); table.dropColumn("ai_openai_compatible_base_url"); table.dropColumn("ai_openai_compatible_name"); table.dropColumn("ai_openai_compatible_models"); table.dropColumn("ai_openai_compatible_headers"); table.dropColumn("ai_openai_allowed_models"); table.dropColumn("ai_anthropic_allowed_models"); table.dropColumn("ai_google_allowed_models"); }); } //#endregion export { down, up };