Skip to content

Commit 9d9737a

Browse files
committed
change code to check if msg is text part and add \n
1 parent 21e10d7 commit 9d9737a

File tree

1 file changed

+2
-2
lines changed
  • pydantic_ai_slim/pydantic_ai

1 file changed

+2
-2
lines changed

pydantic_ai_slim/pydantic_ai/_cli.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
from ._run_context import AgentDepsT
1919
from .agent import Agent
2020
from .exceptions import UserError
21-
from .messages import ModelMessage
21+
from .messages import ModelMessage, TextPart
2222
from .models import KnownModelName, infer_model
2323
from .output import OutputDataT
2424

@@ -355,7 +355,7 @@ def handle_slash_command(
355355
except IndexError:
356356
console.print('[dim]No output available to copy.[/dim]')
357357
else:
358-
text_to_copy = '\n'.join(part.content for part in parts if part.part_kind == 'text')
358+
text_to_copy = '\n\n'.join(part.content for part in parts if isinstance(part, TextPart))
359359
text_to_copy = text_to_copy.strip()
360360
if text_to_copy:
361361
pyperclip.copy(text_to_copy)

0 commit comments

Comments
 (0)