diff --git a/.vscode/launch.json b/.vscode/launch.json index 0ec81e0..c1ff940 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -5,9 +5,22 @@ "name": "text-to-image", "type": "debugpy", "request": "launch", - "program": "skills/text-to-image/scripts/debug_openai_image_generation_test.py", + "program": "skills/text-to-image/scripts/text_to_image.py", "console": "integratedTerminal", "justMyCode": true, + "args": [ + "--prompt=马云在直播间卖红薯", + "--model=gpt-image-2" + ], + "env": { + "ROBOT_WECHAT_CLIENT_PORT": "9001", + "ROBOT_FROM_WX_ID": "57004904192@chatroom", + "ROBOT_CODE": "houhouipad", + "MYSQL_HOST": "127.0.0.1", + "MYSQL_PORT": "3306", + "MYSQL_USER": "root", + "MYSQL_PASSWORD": "houhou" + } } ] } \ No newline at end of file diff --git a/README.md b/README.md index 5f6fe45..734655e 100644 --- a/README.md +++ b/README.md @@ -78,7 +78,7 @@ { "to_wxid": "{{ROBOT_FROM_WX_ID}}", - "file_path": ["{{file_path}}"] + "file_path": "{{file_path}}" } ``` diff --git a/skills/image-to-image/scripts/image_to_image.py b/skills/image-to-image/scripts/image_to_image.py index a9f536d..188314c 100644 --- a/skills/image-to-image/scripts/image_to_image.py +++ b/skills/image-to-image/scripts/image_to_image.py @@ -350,11 +350,11 @@ def _send_image_outputs(client_port: str, from_wx_id: str, image_outputs: list[s response = _http_post_json(send_url, send_body, {"Content-Type": "application/json"}, timeout=300) _debug_response("send image url response", response) - if local_paths: + for file_path in local_paths: send_url = f"http://127.0.0.1:{client_port}/api/v1/robot/message/send/image/local" send_body = { "to_wxid": from_wx_id, - "file_path": local_paths, + "file_path": file_path, } response = _http_post_json(send_url, send_body, {"Content-Type": "application/json"}, timeout=300) _debug_response("send image local response", response) diff --git a/skills/text-to-image/scripts/text_to_image.py b/skills/text-to-image/scripts/text_to_image.py index 2691b0e..0291fdc 100644 --- a/skills/text-to-image/scripts/text_to_image.py +++ b/skills/text-to-image/scripts/text_to_image.py @@ -361,11 +361,11 @@ def _send_image_outputs(client_port: str, from_wx_id: str, image_outputs: list[s response = _http_post_json(send_url, send_body, {"Content-Type": "application/json"}, timeout=300) _debug_response("send image url response", response) - if local_paths: + for file_path in local_paths: send_url = f"http://127.0.0.1:{client_port}/api/v1/robot/message/send/image/local" send_body = { "to_wxid": from_wx_id, - "file_path": local_paths, + "file_path": file_path, } response = _http_post_json(send_url, send_body, {"Content-Type": "application/json"}, timeout=300) _debug_response("send image local response", response)