Skip to content

Commit 9a952b7

Browse files
authored
fix(formatter): support to extract image extensions from URL with query parameters (#1066)
1 parent 331109b commit 9a952b7

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/agentscope/formatter/_openai_formatter.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,8 @@ def _to_openai_image_url(url: str) -> str:
8686

8787
# Web url
8888
if not os.path.exists(url) and parsed_url.scheme != "":
89-
if any(lower_url.endswith(_) for _ in support_image_extensions):
89+
path_lower = parsed_url.path if parsed_url.path else parsed_url.netloc
90+
if any(path_lower.endswith(_) for _ in support_image_extensions):
9091
return url
9192

9293
# Check if it is a local file

0 commit comments

Comments
 (0)