chore(api/core): apply ruff reformatting (#7624)

This commit is contained in:
Bowen Liang
2024-09-10 17:00:20 +08:00
committed by GitHub
parent 178730266d
commit 2cf1187b32
724 changed files with 21180 additions and 21123 deletions

View File

@@ -11,7 +11,7 @@ class DevDocsProvider(BuiltinToolProviderController):
"credentials": credentials,
}
).invoke(
user_id='',
user_id="",
tool_parameters={
"doc": "python~3.12",
"topic": "library/code",
@@ -19,4 +19,3 @@ class DevDocsProvider(BuiltinToolProviderController):
)
except Exception as e:
raise ToolProviderCredentialValidationError(str(e))

View File

@@ -13,7 +13,9 @@ class SearchDevDocsInput(BaseModel):
class SearchDevDocsTool(BuiltinTool):
def _invoke(self, user_id: str, tool_parameters: dict[str, Any]) -> Union[ToolInvokeMessage, list[ToolInvokeMessage]]:
def _invoke(
self, user_id: str, tool_parameters: dict[str, Any]
) -> Union[ToolInvokeMessage, list[ToolInvokeMessage]]:
"""
Invokes the DevDocs search tool with the given user ID and tool parameters.
@@ -24,13 +26,13 @@ class SearchDevDocsTool(BuiltinTool):
Returns:
ToolInvokeMessage | list[ToolInvokeMessage]: The result of the tool invocation, which can be a single message or a list of messages.
"""
doc = tool_parameters.get('doc', '')
topic = tool_parameters.get('topic', '')
doc = tool_parameters.get("doc", "")
topic = tool_parameters.get("topic", "")
if not doc:
return self.create_text_message('Please provide the documentation name.')
return self.create_text_message("Please provide the documentation name.")
if not topic:
return self.create_text_message('Please provide the topic path.')
return self.create_text_message("Please provide the topic path.")
url = f"https://documents.devdocs.io/{doc}/{topic}.html"
response = requests.get(url)
@@ -39,4 +41,6 @@ class SearchDevDocsTool(BuiltinTool):
content = response.text
return self.create_text_message(self.summary(user_id=user_id, content=content))
else:
return self.create_text_message(f"Failed to retrieve the documentation. Status code: {response.status_code}")
return self.create_text_message(
f"Failed to retrieve the documentation. Status code: {response.status_code}"
)