mirror of
https://github.com/Aider-AI/aider.git
synced 2025-06-01 10:14:59 +00:00
fix: Update content handling in ChatChunks class
feat: Add date-based caching for prompts refactor: Simplify current date/time formatting in Coder class
This commit is contained in:
parent
a0fd982546
commit
36663cf04e
2 changed files with 12 additions and 5 deletions
|
@ -91,7 +91,7 @@ class ChatChunks:
|
|||
if not messages:
|
||||
return
|
||||
|
||||
content = messages[-1]
|
||||
content = messages[-1]["content"]
|
||||
if type(content) is str:
|
||||
content = dict(
|
||||
type="text",
|
||||
|
@ -99,6 +99,8 @@ class ChatChunks:
|
|||
)
|
||||
content["cache_control"] = {"type": "ephemeral"}
|
||||
|
||||
messages[-1]["content"] = [content]
|
||||
|
||||
|
||||
class Coder:
|
||||
abs_fnames = None
|
||||
|
@ -910,6 +912,10 @@ class Coder:
|
|||
if user_lang:
|
||||
platform_text += f"- Language: {user_lang}\n"
|
||||
|
||||
if self.cache_prompts:
|
||||
dt = datetime.now().astimezone().strftime("%Y-%m-%d")
|
||||
platform_text += f"- Current date: {dt}"
|
||||
else:
|
||||
dt = datetime.now().astimezone().strftime("%Y-%m-%dT%H:%M:%S%z")
|
||||
platform_text += f"- Current date/time: {dt}"
|
||||
|
||||
|
@ -1020,7 +1026,8 @@ class Coder:
|
|||
if self.cache_prompts and self.main_model.cache_control:
|
||||
chunks.add_cache_control_headers()
|
||||
|
||||
return chunks.all_messages()
|
||||
msgs = chunks.all_messages()
|
||||
return msgs
|
||||
|
||||
def send_message(self, inp):
|
||||
self.aider_edited_files = None
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue