mirror of
https://github.com/MODSetter/SurfSense.git
synced 2026-05-29 19:35:20 +02:00
- 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.
52 lines
1.9 KiB
Python
52 lines
1.9 KiB
Python
"""``AgentTaskActionParams`` — params for the ``agent_task`` action type."""
|
|
|
|
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."""
|
|
|
|
model_config = ConfigDict(extra="forbid")
|
|
|
|
query: str = Field(
|
|
...,
|
|
min_length=1,
|
|
description="User query for the agent; rendered at execute time.",
|
|
)
|
|
auto_approve_all: bool = Field(
|
|
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."
|
|
),
|
|
)
|