Skip to content

armgit / dify

Public Imported from GitHub
0

Build Agentic workflows, RAG pipelines, with rich AI model and tool support on one collaborative workspace. Deploy on cloud, VPC, or self-hosted, so teams move from prototype to production without rebuilding the stack.

fix: the Image-1X tool (#8787)

非法操作d1173a69f8ec
diff --git a/api/core/tools/provider/builtin/stepfun/stepfun.py b/api/core/tools/provider/builtin/stepfun/stepfun.py
index b24f730c95a..239db85b111 100644
--- a/api/core/tools/provider/builtin/stepfun/stepfun.py
+++ b/api/core/tools/provider/builtin/stepfun/stepfun.py
@@ -16,7 +16,7 @@ class StepfunProvider(BuiltinToolProviderController):
user_id="",
tool_parameters={
"prompt": "cute girl, blue eyes, white hair, anime style",
- "size": "1024x1024",
+ "size": "256x256",
"n": 1,
},
)
diff --git a/api/core/tools/provider/builtin/stepfun/stepfun.yaml b/api/core/tools/provider/builtin/stepfun/stepfun.yaml
index 1f841ec369b..e8139a4d7d6 100644
--- a/api/core/tools/provider/builtin/stepfun/stepfun.yaml
+++ b/api/core/tools/provider/builtin/stepfun/stepfun.yaml
@@ -4,11 +4,9 @@ identity:
label:
en_US: Image-1X
zh_Hans: 阶跃星辰绘画
- pt_BR: Image-1X
description:
en_US: Image-1X
zh_Hans: 阶跃星辰绘画
- pt_BR: Image-1X
icon: icon.png
tags:
- image
@@ -20,27 +18,16 @@ credentials_for_provider:
label:
en_US: Stepfun API key
zh_Hans: 阶跃星辰API key
- pt_BR: Stepfun API key
- help:
- en_US: Please input your stepfun API key
- zh_Hans: 请输入你的阶跃星辰 API key
- pt_BR: Please input your stepfun API key
placeholder:
- en_US: Please input your stepfun API key
+ en_US: Please input your Stepfun API key
zh_Hans: 请输入你的阶跃星辰 API key
- pt_BR: Please input your stepfun API key
+ url: https://platform.stepfun.com/interface-key
stepfun_base_url:
type: text-input
required: false
label:
en_US: Stepfun base URL
zh_Hans: 阶跃星辰 base URL
- pt_BR: Stepfun base URL
- help:
- en_US: Please input your Stepfun base URL
- zh_Hans: 请输入你的阶跃星辰 base URL
- pt_BR: Please input your Stepfun base URL
placeholder:
en_US: Please input your Stepfun base URL
zh_Hans: 请输入你的阶跃星辰 base URL
- pt_BR: Please input your Stepfun base URL
diff --git a/api/core/tools/provider/builtin/stepfun/tools/image.py b/api/core/tools/provider/builtin/stepfun/tools/image.py
index 0b92b122bf5..eb55dae5183 100644
--- a/api/core/tools/provider/builtin/stepfun/tools/image.py
+++ b/api/core/tools/provider/builtin/stepfun/tools/image.py
@@ -1,4 +1,3 @@
-import random
from typing import Any, Union
from openai import OpenAI
@@ -19,7 +18,7 @@ class StepfunTool(BuiltinTool):
"""
invoke tools
"""
- base_url = self.runtime.credentials.get("stepfun_base_url", "https://api.stepfun.com")
+ base_url = self.runtime.credentials.get("stepfun_base_url") or "https://api.stepfun.com"
base_url = str(URL(base_url) / "v1")
client = OpenAI(
@@ -28,9 +27,7 @@ class StepfunTool(BuiltinTool):
)
extra_body = {}
- model = tool_parameters.get("model", "step-1x-medium")
- if not model:
- return self.create_text_message("Please input model name")
+ model = "step-1x-medium"
# prompt
prompt = tool_parameters.get("prompt", "")
if not prompt:
@@ -67,9 +64,3 @@ class StepfunTool(BuiltinTool):
)
)
return result
-
- @staticmethod
- def _generate_random_id(length=8):
- characters = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789"
- random_id = "".join(random.choices(characters, k=length))
- return random_id
diff --git a/api/core/tools/provider/builtin/stepfun/tools/image.yaml b/api/core/tools/provider/builtin/stepfun/tools/image.yaml
index dcc5bd2db2f..8d7c9b6586b 100644
--- a/api/core/tools/provider/builtin/stepfun/tools/image.yaml
+++ b/api/core/tools/provider/builtin/stepfun/tools/image.yaml
@@ -29,35 +29,6 @@ parameters:
pt_BR: Image prompt, you can check the official documentation of step-1x
llm_description: Image prompt of step-1x you should describe the image you want to generate as a list of words as possible as detailed
form: llm
- - name: model
- type: select
- required: false
- human_description:
- en_US: used for selecting the model name
- zh_Hans: 用于选择模型的名字
- pt_BR: used for selecting the model name
- label:
- en_US: Model Name
- zh_Hans: 模型名字
- pt_BR: Model Name
- form: form
- options:
- - value: step-1x-turbo
- label:
- en_US: turbo
- zh_Hans: turbo
- pt_BR: turbo
- - value: step-1x-medium
- label:
- en_US: medium
- zh_Hans: medium
- pt_BR: medium
- - value: step-1x-large
- label:
- en_US: large
- zh_Hans: large
- pt_BR: large
- default: step-1x-medium
- name: size
type: select
required: false