Merge pull request #631 from daniel-vainsencher/dvf_llm_log

This commit is contained in:
paul-gauthier 2024-06-17 13:58:46 -07:00 committed by GitHub
commit a596a32290
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 52 additions and 12 deletions

View file

@ -1,5 +1,6 @@
#!/usr/bin/env python
import datetime
import hashlib
import json
import os
@ -27,7 +28,7 @@ from aider.mdstream import MarkdownStream
from aider.repo import GitRepo
from aider.repomap import RepoMap
from aider.sendchat import send_with_retries
from aider.utils import is_image_file
from aider.utils import is_image_file, format_messages, format_content
from ..dump import dump # noqa: F401
@ -783,6 +784,8 @@ class Coder:
messages = self.format_messages()
self.io.log_llm_history("TO LLM", format_messages(messages))
if self.verbose:
utils.show_messages(messages, functions=self.functions)
@ -805,6 +808,9 @@ class Coder:
exhausted = True
else:
raise err
except Exception as err:
self.io.tool_error(f"Unexpected error: {err}")
return
if exhausted:
self.show_exhausted_error()
@ -824,6 +830,8 @@ class Coder:
self.io.tool_output()
self.io.log_llm_history("LLM RESPONSE", format_content("ASSISTANT", content))
if interrupted:
content += "\n^C KeyboardInterrupt"
self.cur_messages += [dict(role="assistant", content=content)]