mirror of
https://github.com/langgenius/dify.git
synced 2025-09-09 01:02:26 +00:00
Merge remote-tracking branch 'origin/feat/r2' into feat/r2
This commit is contained in:
commit
c993a05da7
@ -16,6 +16,7 @@ from core.plugin.entities.plugin_daemon import (
|
|||||||
PluginDatasourceProviderEntity,
|
PluginDatasourceProviderEntity,
|
||||||
)
|
)
|
||||||
from core.plugin.impl.base import BasePluginClient
|
from core.plugin.impl.base import BasePluginClient
|
||||||
|
from services.tools.tools_transform_service import ToolTransformService
|
||||||
|
|
||||||
|
|
||||||
class PluginDatasourceManager(BasePluginClient):
|
class PluginDatasourceManager(BasePluginClient):
|
||||||
@ -43,6 +44,8 @@ class PluginDatasourceManager(BasePluginClient):
|
|||||||
)
|
)
|
||||||
local_file_datasource_provider = PluginDatasourceProviderEntity(**self._get_local_file_datasource_provider())
|
local_file_datasource_provider = PluginDatasourceProviderEntity(**self._get_local_file_datasource_provider())
|
||||||
|
|
||||||
|
for provider in response:
|
||||||
|
ToolTransformService.repack_provider(tenant_id=tenant_id, provider=provider)
|
||||||
all_response = [local_file_datasource_provider] + response
|
all_response = [local_file_datasource_provider] + response
|
||||||
|
|
||||||
for provider in all_response:
|
for provider in all_response:
|
||||||
|
@ -5,6 +5,7 @@ from typing import Optional, Union, cast
|
|||||||
from yarl import URL
|
from yarl import URL
|
||||||
|
|
||||||
from configs import dify_config
|
from configs import dify_config
|
||||||
|
from core.plugin.entities.plugin_daemon import PluginDatasourceProviderEntity
|
||||||
from core.tools.__base.tool import Tool
|
from core.tools.__base.tool import Tool
|
||||||
from core.tools.__base.tool_runtime import ToolRuntime
|
from core.tools.__base.tool_runtime import ToolRuntime
|
||||||
from core.tools.builtin_tool.provider import BuiltinToolProviderController
|
from core.tools.builtin_tool.provider import BuiltinToolProviderController
|
||||||
@ -56,7 +57,7 @@ class ToolTransformService:
|
|||||||
return ""
|
return ""
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def repack_provider(tenant_id: str, provider: Union[dict, ToolProviderApiEntity]):
|
def repack_provider(tenant_id: str, provider: Union[dict, ToolProviderApiEntity, PluginDatasourceProviderEntity]):
|
||||||
"""
|
"""
|
||||||
repack provider
|
repack provider
|
||||||
|
|
||||||
@ -77,6 +78,17 @@ class ToolTransformService:
|
|||||||
provider.icon = ToolTransformService.get_tool_provider_icon_url(
|
provider.icon = ToolTransformService.get_tool_provider_icon_url(
|
||||||
provider_type=provider.type.value, provider_name=provider.name, icon=provider.icon
|
provider_type=provider.type.value, provider_name=provider.name, icon=provider.icon
|
||||||
)
|
)
|
||||||
|
elif isinstance(provider, PluginDatasourceProviderEntity):
|
||||||
|
if provider.plugin_id:
|
||||||
|
if isinstance(provider.declaration.identity.icon, str):
|
||||||
|
provider.declaration.identity.icon = ToolTransformService.get_plugin_icon_url(
|
||||||
|
tenant_id=tenant_id, filename=provider.declaration.identity.icon
|
||||||
|
)
|
||||||
|
else:
|
||||||
|
provider.declaration.identity.icon = ToolTransformService.get_tool_provider_icon_url(
|
||||||
|
provider_type=provider.type.value, provider_name=provider.name,
|
||||||
|
icon=provider.declaration.identity.icon
|
||||||
|
)
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def builtin_provider_to_user_provider(
|
def builtin_provider_to_user_provider(
|
||||||
|
Loading…
x
Reference in New Issue
Block a user