mirror of
https://github.com/Aider-AI/aider.git
synced 2025-06-01 02:05:00 +00:00
feat: Enhance format_messages
to display all content entries
This commit is contained in:
parent
985a9136fc
commit
1c2bd55caf
1 changed files with 11 additions and 5 deletions
|
@ -112,13 +112,19 @@ def format_messages(messages, title=None):
|
||||||
content = msg.get("content")
|
content = msg.get("content")
|
||||||
if isinstance(content, list): # Handle list content (e.g., image messages)
|
if isinstance(content, list): # Handle list content (e.g., image messages)
|
||||||
for item in content:
|
for item in content:
|
||||||
if isinstance(item, dict) and "image_url" in item:
|
if isinstance(item, dict):
|
||||||
output.append(f"{role} Image URL: {item['image_url']['url']}")
|
for key, value in item.items():
|
||||||
|
if isinstance(value, dict) and "url" in value:
|
||||||
|
output.append(f"{role} {key.capitalize()} URL: {value['url']}")
|
||||||
|
else:
|
||||||
|
output.append(f"{role} {key}: {value}")
|
||||||
|
else:
|
||||||
|
output.append(f"{role} {item}")
|
||||||
elif isinstance(content, str): # Handle string content
|
elif isinstance(content, str): # Handle string content
|
||||||
output.append(format_content(role, content))
|
output.append(format_content(role, content))
|
||||||
content = msg.get("function_call")
|
function_call = msg.get("function_call")
|
||||||
if content:
|
if function_call:
|
||||||
output.append(f"{role} {content}")
|
output.append(f"{role} Function Call: {function_call}")
|
||||||
|
|
||||||
return "\n".join(output)
|
return "\n".join(output)
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue