mirror of
https://github.com/Aider-AI/aider.git
synced 2025-05-22 13:25:00 +00:00
persist the announce lines
This commit is contained in:
parent
0f8efa3714
commit
c0fec1d6ac
1 changed files with 11 additions and 6 deletions
17
aider/gui.py
17
aider/gui.py
|
@ -88,7 +88,7 @@ class GUI:
|
||||||
def announce(self):
|
def announce(self):
|
||||||
lines = self.coder.get_announcements()
|
lines = self.coder.get_announcements()
|
||||||
lines = " \n".join(lines)
|
lines = " \n".join(lines)
|
||||||
st.info(lines)
|
return lines
|
||||||
|
|
||||||
def show_edit_info(self, edit):
|
def show_edit_info(self, edit):
|
||||||
commit_hash = edit.get("commit_hash")
|
commit_hash = edit.get("commit_hash")
|
||||||
|
@ -278,8 +278,6 @@ class GUI:
|
||||||
# to get all the chat text to the bottom
|
# to get all the chat text to the bottom
|
||||||
self.messages.container(height=300, border=False)
|
self.messages.container(height=300, border=False)
|
||||||
with self.messages:
|
with self.messages:
|
||||||
self.announce()
|
|
||||||
|
|
||||||
for msg in self.state.messages:
|
for msg in self.state.messages:
|
||||||
role = msg["role"]
|
role = msg["role"]
|
||||||
|
|
||||||
|
@ -289,7 +287,8 @@ class GUI:
|
||||||
st.info(msg["message"])
|
st.info(msg["message"])
|
||||||
elif role == "text":
|
elif role == "text":
|
||||||
text = msg["content"]
|
text = msg["content"]
|
||||||
with self.messages.expander(text.splitlines()[0]):
|
line = text.splitlines()[0]
|
||||||
|
with self.messages.expander(line):
|
||||||
st.text(text)
|
st.text(text)
|
||||||
elif role in ("user", "assistant"):
|
elif role in ("user", "assistant"):
|
||||||
with st.chat_message(role):
|
with st.chat_message(role):
|
||||||
|
@ -299,7 +298,11 @@ class GUI:
|
||||||
st.dict(msg)
|
st.dict(msg)
|
||||||
|
|
||||||
def initialize_state(self):
|
def initialize_state(self):
|
||||||
messages = [{"role": "assistant", "content": "How can I help you?"}]
|
messages = [
|
||||||
|
dict(role="text", content=self.announce()),
|
||||||
|
dict(role="assistant", content="How can I help you?"),
|
||||||
|
]
|
||||||
|
|
||||||
self.state.init("messages", messages)
|
self.state.init("messages", messages)
|
||||||
self.state.init("last_aider_commit_hash", self.coder.last_aider_commit_hash)
|
self.state.init("last_aider_commit_hash", self.coder.last_aider_commit_hash)
|
||||||
self.state.init("last_undone_commit_hash")
|
self.state.init("last_undone_commit_hash")
|
||||||
|
@ -362,7 +365,9 @@ class GUI:
|
||||||
with self.messages.chat_message("user"):
|
with self.messages.chat_message("user"):
|
||||||
st.write(self.prompt)
|
st.write(self.prompt)
|
||||||
elif self.prompt_as == "text":
|
elif self.prompt_as == "text":
|
||||||
with self.messages.expander(self.prompt.splitlines()[0]):
|
line = self.prompt.splitlines()[0]
|
||||||
|
line += "??"
|
||||||
|
with self.messages.expander(line):
|
||||||
st.text(self.prompt)
|
st.text(self.prompt)
|
||||||
|
|
||||||
# re-render the UI for the prompt_pending state
|
# re-render the UI for the prompt_pending state
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue