From 6c1674be13463d6394b698e61d73b012d1469885 Mon Sep 17 00:00:00 2001 From: Weirui Kuang <39145382+rayrayraykk@users.noreply.github.com> Date: Tue, 12 Nov 2024 16:04:53 +0800 Subject: [PATCH] update (#64) --- src/agentscope/studio/tools/image_synthesis.py | 2 +- src/agentscope/utils/common.py | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/agentscope/studio/tools/image_synthesis.py b/src/agentscope/studio/tools/image_synthesis.py index 74cf9d89c..5906bb7df 100644 --- a/src/agentscope/studio/tools/image_synthesis.py +++ b/src/agentscope/studio/tools/image_synthesis.py @@ -48,7 +48,7 @@ def image_synthesis( if res.status == ServiceExecStatus.SUCCESS: return Msg( name="ImageSynthesis", - content=res.content, + content="Image synthesis succeed.", url=res.content["image_urls"], role="assistant", echo=True, diff --git a/src/agentscope/utils/common.py b/src/agentscope/utils/common.py index 372d9ca66..d97696ca7 100644 --- a/src/agentscope/utils/common.py +++ b/src/agentscope/utils/common.py @@ -217,7 +217,9 @@ def _guess_type_by_extension( url: str, ) -> Literal["image", "audio", "video", "file"]: """Guess the type of the file by its extension.""" - extension = url.split(".")[-1].lower() + parsed_url = urlparse(url) + path = parsed_url.path + extension = path.split(".")[-1].lower() if "." in path else "" if extension in [ "bmp",