From 739e15f88b9a0734b570670f2eb3312b67be9238 Mon Sep 17 00:00:00 2001 From: Yeuoly Date: Tue, 29 Oct 2024 12:32:11 +0800 Subject: [PATCH] feat: support tool plugin id --- api/core/plugin/entities/plugin.py | 6 ++++++ api/core/tools/entities/tool_entities.py | 1 + 2 files changed, 7 insertions(+) diff --git a/api/core/plugin/entities/plugin.py b/api/core/plugin/entities/plugin.py index f21c0501aa..e342395b4b 100644 --- a/api/core/plugin/entities/plugin.py +++ b/api/core/plugin/entities/plugin.py @@ -110,6 +110,12 @@ class PluginEntity(BasePluginEntity): source: PluginInstallationSource meta: Mapping[str, Any] + @model_validator(mode="after") + def set_plugin_id(self): + if self.declaration.tool: + self.declaration.tool.plugin_id = self.plugin_id + return self + class GithubPackage(BaseModel): repo: str diff --git a/api/core/tools/entities/tool_entities.py b/api/core/tools/entities/tool_entities.py index dd1c7d8b7b..94a0c783e1 100644 --- a/api/core/tools/entities/tool_entities.py +++ b/api/core/tools/entities/tool_entities.py @@ -377,6 +377,7 @@ class ToolEntity(BaseModel): class ToolProviderEntity(BaseModel): identity: ToolProviderIdentity + plugin_id: Optional[str] = Field(None, description="The id of the plugin") credentials_schema: list[ProviderConfig] = Field(default_factory=list)