From d54d178d2192c06274bd4a6f6395223a8a6ae6cc Mon Sep 17 00:00:00 2001 From: qbc Date: Tue, 20 Aug 2024 18:10:03 +0800 Subject: [PATCH] support wanx (#12) --- .../html-drag-components/model-wanx.html | 40 +++++++++++++++++++ .../studio/static/js/workstation.js | 23 +++++++++++ .../studio/templates/workstation.html | 19 ++++++++- .../web/workstation/workflow_node.py | 1 + 4 files changed, 82 insertions(+), 1 deletion(-) create mode 100644 src/agentscope/studio/static/html-drag-components/model-wanx.html diff --git a/src/agentscope/studio/static/html-drag-components/model-wanx.html b/src/agentscope/studio/static/html-drag-components/model-wanx.html new file mode 100644 index 000000000..28e8c6d46 --- /dev/null +++ b/src/agentscope/studio/static/html-drag-components/model-wanx.html @@ -0,0 +1,40 @@ +
+
+ + + + Wanx +
+ +
+
+
Wanx Configurations
+
+ +
+ +
+ +
+ +
+ +
+ + + +
+ + + +
+
\ No newline at end of file diff --git a/src/agentscope/studio/static/js/workstation.js b/src/agentscope/studio/static/js/workstation.js index 946822d75..b86fced24 100644 --- a/src/agentscope/studio/static/js/workstation.js +++ b/src/agentscope/studio/static/js/workstation.js @@ -17,6 +17,7 @@ let nameToHtmlFile = { 'openai_chat': 'model-openai-chat.html', 'post_api_chat': 'model-post-api-chat.html', 'post_api_dall_e': 'model-post-api-dall-e.html', + 'dashscope_image_synthesis': 'model-wanx.html', 'Message': 'message-msg.html', 'DialogAgent': 'agent-dialogagent.html', 'UserAgent': 'agent-useragent.html', @@ -562,6 +563,28 @@ async function addNodeToDrawFlow(name, pos_x, pos_y) { addEventListenersToNumberInputs(post_api_dall_eId); break; + case 'dashscope_image_synthesis': + const dashscope_image_synthesisId = editor.addNode('dashscope_image_synthesis', 0, + 0, + pos_x, pos_y, + 'dashscope_image_synthesis', { + "args": + { + "config_name": '', + "model_name": '', + "generate_args": { + "n": 1, + "size": "", + "temperature": 0.0, + "seed": 0, + }, + "model_type": 'dashscope_image_synthesis', + "messages_key": 'prompt' + } + }, htmlSourceCode); + addEventListenersToNumberInputs(dashscope_image_synthesisId); + break; + // Message case 'Message': editor.addNode('Message', 1, 1, pos_x, diff --git a/src/agentscope/studio/templates/workstation.html b/src/agentscope/studio/templates/workstation.html index cd1897f48..fe287bea1 100644 --- a/src/agentscope/studio/templates/workstation.html +++ b/src/agentscope/studio/templates/workstation.html @@ -116,6 +116,10 @@ data-node="post_api_dall_e" draggable="true" ondragstart="drag(event)">Post API Dall-E +
  • Wanx +
  • @@ -209,7 +213,7 @@
  • - Tool + Service
  • +
  • +
    + Tool +
    + +
  • diff --git a/src/agentscope/web/workstation/workflow_node.py b/src/agentscope/web/workstation/workflow_node.py index d49264b05..13cd06549 100644 --- a/src/agentscope/web/workstation/workflow_node.py +++ b/src/agentscope/web/workstation/workflow_node.py @@ -874,6 +874,7 @@ def compile(self) -> dict: "openai_chat": ModelNode, "post_api_chat": ModelNode, "post_api_dall_e": ModelNode, + 'dashscope_image_synthesis': ModelNode, "Message": MsgNode, "DialogAgent": DialogAgentNode, "UserAgent": UserAgentNode,