* feat: add workspace AI providers for AI fields
* fix: address workspace AI provider review feedback
* fix: address remaining AI provider review feedback
* fix: resolve core migration conflict
* fix: stabilize premium AI provider tests
* address feedback for local imports
* refactor: move formula field-reference visitors from premium to core
* feat: add ButtonField model and fixture (#1722)
* feat: add read-only button field type backend (#1722)
* feat: resolve database formulas client-side for the button field (#1722)
* feat: add button field type frontend (#1722)
* chore: add changelog entry for button field (#1722)
* fix: disable button field cells when the url formula is broken (#1722)
* fix: encode whitespace in resolved button field urls (#1722)
* fix: rename button field visitor tests to avoid pytest module collision
* test: add button field to expected premium export outputs
* test: add button field to remaining interesting-table test expectations
Registering the button field in construct_all_possible_field_kwargs
changed the interesting test table used by several golden-output
tests. Update the affected expectations (serialized row value, CSV
export column, and generated schema entry) to match actual behavior.
* feat: put the button field behind the button-field feature flag
* fix: address button field review nits
* fix: renumber button field migration after develop merge
* docs: describe the button field as an action field in API docs
* fix: handle raw formulas and missing field references in button fields
* fix(review): remap binary-op field refs, cache parse trees, extend button field tests
- visit both operands in BaserowFormulaReplaceFieldReferences.visitBinaryOp so
get() references inside binary expressions are remapped on import/duplication
- cache client-side formula parse trees so large grids do not re-parse the same
button formula for every row
- add tests for the urlInvalid submission block, the field-store fallback in
functional grid cells, and duplication with broken field references
* fix: keep button field type registered when the feature flag is off
Gating registration behind the flag meant that disabling it after button
fields existed made every registry lookup for those fields raise, breaking
all row, field and export endpoints for the affected tables.
The type is now always registered on both backend and frontend, matching
how other gated field types work. Creating a button field (or converting
a field to one) is rejected with ERROR_FEATURE_DISABLED while the flag is
off, and the field type dropdown hides the type entirely via the new
isVisibleInDropdown hook. Existing button fields keep rendering and their
tables keep working.
* fix: keep brackets when remapping field references in formulas
* fix: keep the button url formula mode when remapping field references
Assigning the remapped formula string to `url_formula` made the patched
`save()` re-wrap it through `to_python` as `simple` mode, undoing the
raw-mode guard in `replace_field_id_references`. A raw literal URL then
became an unparseable formula, so duplicating a table left the button
broken. Assign the whole formula object so mode and version survive.
* fix(review): share the formula field id cache and cover the flag-off cases
Move `get_table_field_ids` and its `table_schema_changed` invalidation into
core next to the visitors, so validating a button field's url formula no
longer costs a query per field on every field response. The AI prompt
validation now reads the same cache instead of its own copy.
Also list the edited field's own type in the field form dropdown even when
hidden, otherwise an existing button field renders with a blank type once
the feature flag is turned back off, and drop the always-null cell backup
on type conversion.
* chore(review): tidy the button field export branch and flag docs spacing
* test: cover the formula parse tree cache
The cache is shared by every resolveFormula caller, including the builder,
so record what it guarantees: one parse per distinct formula, raw formulas
never parsed, failures not cached, and oldest-first eviction at the cap.
Also state the read-only invariant the reuse depends on.
* fix: guard and cache the formula field reference helpers (#1722)
`get()` and `get('fields')` both parse and both pass the create API, so
remapping them raised an uncaught IndexError that aborted the whole
duplication or import job. Guard every index instead.
`extract_field_id_dependencies` also parsed raw formulas, unlike its two
sibling helpers, and re-parsed on every call. It now short-circuits raw
mode and caches the extracted ids per formula string.
* fix: keep the AI prompt's mode when remapping field references (#1722)
Moving the reference visitors to core added a raw short-circuit that
returns a bare string. `AIFieldType.after_import_serialized` re-saved
that string, so `to_python` re-wrapped a raw natural language prompt as
`simple` mode and every row's generation then failed on parsing the
prose.
Assign the whole formula object instead, the same way the button field
already does, and cover a raw prompt surviving an export/import.
* feat: add the encode_uri and encode_uri_component formula functions (#1722)
A button field's URL is built by concatenating row values, so a value
holding a reserved character corrupts it: `shoes#7` truncates to a
fragment and `a&b=1` injects a parameter. Encoding every value
automatically is not an option, because a value can legitimately be the
whole URL.
These mirror the two functions that already exist in the database
formula language and let a formula escape the parts that need it. The
backend and the browser encode identically, since button URLs resolve
client-side and everything else resolves on the server.
* fix: address review on the button field backend (#1722)
The field no longer creates a database column. It held nothing but an
always-null boolean, and that boolean leaked into the API docs and the
Local Baserow schema. `get_model_field` returns None and a
`NoDatabaseColumnField` is contributed to the generated model instead,
which Django treats as non concrete. A `ButtonFieldConverter` handles
conversion in both directions, since the lenient schema editor cannot
alter into or out of a column-less field, and the serializer is now
always-null while staying writable so the read-only validator still
rejects a write.
Also from review: only creation is gated by the feature flag, so an
existing button field stays editable with the flag off; dependencies are
read off the cached table model rather than two queries per field; and
the client is only told to re-fetch when a referenced field appears or
disappears, not when one is renamed or retyped.
* fix: address review on the button field frontend (#1722)
Without a label the button showed the percent-encoded URL. The URL is
now resolved once as the user built it and only the href is encoded, so
the label reads `https://example.com/Red Button` while the link points
at `Red%20Button`. With no label and no URL it reads "Click me".
Also from review: a read-only field the search cannot match no longer
disables optimistic row updates for every edit in a searched view, which
a valueless field like this one did; the parse tree cache evicts the
least recently used entry rather than the oldest inserted one; and the
field type reports its icon class statically and no longer claims its
cells are booleans in the API docs.
* fix: hide button fields from public views and require a label (#1722)
Button fields are no longer handed to visitors of a publicly shared view.
A new `FieldType.can_be_in_public_view` flag drives the exclusion, applied
to the public view info endpoint, the public rows queryset and the two
public websocket signal paths, so a visible field option isn't enough to
expose the label and the URL formula.
The label is now mandatory. It's the only text a button shows, so it must
be set when the field is created or converted into a button, and it can't
be emptied afterwards. The client-side fallbacks to the resolved URL and
to a default label are gone with it.
* feat: add instance AI provider management
* fix: simplify AI provider testing
* fix: remove extra model list spacing
* fix: show AI provider form errors inline
* fix: use icons for AI provider row actions
* fix: place model errors before help text
* chore: polish code
* fix: address feedback
* fix: address remaining frontend CI failures
* feat: add collapsible group-by grid view
* fix: address copilot feedback, plus some other cleanup/fixes
* fix: harden grid e2e navigation
* Add e2e tests; improve performance; clean up code
* feat: show resolved values for reference fields in group-by headers
- Resolve collaborator, link-row and select group values to renderable display
objects in the group-by data API, batched once per field per page (O(1) lookups,
no per-group queries).
- Order many-to-many groups identically to the rows via correlated-subquery
ordering, since the relation column is shadowed by the aggregated array
annotation in group-by queries.
- Render the display values as chips in the group-by banner via dedicated
multiple-select / multiple-collaborators components; shrink the collaborator
badge, reduce the field-name size and keep the label on one line.
* fix: group many-to-many fields by their set of values
Grouping a grid by a collaborator, multiple-select or link-row field
produced empty groups with orphaned rows and duplicate headers for the
same set of values. The group key (an id array) was order-sensitive: the
backend's aggregated array order was unstable row-to-row and the cell
appends new values, so an optimistically-created group's key diverged
from the server's and rows were rejected by rowBelongsToGroupBySection.
- pathKey and the group-row Vue keys now sort m2m id arrays numerically,
so a group is identified by its set of ids, not their order.
- The backend aggregates the group value ordered by related id and sorts
the group's unique value, making grouping deterministic and set-based.
- Optimistically-emptied groups (row_count 0) are no longer rendered (the
node is kept for reconciliation), and the leading group gap is fixed so
the first visible group has no spurious gap.
- A newly created collaborator group resolves its badge name from the
workspace store instead of requiring the name on the value.
* fix: keep cell multi-select when dragging in a group-by view
A multi-select drag ends with a click whose target is the rows
container (the common ancestor of the dragged cells). cancelMultiSelect-
IfActive cancels the selection unless that container is recognised as
part of the rows area, but its whitelist only knew the flat-grid classes
(grid-view__rows / grid-view__row). The collapsible group-by feature
renders rows in grid-view__group-by-rows containers, so the post-drag
click was treated as "outside the rows" and the selection was cleared on
mouseup. Add the group-by row containers to the whitelist.
* test: expect emptied group-by banners to disappear
The optimistic empty-group hiding (a group disappears once its last row
moves out) made the e2e contract that kept the emptied source group
visible at row_count 0 obsolete. Update the 2.2.7/2.4.4 assertions to
expect the emptied group's banner to be gone (new expectNoGroupByBanner
helper), and correct the tree-maintenance comments: the node is still
kept for reconciliation, but the layout no longer renders its banner.
* perf: load the collapsible group-by grid in one bounded request
Grouping a wide table by many fields took several seconds and a request
waterfall to render the first screen. The group tree was fetched one HTTP
request per depth, a budget that ran out before reaching any leaf forced
a per-parent fallback, and the rows endpoint resolved group-by metadata
unconditionally.
Backend
- Walk the descendant tree with one batched windowed query per group-by
level (get_group_by_data_for_parents) instead of one query per parent,
so a single include_descendants request returns the whole visible
subtree in O(depth) queries.
- Scale the descent window to the viewport: row_budget = ceil(limit /
depth). A deep group-by stacks each leaf row under its ancestor
banners, so far fewer leaf rows fill the first screen; the window now
returns a viewport-sized slice (~264 -> ~68 groups on a 12-level grid)
and the rest lazy-loads on scroll.
- Gate the rows endpoint's group-by metadata behind
include=group_by_metadata so it is not computed when unused.
- Resolve reference/link-row display values in one id__in query per field
across all pages instead of once per page.
Frontend
- Initial load issues one group-by-data prefetch and one viewport rows
request; expand mode no longer takes the per-depth path.
- Cap the banner indent (<=50px) and shrink the per-level arrow spacing
as the group-by count grows, keeping the count aligned and the field
name ellipsised; render multi-level loading skeletons for the
not-yet-loaded levels.
- Guard walkPage against a cyclic page-resolution stack overflow and keep
activeGroupBys filtered to fields that still exist.
Plus e2e env isolation (configurable ports, cookie prefix) and docs.
* fix: address review feedback
Addresses the review comments on the collapsible group-by grid PR.
- Gate the group-by add-row "+" on the same condition as the flat grid
(not read-only, not a one-way data sync, has create-row permission), so
it no longer renders buttons that error on click for data-sync tables.
- Show the "(Empty)" label for empty array-valued groups (multiple select,
link row, collaborators), matching the text-field behaviour.
- Stop the flat-grid row placeholder from rendering in group-by mode
(v-else-if instead of v-else).
- Render formula group-by headers via the result field type's group-by
component instead of RowCardFieldFormula, removing the dev-only
"Missing required prop: row" Vue warning.
- Keep the cell selected at the first/last field for both Tab and arrow
keys (restore the pre-refactor behaviour); navigating past the edge no
longer drops the selection in either flat or group-by mode.
- Re-enable and de-flake the "sorted add outside buffer" e2e test: assert
on the re-resolved last row instead of a snapshotted renderedRowCount()
index, which raced with the create-confirmation re-render in CI.
* fix: keep rows inserted below in a grouped grid view in their group
Insert-below and add-row in a grouped view now derive the new row's group
path from the neighbouring row, so it inherits all writable group-by values
and lands in the same group; `before` is set only when the next row shares
that group.
* feat: soft-cap adding group-bys at 5 in the view UI
Once a view reaches 5 group-bys the add button is disabled with a tooltip;
views that already have more keep working and only offer to remove them.
* limit group-bys; fix css
* refactor: polish code and comments
* fix: address Bram's feedback
* feat: add vertical gap between sibling sub-groups and indent banner labels with their chevron
* fix: address remaining feedback
* fix: row-coloring and fixed-height for add-row
* fix: address Bram's feedback v2
* fix regression in last commit
* fix: address grid group review comments
Stop accepting unsolicited external pull requests and remove the internal
external-contributions triage doc, per the decision announced in #5598.
Update the task issue template and README pointer accordingly.
* chore: integrate pre-commit hooks for backend and frontend code quality enforcement
* fix: uv.lock
* refactor: consolidate pre-commit hooks to use just recipes and add a pre-commit-uninstall command
* docs: document pre-commit branch linting and update pre-commit configuration to increase file size limits and remove serial execution requirements.
* feat(mcp): refactor tools to service layer and add database/table/field CRUD
Replace internal API request pattern with a dedicated service module for
MCP operations. Simplify tool architecture from dynamic per-table tools
to static tools with explicit table_id parameters. Add new tools for
managing databases, tables, fields, and batch row operations.
* fix(mcp): address Copilot review feedback
- Let exceptions propagate from MCPTool.call() so call_tool() logs them
- Fix N+1 queries in get_table_schema using enhance_field_queryset hook
- Fetch fields for all tables in a single specific_iterator pass
- Clamp list_rows pagination to safe bounds (ROW_PAGE_SIZE_LIMIT)
- Fix update_fields docstring to reflect type-change support
- Fix module path in utils.py comment
- Update "Adding a new tool" docs to match current MCPTool pattern
* fix: comment risky tools; waiting for a proper permission check
* feat(mcp): add enabled flag to MCPTool and disable risky tools
Add `enabled` attribute to MCPTool base class so tools can be registered
but hidden from MCP clients. Disable database/table/field CRUD tools
until users can control tool availability through the UI.
Also add docs/testing/mcp-test-plan.md with manual testing instructions.
* fix(mcp): replace list[dict] with typed Pydantic models for field/row specs
Validate required keys (name+type for field create, id for field update,
id for row update) at the schema level instead of relying on KeyError
from dict.pop() in the service layer.
Uses extra="allow" so type-specific options and field values pass through.
* fix: wrap update_rows in a transaction
* address feedback
* feat(assistant): add theme catalog, apply_theme, and theme templates
Add 20 new theme templates and theme infrastructure:
- THEME_CATALOG with 22 themes, ThemeName type, _load_theme_data(), apply_theme()
- BuilderItemCreate.theme field with auto-apply on creation
- set_theme() tool for changing themes on existing applications
- Unit tests and eval tests for theme functionality
* refactor(assistant): migrate theme evals to EvalChecklist pattern
Replace removed assert_no_tool_errors with EvalChecklist + count_tool_errors
in test_agent_creates_app_with_theme and test_agent_changes_theme. Remove
stale test_navigate_to_workspace test.
* refactor(assistant): move theme code from core/types to builder/themes
Theme catalog, apply_theme, and related helpers are a builder concern,
not core. Move them to tools/builder/themes.py so core never imports
from builder. Also make apply_theme return bool so set_theme can report
errors instead of silently claiming success, and fix "Thank youb" typo
across all 23 theme templates.
* refactor (AI field): remove langchain and use pydantic-ai (#5017)
* refactor(ai): replace langchain with pydantic-ai for LLM calls and structured output
Replace langchain dependency with pydantic-ai as the LLM abstraction
layer. Each GenerativeAIModelType now implements get_ai_model() returning
a pydantic-ai Model instance, and the base class provides prompt() and
prompt_structured() using Agent.run_sync().
- Remove langchain, langchain-openai, and direct openai/anthropic/mistralai
deps (pydantic-ai-slim extras install them)
- Add prompt_structured() with PromptedOutput for Pydantic model output
(e.g. BaserowFormulaModel)
- Add output_choices parameter to prompt() for constrained choice selection
with fuzzy matching, compatible with all models including those without
tool support
- Remove custom output_parsers.py (StrictEnumOutputParser, JsonOutputParser
replacements)
- Update AI field job flow to use prompt(output_choices=...) for choice
output and prompt_with_files fallback for file-based prompts
* refactor(ai): replace deprecated Assistants API with pydantic-ai multi-modal content
Replace OpenAI's deprecated Assistants API (file_search, threads, polling)
with pydantic-ai's native BinaryContent support. Files are now read from
storage and passed directly in the prompt as multi-modal content — no
upload/delete lifecycle needed.
- Add content parameter to prompt() for multi-modal file attachments
- Remove GenerativeAIWithFilesModelType abstract class and its upload/
delete/prompt_with_files methods
- Remove get_client() from BaseOpenAIGenerativeAIModelType (no longer
needed without file operations)
- Replace AIFileManager.upload_files_from_file_field() with
get_file_contents() returning BinaryContent objects
- Simplify job_types.py: file+choice paths merge into single prompt()
call with content and output_choices parameters
- Remove format_prompt/parse_output hooks (no longer needed)
- Remove FileId type alias and AIFileError exception
- Works with any provider that supports documents (OpenAI, Anthropic,
Mistral, Google) instead of only OpenAI
* refactor(ai): unify prompt API into single method with output_type parameter
Merge prompt_structured() into prompt() via the output_type parameter:
- None (default): plain text response
- list[str]: choice selection with fuzzy matching
- Pydantic BaseModel/TypedDict: structured output via PromptedOutput
Remove prompt_structured(), output_choices parameter, and dead code
(format_prompt, parse_output hooks, AIFileError, FileId type).
* refactor(ai): clean file handling API with model type owning processing logic
Redesign file handling so the model type owns all file processing decisions
(embed vs upload, size limits, count limits) while the manager only reads
metadata from storage and provides a lazy reader callback.
- Add supports_files flag and prepare_files() to GenerativeAIModelType base
- OpenAI implementation: embeds images inline (BinaryContent, 50MB/500 limit),
uploads documents (UploadedFile via Responses API)
- Use OpenAIResponsesModel instead of OpenAIChatModel for OpenAI provider
(supports all file types via input_file/input_image)
- AIFileManager.prepare_file_content() collects metadata, passes lazy
read_file callback — no data read until model type requests it
- Remove is_file_compatible/get_max_file_size from public API (moved into
prepare_files)
- Add type hints throughout
* fix(assistant): fix generate_formula tests and grid view row_height
- Add output_type param to TestGenerativeAIModelTypePromptError.prompt()
- Return BaserowFormulaModel in test mocks instead of raw JSON string
- Use correct ORM field name row_height_size in grid view from_django_orm
* docs: add AI field test plan
* refactor(ai): improve docstrings, fix prompt signature and empty prompt handling
* refactor(ai): merge ERROR_OUTPUT_PARSER into ERROR_GENERATIVE_AI_PROMPT
The distinction between output parsing errors and prompt errors didn't
provide actionable info to the user. Both now surface as a single
ERROR_GENERATIVE_AI_PROMPT error code.
* refactor(ai): move value generation into AIFieldHandler with AIFile abstraction
Introduce AIFile dataclass that wraps serialized UserFile dicts with
lazy read_content(). Move the core generation logic from
AIValueGenerator._generate_value_for into AIFieldHandler.generate_value_with_ai
so the handler owns the full flow: prompt resolution, file preparation,
AI call, file cleanup, and choice resolution.
- prepare_files() now takes list[AIFile] and returns only processed files
- cleanup_files() mirrors prepare_files() for provider file cleanup
- delete_file() takes AIFile instead of raw file_id string
- AIFieldEmptyPromptError raised when prompt resolves to empty
- Delete AIFileManager (absorbed into handler + model type)
* docs: add AI field architecture overview
* fix(ai): handle missing files and partial upload cleanup in prepare_files
- OpenAI prepare_files() now catches per-file errors (missing files,
upload failures) and skips them instead of failing the whole generation
- Handler cleanup uses ai_files instead of prepared so files uploaded
before a mid-prepare failure are still cleaned up
* fix(ai): normalize LLM responses before choice matching
Strip quotes, markdown bold, backticks, and trailing punctuation from
model responses before fuzzy matching. Use case-insensitive comparison
so responses like "POSITIVE" correctly match "Positive".
* address feedback
* Address feedback
* trixie and python 3.13
* Fix backend tests
* Fix various references to previous python 3.11
* Upgrade to python 3.14
* Use official version of caddy
* Update backend/Dockerfile
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
* Fix dev build
---------
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
* chore (AI-Assistant): add embeddings to docker-compose.dev.yml; improve installation docs
* Fix flaky test
* Address feedback
* Fix just dev down to stop all services
* create backend justfile; switch to uv
* Add deploy and dc-deploy recipes to build images
* Add uv.lock for reproducible builds
* CI fixes + improvements
* Reduce build time
* improve CI caching
* Improve exit early conditions
* Set requires_python==3.11.*; add backend/media to gitignore
* Fix all-in-one Dockerfiles and some other fixes
* Introduce frontend justfile + some other useful recipes
* Fix permissions issue with dev containers
* Improve dockerfiles and docs on how to use the dev env
* Fix mjml-email-compiler service
* Update docs + address feedback
* Fix containers healthchecks
* Fix yarn test in dev container
* Minor fixes to docs and justfile attach command
* Address Petr's feedback
* Address additional feedback
* Add changelog entry
* Address feedback: Petr and Przemek
* address feedback + prepare for saas PR
* minor fixes
* Address Bram's feedback 2
* Switch to udspy
* fix search tool and message history
* Added embeddings server docs
* Remove remaining litellm references
* bump udspy version to v0.1.6
* Added docs for setting up the AI-assistant
* fixed table
* port workflow formula generation tools to udspy
* Set a fake OPENAI_API_KEY for tests
* Fix flaky tests
---------
Co-authored-by: Bram Wiepjes <bramw@protonmail.com>
* Preparing for WA beta.
* Reintroducing Instance.compat_type to ensure that we still support our old node types for compat reasons.
* Revert the periodic type name.
* Post rebase linting
* Show the automation settings modal, but only show the General sidepanel in development.
* Fix e2e test