mirror of
https://github.com/MODSetter/SurfSense.git
synced 2026-07-06 22:12:12 +02:00
- Standardized the web crawler to use Scrapling exclusively, removing Firecrawl entirely. - Updated the crawler's location to `app/proprietary/web_crawler/connector.py` under a non-Apache-2 license boundary. - Refactored the `WebCrawlerConnector` to eliminate the Firecrawl API key dependency, simplifying the interface for crawling URLs. - Adjusted related components to accommodate the new structure and ensure successful crawl outcomes are properly handled. - Updated documentation to reflect these changes and the new implementation status.
52 lines
1.6 KiB
Python
52 lines
1.6 KiB
Python
"""Single per-thread agent (re)build path.
|
|
|
|
A graph swap mid-turn would corrupt checkpointer state for the same
|
|
``thread_id``, so both the initial build and any mid-stream 429 recovery rebuild
|
|
must funnel through this single function.
|
|
"""
|
|
|
|
from __future__ import annotations
|
|
|
|
from typing import Any
|
|
|
|
from app.agents.chat.multi_agent_chat.shared.filesystem_selection import (
|
|
FilesystemSelection,
|
|
)
|
|
from app.agents.chat.runtime.llm_config import AgentConfig
|
|
from app.auth.context import AuthContext
|
|
from app.db import ChatVisibility
|
|
from app.services.connector_service import ConnectorService
|
|
|
|
|
|
async def build_main_agent_for_thread(
|
|
agent_factory: Any,
|
|
*,
|
|
llm: Any,
|
|
workspace_id: int,
|
|
db_session: Any,
|
|
connector_service: ConnectorService,
|
|
checkpointer: Any,
|
|
user_id: str | None,
|
|
thread_id: int | None,
|
|
agent_config: AgentConfig | None,
|
|
thread_visibility: ChatVisibility | None,
|
|
filesystem_selection: FilesystemSelection | None,
|
|
disabled_tools: list[str] | None = None,
|
|
mentioned_document_ids: list[int] | None = None,
|
|
auth_context: AuthContext | None = None,
|
|
) -> Any:
|
|
return await agent_factory(
|
|
llm=llm,
|
|
workspace_id=workspace_id,
|
|
db_session=db_session,
|
|
connector_service=connector_service,
|
|
checkpointer=checkpointer,
|
|
user_id=user_id,
|
|
thread_id=thread_id,
|
|
agent_config=agent_config,
|
|
thread_visibility=thread_visibility,
|
|
filesystem_selection=filesystem_selection,
|
|
disabled_tools=disabled_tools,
|
|
mentioned_document_ids=mentioned_document_ids,
|
|
auth_context=auth_context,
|
|
)
|