Bläddra i källkod

Remove the second `if self.runtime is None:` check (#24171)

Co-authored-by: Yongtao Huang <99629139+hyongtao-db@users.noreply.github.com>
tags/1.8.0
Yongtao Huang 2 månader sedan
förälder
incheckning
7c7618c083
Inget konto är kopplat till bidragsgivarens mejladress
2 ändrade filer med 2 tillägg och 5 borttagningar
  1. 1
    4
      api/core/tools/custom_tool/tool.py
  2. 1
    1
      api/core/tools/entities/api_entities.py

+ 1
- 4
api/core/tools/custom_tool/tool.py Visa fil

return ToolProviderType.API return ToolProviderType.API


def assembling_request(self, parameters: dict[str, Any]) -> dict[str, Any]: def assembling_request(self, parameters: dict[str, Any]) -> dict[str, Any]:
headers = {}
if self.runtime is None: if self.runtime is None:
raise ToolProviderCredentialValidationError("runtime not initialized") raise ToolProviderCredentialValidationError("runtime not initialized")


headers = {}
if self.runtime is None:
raise ValueError("runtime is required")
credentials = self.runtime.credentials or {} credentials = self.runtime.credentials or {}

if "auth_type" not in credentials: if "auth_type" not in credentials:
raise ToolProviderCredentialValidationError("Missing auth_type") raise ToolProviderCredentialValidationError("Missing auth_type")



+ 1
- 1
api/core/tools/entities/api_entities.py Visa fil

parameter.pop("input_schema", None) parameter.pop("input_schema", None)
# ------------- # -------------
optional_fields = self.optional_field("server_url", self.server_url) optional_fields = self.optional_field("server_url", self.server_url)
if self.type == ToolProviderType.MCP.value:
if self.type == ToolProviderType.MCP:
optional_fields.update(self.optional_field("updated_at", self.updated_at)) optional_fields.update(self.optional_field("updated_at", self.updated_at))
optional_fields.update(self.optional_field("server_identifier", self.server_identifier)) optional_fields.update(self.optional_field("server_identifier", self.server_identifier))
return { return {

Laddar…
Avbryt
Spara