mirror of
https://github.com/Aider-AI/aider.git
synced 2025-05-24 22:34:59 +00:00
31 lines
964 B
Python
31 lines
964 B
Python
from pathlib import Path
|
|
|
|
from .dump import dump # noqa: F401
|
|
|
|
|
|
def safe_abs_path(res):
|
|
"Gives an abs path, which safely returns a full (not 8.3) windows path"
|
|
res = Path(res).resolve()
|
|
return str(res)
|
|
|
|
|
|
def show_messages(messages, title=None, functions=None):
|
|
if title:
|
|
print(title.upper(), "*" * 50)
|
|
|
|
for msg in messages:
|
|
role = msg["role"].upper()
|
|
content = msg.get("content")
|
|
if isinstance(content, list): # Handle list content (e.g., image messages)
|
|
for item in content:
|
|
if isinstance(item, dict) and "image_url" in item:
|
|
print(role, "Image URL:", item["image_url"]["url"])
|
|
elif isinstance(content, str): # Handle string content
|
|
for line in content.splitlines():
|
|
print(role, line)
|
|
content = msg.get("function_call")
|
|
if content:
|
|
print(role, content)
|
|
|
|
if functions:
|
|
dump(functions)
|