mirror of
https://github.com/Aider-AI/aider.git
synced 2025-05-25 14:55:00 +00:00
Add summary prefix
This commit is contained in:
parent
c26917851f
commit
69aea3e745
3 changed files with 7 additions and 2 deletions
|
@ -17,10 +17,10 @@ from rich.markdown import Markdown
|
||||||
|
|
||||||
from aider import models, prompts, utils
|
from aider import models, prompts, utils
|
||||||
from aider.commands import Commands
|
from aider.commands import Commands
|
||||||
|
from aider.history import ChatSummary
|
||||||
from aider.repo import GitRepo
|
from aider.repo import GitRepo
|
||||||
from aider.repomap import RepoMap
|
from aider.repomap import RepoMap
|
||||||
from aider.sendchat import send_with_retries
|
from aider.sendchat import send_with_retries
|
||||||
from aider.history import ChatSummary
|
|
||||||
|
|
||||||
from ..dump import dump # noqa: F401
|
from ..dump import dump # noqa: F401
|
||||||
|
|
||||||
|
@ -200,7 +200,7 @@ class Coder:
|
||||||
if self.repo:
|
if self.repo:
|
||||||
self.repo.add_new_files(fnames)
|
self.repo.add_new_files(fnames)
|
||||||
|
|
||||||
self.summarizer = ChatSummary()
|
self.summarizer = ChatSummary(self.main_model.name)
|
||||||
|
|
||||||
# validate the functions jsonschema
|
# validate the functions jsonschema
|
||||||
if self.functions:
|
if self.functions:
|
||||||
|
|
|
@ -15,6 +15,7 @@ class ChatSummary:
|
||||||
|
|
||||||
def summarize(self, messages):
|
def summarize(self, messages):
|
||||||
num = len(messages)
|
num = len(messages)
|
||||||
|
dump(num)
|
||||||
if num < 2:
|
if num < 2:
|
||||||
return messages
|
return messages
|
||||||
|
|
||||||
|
@ -66,6 +67,8 @@ class ChatSummary:
|
||||||
]
|
]
|
||||||
|
|
||||||
summary = simple_send_with_retries(model=models.GPT35.name, messages=messages)
|
summary = simple_send_with_retries(model=models.GPT35.name, messages=messages)
|
||||||
|
summary = prompts.summary_prefix + summary
|
||||||
|
dump(summary)
|
||||||
|
|
||||||
return [dict(role="user", content=summary)]
|
return [dict(role="user", content=summary)]
|
||||||
|
|
||||||
|
|
|
@ -40,3 +40,5 @@ Write *as* the user.
|
||||||
The user should refer to the assistant as *you*.
|
The user should refer to the assistant as *you*.
|
||||||
Start the summary with "I asked you...".
|
Start the summary with "I asked you...".
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
summary_prefix = "I spoke to you previously about a number of things.\n"
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue