mirror of
https://github.com/Aider-AI/aider.git
synced 2025-05-22 05:14:59 +00:00
Clear chat history
This commit is contained in:
parent
ddb8360608
commit
fb8e604fbe
1 changed files with 13 additions and 4 deletions
17
aider/gui.py
17
aider/gui.py
|
@ -43,8 +43,10 @@ class State:
|
||||||
def init(self, key, val=None):
|
def init(self, key, val=None):
|
||||||
if key in self.keys:
|
if key in self.keys:
|
||||||
return
|
return
|
||||||
|
|
||||||
self.keys.add(key)
|
self.keys.add(key)
|
||||||
setattr(self, key, val)
|
setattr(self, key, val)
|
||||||
|
return True
|
||||||
|
|
||||||
|
|
||||||
@st.cache_resource
|
@st.cache_resource
|
||||||
|
@ -198,7 +200,11 @@ class GUI:
|
||||||
with st.expander("Tokens and costs", expanded=True):
|
with st.expander("Tokens and costs", expanded=True):
|
||||||
with st.popover("Show token usage"):
|
with st.popover("Show token usage"):
|
||||||
st.write("hi")
|
st.write("hi")
|
||||||
self.button("Clear chat history")
|
if self.button("Clear chat history"):
|
||||||
|
self.coder.done_messages = []
|
||||||
|
self.coder.cur_messages = []
|
||||||
|
self.info("Cleared chat history")
|
||||||
|
|
||||||
# st.metric("Cost of last message send & reply", "$0.0019", help="foo")
|
# st.metric("Cost of last message send & reply", "$0.0019", help="foo")
|
||||||
# st.metric("Cost to send next message", "$0.0013", help="foo")
|
# st.metric("Cost to send next message", "$0.0013", help="foo")
|
||||||
# st.metric("Total cost this session", "$0.22")
|
# st.metric("Total cost this session", "$0.22")
|
||||||
|
@ -335,9 +341,7 @@ class GUI:
|
||||||
self.state.messages.append({"role": "assistant", "content": res})
|
self.state.messages.append({"role": "assistant", "content": res})
|
||||||
# self.cost()
|
# self.cost()
|
||||||
if self.coder.reflected_message:
|
if self.coder.reflected_message:
|
||||||
info = dict(role="info", message=self.coder.reflected_message)
|
self.info(self.coder.reflected_message)
|
||||||
self.state.messages.append(info)
|
|
||||||
self.messages.info(self.coder.reflected_message)
|
|
||||||
prompt = self.coder.reflected_message
|
prompt = self.coder.reflected_message
|
||||||
|
|
||||||
with self.messages:
|
with self.messages:
|
||||||
|
@ -363,6 +367,11 @@ class GUI:
|
||||||
# re-render the UI for the non-prompt_pending state
|
# re-render the UI for the non-prompt_pending state
|
||||||
st.experimental_rerun()
|
st.experimental_rerun()
|
||||||
|
|
||||||
|
def info(self, message):
|
||||||
|
info = dict(role="info", message=message)
|
||||||
|
self.state.messages.append(info)
|
||||||
|
self.messages.info(message)
|
||||||
|
|
||||||
|
|
||||||
def gui_main():
|
def gui_main():
|
||||||
coder = get_coder()
|
coder = get_coder()
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue