mirror of
https://github.com/langgenius/dify.git
synced 2026-05-11 06:37:13 +08:00
Resolve the full dependency chain to enable all previously disabled controllers: Enabled routes: - sandbox_files: sandbox file browser API - sandbox_providers: sandbox provider management API - app_asset: app asset management API - skills: skill extraction API - CLI API blueprint: DifyCli callback endpoints (/cli/api/*) Dependencies extracted (64 files, ~8000 lines): - models/sandbox.py, models/app_asset.py: DB models - core/zip_sandbox/: zip-based sandbox execution - core/session/: CLI API session management - core/memory/: base memory + node token buffer - core/helper/creators.py: helper utilities - core/llm_generator/: context models, output models, utils - core/workflow/nodes/command/: command node type - core/workflow/nodes/file_upload/: file upload node type - core/app/entities/: app_asset_entities, app_bundle_entities, llm_generation_entities - services/: asset_content, skill, workflow_collaboration, workflow_comment - controllers/console/app/error.py: AppAsset error classes - core/tools/utils/system_encryption.py Import fixes: - dify_graph.enums -> graphon.enums in skill_service.py - get_signed_file_url_for_plugin -> get_signed_file_url in cli_api.py All 5 controllers verified: import OK, Flask starts successfully. 46 existing tests still pass. Made-with: Cursor
42 lines
2.2 KiB
Python
42 lines
2.2 KiB
Python
from enum import StrEnum
|
|
from typing import Any
|
|
|
|
from pydantic import BaseModel, Field
|
|
|
|
from graphon.file import File
|
|
|
|
|
|
class ToolResultStatus(StrEnum):
|
|
SUCCESS = "success"
|
|
ERROR = "error"
|
|
|
|
|
|
class ToolCall(BaseModel):
|
|
id: str | None = Field(default=None, description="Unique identifier for this tool call")
|
|
name: str | None = Field(default=None, description="Name of the tool being called")
|
|
arguments: str | None = Field(default=None, description="Accumulated tool arguments JSON")
|
|
icon: str | dict | None = Field(default=None, description="Icon of the tool")
|
|
icon_dark: str | dict | None = Field(default=None, description="Dark theme icon of the tool")
|
|
|
|
|
|
class ToolResult(BaseModel):
|
|
id: str | None = Field(default=None, description="Identifier of the tool call this result belongs to")
|
|
name: str | None = Field(default=None, description="Name of the tool")
|
|
output: str | None = Field(default=None, description="Tool output text, error or success message")
|
|
files: list[str] = Field(default_factory=list, description="File produced by tool")
|
|
status: ToolResultStatus | None = Field(default=ToolResultStatus.SUCCESS, description="Tool execution status")
|
|
elapsed_time: float | None = Field(default=None, description="Elapsed seconds spent executing the tool")
|
|
icon: str | dict[str, Any] | None = Field(default=None, description="Icon of the tool")
|
|
icon_dark: str | dict[str, Any] | None = Field(default=None, description="Dark theme icon of the tool")
|
|
provider: str | None = Field(default=None, description="Tool provider identifier")
|
|
|
|
|
|
class ToolCallResult(BaseModel):
|
|
id: str | None = Field(default=None, description="Identifier for the tool call")
|
|
name: str | None = Field(default=None, description="Name of the tool")
|
|
arguments: str | None = Field(default=None, description="Accumulated tool arguments JSON")
|
|
output: str | None = Field(default=None, description="Tool output text, error or success message")
|
|
files: list[File] = Field(default_factory=list, description="File produced by tool")
|
|
status: ToolResultStatus = Field(default=ToolResultStatus.SUCCESS, description="Tool execution status")
|
|
elapsed_time: float | None = Field(default=None, description="Elapsed seconds spent executing the tool")
|