feat(automations): added UI and improved mentions

- Added support for @-mentions in agent tasks, allowing users to reference documents, folders, and connectors directly in their queries.
- Updated `run_agent_task` to resolve mentions and include them in the context passed to the agent.
- Introduced new parameters in `AgentTaskActionParams` for handling mentioned document and connector IDs.
- Refactored the automation edit and new components to utilize the new `AutomationBuilderForm` for a more streamlined user experience.
- Removed deprecated JSON forms to simplify the automation creation process.
This commit is contained in:
DESKTOP-RTLN3BA\$punk 2026-05-28 21:26:32 -07:00
parent c601a9b102
commit d013617bf6
25 changed files with 2490 additions and 281 deletions

View file

@ -4,6 +4,8 @@ from __future__ import annotations
from pydantic import BaseModel, ConfigDict, Field
from app.schemas.new_chat import MentionedDocumentInfo
class AgentTaskActionParams(BaseModel):
"""Run a multi_agent_chat turn from an automation step."""
@ -19,3 +21,32 @@ class AgentTaskActionParams(BaseModel):
default=False,
description="If true, every HITL approval is auto-approved; otherwise rejected.",
)
# @-mention references chosen in the task input. Mirror the ``new_chat``
# request fields (minus SurfSense product docs) so the run can scope
# retrieval to the user's selected files / folders / connectors. All
# optional and additive; a task with no mentions behaves as before.
mentioned_document_ids: list[int] | None = Field(
default=None,
description="Knowledge-base document IDs the task references with @.",
)
mentioned_folder_ids: list[int] | None = Field(
default=None,
description="Knowledge-base folder IDs the task references with @.",
)
mentioned_connector_ids: list[int] | None = Field(
default=None,
description="Concrete connector account IDs the task references with @.",
)
mentioned_connectors: list[MentionedDocumentInfo] | None = Field(
default=None,
description="Display/context metadata for the @-mentioned connector accounts.",
)
mentioned_documents: list[MentionedDocumentInfo] | None = Field(
default=None,
description=(
"Chip metadata (id, title, kind, ...) for every @-mention so the "
"run can resolve titles to virtual paths and substitute them in "
"the query."
),
)