Skip to content

Commit 56c7f49

Browse files
authored
fix: add langgenius to list tool api (#13578)
1 parent 7c1d842 commit 56c7f49

File tree

3 files changed

+10
-8
lines changed

3 files changed

+10
-8
lines changed

api/core/plugin/entities/plugin.py

+8
Original file line numberDiff line numberDiff line change
@@ -176,6 +176,14 @@ def __init__(self, value: str, is_hardcoded: bool = False) -> None:
176176
self.provider_name = "gemini"
177177

178178

179+
class ToolProviderID(GenericProviderID):
180+
def __init__(self, value: str, is_hardcoded: bool = False) -> None:
181+
super().__init__(value, is_hardcoded)
182+
if self.organization == "langgenius":
183+
if self.provider_name in ["jina", "siliconflow"]:
184+
self.provider_name = f"{self.provider_name}_tool"
185+
186+
179187
class PluginDependency(BaseModel):
180188
class Type(enum.StrEnum):
181189
Github = PluginInstallationSource.Github.value

api/services/plugin/plugin_migration.py

-3
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import datetime
22
import json
33
import logging
4-
import sys
54
import time
65
from collections.abc import Mapping, Sequence
76
from concurrent.futures import ThreadPoolExecutor
@@ -418,8 +417,6 @@ def install(tenant_id: str, plugin_ids: list[str]) -> None:
418417

419418
logger.info("Uninstall plugins")
420419

421-
sys.exit(-1)
422-
423420
# get installation
424421
try:
425422
installation = manager.list_plugins(fake_tenant_id)

api/services/tools/builtin_tools_manage_service.py

+2-5
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
from configs import dify_config
88
from core.helper.position_helper import is_filtered
99
from core.model_runtime.utils.encoders import jsonable_encoder
10-
from core.plugin.entities.plugin import GenericProviderID
10+
from core.plugin.entities.plugin import GenericProviderID, ToolProviderID
1111
from core.plugin.manager.exc import PluginDaemonClientSideError
1212
from core.tools.builtin_tool.providers._positions import BuiltinToolProviderSort
1313
from core.tools.entities.api_entities import ToolApiEntity, ToolProviderApiEntity
@@ -240,10 +240,7 @@ def list_builtin_tools(user_id: str, tenant_id: str) -> list[ToolProviderApiEnti
240240

241241
# rewrite db_providers
242242
for db_provider in db_providers:
243-
try:
244-
GenericProviderID(db_provider.provider)
245-
except Exception:
246-
db_provider.provider = f"langgenius/{db_provider.provider}/{db_provider.provider}"
243+
db_provider.provider = str(ToolProviderID(db_provider.provider))
247244

248245
# find provider
249246
def find_provider(provider):

0 commit comments

Comments
 (0)