소스 검색

fix(pipeline-tracing-log): datasource icon error

tags/2.0.0-beta.1
Novice 2 달 전
부모
커밋
25e3f4da04
2개의 변경된 파일20개의 추가작업 그리고 1개의 파일을 삭제
  1. 3
    1
      api/core/app/apps/common/workflow_response_converter.py
  2. 17
    0
      api/core/datasource/entities/datasource_entities.py

+ 3
- 1
api/core/app/apps/common/workflow_response_converter.py 파일 보기

self._application_generate_entity.app_config.tenant_id, self._application_generate_entity.app_config.tenant_id,
event.provider_id, event.provider_id,
) )
response.data.extras["icon"] = provider_entity.declaration.identity.icon
response.data.extras["icon"] = provider_entity.declaration.identity.generate_datasource_icon_url(
self._application_generate_entity.app_config.tenant_id
)


return response return response



+ 17
- 0
api/core/datasource/entities/datasource_entities.py 파일 보기

from typing import Any, Optional from typing import Any, Optional


from pydantic import BaseModel, Field, ValidationInfo, field_validator from pydantic import BaseModel, Field, ValidationInfo, field_validator
from yarl import URL


from configs import dify_config
from core.entities.provider_entities import ProviderConfig from core.entities.provider_entities import ProviderConfig
from core.plugin.entities.oauth import OAuthSchema from core.plugin.entities.oauth import OAuthSchema
from core.plugin.entities.parameters import ( from core.plugin.entities.parameters import (
description="The tags of the tool", description="The tags of the tool",
) )


def generate_datasource_icon_url(self, tenant_id: str) -> str:
HARD_CODED_DATASOURCE_ICONS = ["https://assets.dify.ai/images/File%20Upload.svg"]
if self.icon in HARD_CODED_DATASOURCE_ICONS:
return self.icon
return str(
URL(dify_config.CONSOLE_API_URL or "/")
/ "console"
/ "api"
/ "workspaces"
/ "current"
/ "plugin"
/ "icon"
% {"tenant_id": tenant_id, "filename": self.icon}
)



class DatasourceProviderEntity(BaseModel): class DatasourceProviderEntity(BaseModel):
""" """

Loading…
취소
저장