mirror of
https://github.com/baserow/baserow.git
synced 2026-12-05 16:58:36 +00:00
* feat: per-feature and workspace-level AI model settings Baserow could only point every AI feature at one instance-wide model. An administrator can now register provider models, declare which AI features each model may serve, and pick the default model per feature; a workspace admin can inherit that choice, override it, or disable the feature locally. The assistant resolves its model once per logical request and threads that snapshot through its nested agents and tools, so a single run can no longer re-read settings repeatedly or pick a model other than the one it validated. The scoped provider state is memoized for the duration of a request, keeping workspace serialization from loading it once per workspace. Also: - add Google and Groq provider types, and keep these database-only providers out of the legacy workspace settings they cannot round-trip through; - prune orphaned feature selections so an unloaded feature type's RESTRICT FK no longer blocks provider and model deletion; - record whether a configured model answers text and tool-calling probes, and invalidate that result when its credentials or identifier change; - broadcast provider and availability changes over the existing realtime channel so open clients update without reloading; - read the assistant model from the shared configmap, so frontend pods no longer miss it on Helm installs. Manual test instructions live in docs/testing/kuma-model-settings-test-plan.md. * fix: address AI provider settings review feedback
416 lines
14 KiB
JavaScript
416 lines
14 KiB
JavaScript
// plugins/baserow.js
|
|
import { defineNuxtPlugin } from '#app'
|
|
|
|
import { Registry } from '@baserow/modules/core/registry'
|
|
import { PasswordAuthProviderType } from '@baserow/modules/core/authProviderTypes'
|
|
import {
|
|
CreateSnapshotJobType,
|
|
DuplicateApplicationJobType,
|
|
ExportApplicationsJobType,
|
|
ImportApplicationsJobType,
|
|
InstallTemplateJobType,
|
|
RestoreSnapshotJobType,
|
|
} from '@baserow/modules/core/jobTypes'
|
|
|
|
import {
|
|
AccountSettingsType,
|
|
PasswordSettingsType,
|
|
EmailSettingsType,
|
|
EmailNotificationsSettingsType,
|
|
MCPEndpointSettingsType,
|
|
DeleteAccountSettingsType,
|
|
TwoFactorAuthSettingsType,
|
|
} from '@baserow/modules/core/settingsTypes'
|
|
import { GenerativeAIWorkspaceSettingsType } from '@baserow/modules/core/workspaceSettingsTypes'
|
|
import {
|
|
OpenAIModelType,
|
|
OllamaModelType,
|
|
AnthropicModelType,
|
|
MistralModelType,
|
|
OpenRouterModelType,
|
|
GoogleModelType,
|
|
GroqModelType,
|
|
} from '@baserow/modules/core/generativeAIModelTypes'
|
|
import {
|
|
UploadFileUserFileUploadType,
|
|
UploadViaURLUserFileUploadType,
|
|
} from '@baserow/modules/core/userFileUploadTypes'
|
|
import {
|
|
AIProvidersAdminType,
|
|
DashboardAdminType,
|
|
UsersAdminType,
|
|
WorkspacesAdminType,
|
|
HealthCheckAdminType,
|
|
SettingsAdminType,
|
|
} from '@baserow/modules/core/adminTypes'
|
|
|
|
import {
|
|
BasicPermissionManagerType,
|
|
CorePermissionManagerType,
|
|
StaffPermissionManagerType,
|
|
WorkspaceMemberPermissionManagerType,
|
|
StaffOnlySettingOperationPermissionManagerType,
|
|
AllowIfTemplateOperationPermissionManagerType,
|
|
} from '@baserow/modules/core/permissionManagerTypes'
|
|
|
|
import {
|
|
MembersWorkspaceSettingsPageType,
|
|
InvitesWorkspaceSettingsPageType,
|
|
} from '@baserow/modules/core/workspaceSettingsPageTypes'
|
|
import {
|
|
WorkspaceInvitationCreatedNotificationType,
|
|
WorkspaceInvitationAcceptedNotificationType,
|
|
WorkspaceInvitationRejectedNotificationType,
|
|
BaserowVersionUpgradeNotificationType,
|
|
AbuseReportCreatedNotificationType,
|
|
} from '@baserow/modules/core/notificationTypes'
|
|
import { MoreOnboardingType } from '@baserow/modules/core/onboardingTypes'
|
|
import { SidebarGuidedTourType } from '@baserow/modules/core/guidedTourTypes'
|
|
import { TOTPAuthType } from '@baserow/modules/core/twoFactorAuthTypes'
|
|
import { CloudflareTurnstileCaptchaProviderType } from '@baserow/modules/core/captchaProviderTypes'
|
|
|
|
import { DefaultErrorPageType } from '@baserow/modules/core/errorPageTypes'
|
|
|
|
import {
|
|
RuntimeAdd,
|
|
RuntimeMinus,
|
|
RuntimeMultiply,
|
|
RuntimeDivide,
|
|
RuntimeGreaterThan,
|
|
RuntimeGreaterThanOrEqual,
|
|
RuntimeLessThan,
|
|
RuntimeLessThanOrEqual,
|
|
RuntimeConcat,
|
|
RuntimeGet,
|
|
RuntimeEqual,
|
|
RuntimeNotEqual,
|
|
RuntimeUpper,
|
|
RuntimeLower,
|
|
RuntimeCapitalize,
|
|
RuntimeRound,
|
|
RuntimeAbs,
|
|
RuntimeIsEven,
|
|
RuntimeIsOdd,
|
|
RuntimeDateTimeFormat,
|
|
RuntimeDay,
|
|
RuntimeMonth,
|
|
RuntimeYear,
|
|
RuntimeHour,
|
|
RuntimeMinute,
|
|
RuntimeSecond,
|
|
RuntimeNow,
|
|
RuntimeNull,
|
|
RuntimeNumberFormat,
|
|
RuntimeToDuration,
|
|
RuntimeDurationFormat,
|
|
RuntimeToday,
|
|
RuntimeGetProperty,
|
|
RuntimeRandomInt,
|
|
RuntimeRandomFloat,
|
|
RuntimeRandomBool,
|
|
RuntimeGenerateUUID,
|
|
RuntimeIf,
|
|
RuntimeAnd,
|
|
RuntimeOr,
|
|
RuntimeReplace,
|
|
RuntimeLength,
|
|
RuntimeContains,
|
|
RuntimeReverse,
|
|
RuntimeJoin,
|
|
RuntimeSplit,
|
|
RuntimeIsEmpty,
|
|
RuntimeStrip,
|
|
RuntimeEncodeUri,
|
|
RuntimeEncodeUriComponent,
|
|
RuntimeSum,
|
|
RuntimeAvg,
|
|
RuntimeAt,
|
|
RuntimeRange,
|
|
RuntimeToArray,
|
|
RuntimeToJson,
|
|
RuntimeFromJson,
|
|
RuntimeToDatetime,
|
|
} from '@baserow/modules/core/runtimeFormulaTypes'
|
|
|
|
import {
|
|
AdminRoleType,
|
|
MemberRoleType,
|
|
} from '@baserow/modules/database/roleTypes'
|
|
|
|
export default defineNuxtPlugin({
|
|
name: 'core',
|
|
dependsOn: ['priorityBus', 'registry', 'i18n'],
|
|
setup(nuxtApp) {
|
|
const registry = nuxtApp.$registry
|
|
|
|
registry.registerNamespace('plugin')
|
|
registry.registerNamespace('permissionManager')
|
|
registry.registerNamespace('application')
|
|
registry.registerNamespace('authProvider')
|
|
registry.registerNamespace('job')
|
|
registry.registerNamespace('view')
|
|
registry.registerNamespace('field')
|
|
registry.registerNamespace('settings')
|
|
registry.registerNamespace('workspaceSettings')
|
|
registry.registerNamespace('userFileUpload')
|
|
registry.registerNamespace('membersPagePlugins')
|
|
registry.registerNamespace('runtimeFormulaFunction')
|
|
registry.registerNamespace('notification')
|
|
registry.registerNamespace('workflowAction')
|
|
registry.registerNamespace('integration')
|
|
registry.registerNamespace('service')
|
|
registry.registerNamespace('userSource')
|
|
registry.registerNamespace('appAuthProvider')
|
|
registry.registerNamespace('roles')
|
|
registry.registerNamespace('generativeAIModel')
|
|
registry.registerNamespace('aiProviderModelFeature')
|
|
registry.registerNamespace('onboarding')
|
|
registry.registerNamespace('guidedTour')
|
|
registry.registerNamespace('admin')
|
|
registry.registerNamespace('workspaceSettingsPage')
|
|
registry.registerNamespace('errorPage')
|
|
registry.registerNamespace('twoFactorAuth')
|
|
registry.registerNamespace('captchaProvider')
|
|
|
|
const context = { app: nuxtApp }
|
|
|
|
registry.register('settings', new AccountSettingsType(context))
|
|
registry.register('settings', new PasswordSettingsType(context))
|
|
registry.register('settings', new EmailSettingsType(context))
|
|
registry.register('settings', new EmailNotificationsSettingsType(context))
|
|
registry.register('settings', new MCPEndpointSettingsType(context))
|
|
registry.register('settings', new DeleteAccountSettingsType(context))
|
|
registry.register('settings', new TwoFactorAuthSettingsType(context))
|
|
|
|
registry.register(
|
|
'workspaceSettings',
|
|
new GenerativeAIWorkspaceSettingsType(context)
|
|
)
|
|
|
|
registry.register('generativeAIModel', new OpenAIModelType(context))
|
|
registry.register('generativeAIModel', new AnthropicModelType(context))
|
|
registry.register('generativeAIModel', new GoogleModelType(context))
|
|
registry.register('generativeAIModel', new GroqModelType(context))
|
|
registry.register('generativeAIModel', new MistralModelType(context))
|
|
registry.register('generativeAIModel', new OllamaModelType(context))
|
|
registry.register('generativeAIModel', new OpenRouterModelType(context))
|
|
|
|
registry.register(
|
|
'permissionManager',
|
|
new CorePermissionManagerType(context)
|
|
)
|
|
registry.register(
|
|
'permissionManager',
|
|
new StaffPermissionManagerType(context)
|
|
)
|
|
registry.register(
|
|
'permissionManager',
|
|
new WorkspaceMemberPermissionManagerType(context)
|
|
)
|
|
registry.register(
|
|
'permissionManager',
|
|
new BasicPermissionManagerType(context)
|
|
)
|
|
registry.register(
|
|
'permissionManager',
|
|
new StaffOnlySettingOperationPermissionManagerType(context)
|
|
)
|
|
registry.register(
|
|
'permissionManager',
|
|
new AllowIfTemplateOperationPermissionManagerType(context)
|
|
)
|
|
|
|
registry.register(
|
|
'userFileUpload',
|
|
new UploadFileUserFileUploadType(context)
|
|
)
|
|
registry.register(
|
|
'userFileUpload',
|
|
new UploadViaURLUserFileUploadType(context)
|
|
)
|
|
|
|
registry.register('admin', new DashboardAdminType(context))
|
|
registry.register('admin', new UsersAdminType(context))
|
|
registry.register('admin', new WorkspacesAdminType(context))
|
|
registry.register('admin', new AIProvidersAdminType(context))
|
|
registry.register('admin', new SettingsAdminType(context))
|
|
registry.register('admin', new HealthCheckAdminType(context))
|
|
|
|
registry.register('authProvider', new PasswordAuthProviderType(context))
|
|
|
|
registry.register('job', new DuplicateApplicationJobType(context))
|
|
registry.register('job', new InstallTemplateJobType(context))
|
|
registry.register('job', new CreateSnapshotJobType(context))
|
|
registry.register('job', new RestoreSnapshotJobType(context))
|
|
registry.register('job', new ExportApplicationsJobType(context))
|
|
registry.register('job', new ImportApplicationsJobType(context))
|
|
|
|
registry.register(
|
|
'workspaceSettingsPage',
|
|
new MembersWorkspaceSettingsPageType(context)
|
|
)
|
|
registry.register(
|
|
'workspaceSettingsPage',
|
|
new InvitesWorkspaceSettingsPageType(context)
|
|
)
|
|
|
|
registry.register('runtimeFormulaFunction', new RuntimeConcat(context))
|
|
registry.register('runtimeFormulaFunction', new RuntimeGet(context))
|
|
registry.register('runtimeFormulaFunction', new RuntimeAdd(context))
|
|
registry.register('runtimeFormulaFunction', new RuntimeMinus(context))
|
|
registry.register('runtimeFormulaFunction', new RuntimeMultiply(context))
|
|
registry.register('runtimeFormulaFunction', new RuntimeDivide(context))
|
|
registry.register('runtimeFormulaFunction', new RuntimeGreaterThan(context))
|
|
registry.register(
|
|
'runtimeFormulaFunction',
|
|
new RuntimeGreaterThanOrEqual(context)
|
|
)
|
|
registry.register('runtimeFormulaFunction', new RuntimeLessThan(context))
|
|
registry.register(
|
|
'runtimeFormulaFunction',
|
|
new RuntimeLessThanOrEqual(context)
|
|
)
|
|
registry.register('runtimeFormulaFunction', new RuntimeEqual(context))
|
|
registry.register('runtimeFormulaFunction', new RuntimeNotEqual(context))
|
|
registry.register('runtimeFormulaFunction', new RuntimeUpper(context))
|
|
registry.register('runtimeFormulaFunction', new RuntimeLower(context))
|
|
registry.register('runtimeFormulaFunction', new RuntimeCapitalize(context))
|
|
registry.register('runtimeFormulaFunction', new RuntimeRound(context))
|
|
registry.register('runtimeFormulaFunction', new RuntimeAbs(context))
|
|
registry.register('runtimeFormulaFunction', new RuntimeIsEven(context))
|
|
registry.register('runtimeFormulaFunction', new RuntimeIsOdd(context))
|
|
registry.register(
|
|
'runtimeFormulaFunction',
|
|
new RuntimeDateTimeFormat(context)
|
|
)
|
|
registry.register('runtimeFormulaFunction', new RuntimeDay(context))
|
|
registry.register('runtimeFormulaFunction', new RuntimeMonth(context))
|
|
registry.register('runtimeFormulaFunction', new RuntimeYear(context))
|
|
registry.register('runtimeFormulaFunction', new RuntimeHour(context))
|
|
registry.register('runtimeFormulaFunction', new RuntimeMinute(context))
|
|
registry.register('runtimeFormulaFunction', new RuntimeSecond(context))
|
|
registry.register('runtimeFormulaFunction', new RuntimeNow(context))
|
|
registry.register('runtimeFormulaFunction', new RuntimeToday(context))
|
|
registry.register('runtimeFormulaFunction', new RuntimeGetProperty(context))
|
|
registry.register('runtimeFormulaFunction', new RuntimeRandomInt(context))
|
|
registry.register('runtimeFormulaFunction', new RuntimeRandomFloat(context))
|
|
registry.register('runtimeFormulaFunction', new RuntimeRandomBool(context))
|
|
registry.register(
|
|
'runtimeFormulaFunction',
|
|
new RuntimeGenerateUUID(context)
|
|
)
|
|
registry.register('runtimeFormulaFunction', new RuntimeIf(context))
|
|
registry.register('runtimeFormulaFunction', new RuntimeAnd(context))
|
|
registry.register('runtimeFormulaFunction', new RuntimeOr(context))
|
|
registry.register('runtimeFormulaFunction', new RuntimeReplace(context))
|
|
registry.register('runtimeFormulaFunction', new RuntimeLength(context))
|
|
registry.register('runtimeFormulaFunction', new RuntimeContains(context))
|
|
registry.register('runtimeFormulaFunction', new RuntimeReverse(context))
|
|
registry.register('runtimeFormulaFunction', new RuntimeJoin(context))
|
|
registry.register('runtimeFormulaFunction', new RuntimeSplit(context))
|
|
registry.register('runtimeFormulaFunction', new RuntimeIsEmpty(context))
|
|
registry.register('runtimeFormulaFunction', new RuntimeStrip(context))
|
|
registry.register('runtimeFormulaFunction', new RuntimeEncodeUri(context))
|
|
registry.register(
|
|
'runtimeFormulaFunction',
|
|
new RuntimeEncodeUriComponent(context)
|
|
)
|
|
registry.register('runtimeFormulaFunction', new RuntimeSum(context))
|
|
registry.register('runtimeFormulaFunction', new RuntimeAvg(context))
|
|
registry.register('runtimeFormulaFunction', new RuntimeAt(context))
|
|
registry.register('runtimeFormulaFunction', new RuntimeToArray(context))
|
|
registry.register('runtimeFormulaFunction', new RuntimeRange(context))
|
|
registry.register('runtimeFormulaFunction', new RuntimeToJson(context))
|
|
registry.register('runtimeFormulaFunction', new RuntimeFromJson(context))
|
|
registry.register('runtimeFormulaFunction', new RuntimeNull(context))
|
|
registry.register(
|
|
'runtimeFormulaFunction',
|
|
new RuntimeNumberFormat(context)
|
|
)
|
|
registry.register('runtimeFormulaFunction', new RuntimeToDuration(context))
|
|
registry.register(
|
|
'runtimeFormulaFunction',
|
|
new RuntimeDurationFormat(context)
|
|
)
|
|
registry.register('runtimeFormulaFunction', new RuntimeToDatetime(context))
|
|
registry.register('errorPage', new DefaultErrorPageType(context))
|
|
|
|
const fns = [
|
|
RuntimeConcat,
|
|
RuntimeGet,
|
|
RuntimeAdd,
|
|
RuntimeMinus,
|
|
RuntimeMultiply,
|
|
RuntimeDivide,
|
|
RuntimeGreaterThan,
|
|
RuntimeGreaterThanOrEqual,
|
|
RuntimeLessThan,
|
|
RuntimeLessThanOrEqual,
|
|
RuntimeEqual,
|
|
RuntimeNotEqual,
|
|
RuntimeUpper,
|
|
RuntimeLower,
|
|
RuntimeCapitalize,
|
|
RuntimeRound,
|
|
RuntimeIsEven,
|
|
RuntimeIsOdd,
|
|
RuntimeDateTimeFormat,
|
|
RuntimeDay,
|
|
RuntimeMonth,
|
|
RuntimeYear,
|
|
RuntimeHour,
|
|
RuntimeMinute,
|
|
RuntimeSecond,
|
|
RuntimeNow,
|
|
RuntimeToday,
|
|
RuntimeGetProperty,
|
|
RuntimeRandomInt,
|
|
RuntimeRandomFloat,
|
|
RuntimeRandomBool,
|
|
RuntimeGenerateUUID,
|
|
RuntimeIf,
|
|
RuntimeAnd,
|
|
RuntimeOr,
|
|
]
|
|
|
|
fns.forEach((Fn) =>
|
|
registry.register('runtimeFormulaFunction', new Fn(context))
|
|
)
|
|
|
|
registry.register('roles', new AdminRoleType(context))
|
|
registry.register('roles', new MemberRoleType(context))
|
|
|
|
registry.register(
|
|
'notification',
|
|
new WorkspaceInvitationCreatedNotificationType(context)
|
|
)
|
|
registry.register(
|
|
'notification',
|
|
new WorkspaceInvitationAcceptedNotificationType(context)
|
|
)
|
|
registry.register(
|
|
'notification',
|
|
new WorkspaceInvitationRejectedNotificationType(context)
|
|
)
|
|
registry.register(
|
|
'notification',
|
|
new BaserowVersionUpgradeNotificationType(context)
|
|
)
|
|
registry.register(
|
|
'notification',
|
|
new AbuseReportCreatedNotificationType(context)
|
|
)
|
|
|
|
registry.register('twoFactorAuth', new TOTPAuthType(context))
|
|
|
|
registry.register(
|
|
'captchaProvider',
|
|
new CloudflareTurnstileCaptchaProviderType(context)
|
|
)
|
|
|
|
registry.register('onboarding', new MoreOnboardingType(context))
|
|
|
|
registry.register('guidedTour', new SidebarGuidedTourType(context))
|
|
},
|
|
})
|