Skip to content

Commit

Permalink
rm upload image prefix
Browse files Browse the repository at this point in the history
  • Loading branch information
tuhahaha committed Dec 12, 2024
1 parent ff580fa commit fd17df1
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 11 deletions.
2 changes: 1 addition & 1 deletion qwen_agent/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
__version__ = '0.0.13'
__version__ = '0.0.14'
from .agent import Agent
from .multi_agent_hub import MultiAgentHub

Expand Down
14 changes: 4 additions & 10 deletions qwen_agent/utils/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -328,7 +328,7 @@ def format_as_multimodal_message(
content.append(ContentItem(text=v))
if k in ('image', 'audio'):
content.append(item)
if k in ('file', 'image'):
if k == 'file':
# Move 'file' out of 'content' since it's not natively supported by models
files.append(v)
if add_upload_info and files and (msg.role in (SYSTEM, USER)):
Expand All @@ -338,16 +338,10 @@ def format_as_multimodal_message(
has_zh = (lang == 'zh')
upload = []
for f in [get_basename_from_url(f) for f in files]:
if is_image(f):
if has_zh:
upload.append(f'![图片]({f})')
else:
upload.append(f'![image]({f})')
if has_zh:
upload.append(f'[文件]({f})')
else:
if has_zh:
upload.append(f'[文件]({f})')
else:
upload.append(f'[file]({f})')
upload.append(f'[file]({f})')
upload = ' '.join(upload)
if has_zh:
upload = f'(上传了 {upload}\n\n'
Expand Down

0 comments on commit fd17df1

Please sign in to comment.