mirror of
https://github.com/Aider-AI/aider.git
synced 2025-05-28 16:25:00 +00:00
feat: add format_chat_markdown method to EditorEditBlockCoder
This commit is contained in:
parent
6163713e34
commit
f8277c55a8
1 changed files with 24 additions and 0 deletions
|
@ -5,3 +5,27 @@ from .editor_editblock_prompts import EditorEditBlockPrompts
|
|||
class EditorEditBlockCoder(EditBlockCoder):
|
||||
edit_format = "editor-diff"
|
||||
gpt_prompts = EditorEditBlockPrompts()
|
||||
|
||||
def format_chat_markdown(self):
|
||||
chunks = self.format_chat_chunks()
|
||||
|
||||
markdown = ""
|
||||
|
||||
# Only include specified chunks in order
|
||||
for messages in [chunks.repo, chunks.readonly_files, chunks.chat_files, chunks.cur]:
|
||||
for msg in messages:
|
||||
# Only include user messages
|
||||
if msg["role"] != "user":
|
||||
continue
|
||||
|
||||
content = msg["content"]
|
||||
|
||||
# Handle image/multipart content
|
||||
if isinstance(content, list):
|
||||
for part in content:
|
||||
if part.get("type") == "text":
|
||||
markdown += part["text"] + "\n\n"
|
||||
else:
|
||||
markdown += content + "\n\n"
|
||||
|
||||
return markdown.strip()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue