chore(api/core): apply ruff reformatting (#7624)
This commit is contained in:
parent
178730266d
commit
2cf1187b32
724 changed files with 21180 additions and 21123 deletions
|
|
@ -14,6 +14,4 @@ class SiliconflowProvider(BuiltinToolProviderController):
|
|||
|
||||
response = requests.get(url, headers=headers)
|
||||
if response.status_code != 200:
|
||||
raise ToolProviderCredentialValidationError(
|
||||
"SiliconFlow API key is invalid"
|
||||
)
|
||||
raise ToolProviderCredentialValidationError("SiliconFlow API key is invalid")
|
||||
|
|
|
|||
|
|
@ -5,17 +5,13 @@ import requests
|
|||
from core.tools.entities.tool_entities import ToolInvokeMessage
|
||||
from core.tools.tool.builtin_tool import BuiltinTool
|
||||
|
||||
FLUX_URL = (
|
||||
"https://api.siliconflow.cn/v1/black-forest-labs/FLUX.1-schnell/text-to-image"
|
||||
)
|
||||
FLUX_URL = "https://api.siliconflow.cn/v1/black-forest-labs/FLUX.1-schnell/text-to-image"
|
||||
|
||||
|
||||
class FluxTool(BuiltinTool):
|
||||
|
||||
def _invoke(
|
||||
self, user_id: str, tool_parameters: dict[str, Any]
|
||||
) -> Union[ToolInvokeMessage, list[ToolInvokeMessage]]:
|
||||
|
||||
headers = {
|
||||
"accept": "application/json",
|
||||
"content-type": "application/json",
|
||||
|
|
@ -36,9 +32,5 @@ class FluxTool(BuiltinTool):
|
|||
res = response.json()
|
||||
result = [self.create_json_message(res)]
|
||||
for image in res.get("images", []):
|
||||
result.append(
|
||||
self.create_image_message(
|
||||
image=image.get("url"), save_as=self.VARIABLE_KEY.IMAGE.value
|
||||
)
|
||||
)
|
||||
result.append(self.create_image_message(image=image.get("url"), save_as=self.VARIABLE_KEY.IMAGE.value))
|
||||
return result
|
||||
|
|
|
|||
|
|
@ -12,11 +12,9 @@ SDURL = {
|
|||
|
||||
|
||||
class StableDiffusionTool(BuiltinTool):
|
||||
|
||||
def _invoke(
|
||||
self, user_id: str, tool_parameters: dict[str, Any]
|
||||
) -> Union[ToolInvokeMessage, list[ToolInvokeMessage]]:
|
||||
|
||||
headers = {
|
||||
"accept": "application/json",
|
||||
"content-type": "application/json",
|
||||
|
|
@ -43,9 +41,5 @@ class StableDiffusionTool(BuiltinTool):
|
|||
res = response.json()
|
||||
result = [self.create_json_message(res)]
|
||||
for image in res.get("images", []):
|
||||
result.append(
|
||||
self.create_image_message(
|
||||
image=image.get("url"), save_as=self.VARIABLE_KEY.IMAGE.value
|
||||
)
|
||||
)
|
||||
result.append(self.create_image_message(image=image.get("url"), save_as=self.VARIABLE_KEY.IMAGE.value))
|
||||
return result
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue