This commit is contained in:
Paul Gauthier 2024-04-28 13:44:04 -07:00
parent 9bc8ed9227
commit d60b343274

View file

@ -151,6 +151,7 @@ class GUI:
# self.do_recommended_actions() # self.do_recommended_actions()
self.do_add_to_chat() self.do_add_to_chat()
self.do_recent_msgs() self.do_recent_msgs()
self.do_clear_chat_history()
def do_recommended_actions(self): def do_recommended_actions(self):
with st.expander("Recommended actions", expanded=True): with st.expander("Recommended actions", expanded=True):
@ -166,21 +167,20 @@ class GUI:
self.button("Add `.aider*` to `.gitignore`", key=random.random(), help="?") self.button("Add `.aider*` to `.gitignore`", key=random.random(), help="?")
def do_add_to_chat(self): def do_add_to_chat(self):
with st.expander("Add to the chat", expanded=True): # with st.expander("Add to the chat", expanded=True):
self.do_add_files() self.do_add_files()
self.do_add_web_page() self.do_add_web_page()
self.do_clear_chat_history()
def do_add_files(self): def do_add_files(self):
fnames = st.multiselect( fnames = st.multiselect(
"Files for the LLM to edit", "Add files to the chat",
sorted(self.coder.get_all_relative_files()), sorted(self.coder.get_all_relative_files()),
default=sorted(self.coder.get_inchat_relative_files()), default=sorted(self.coder.get_inchat_relative_files()),
placeholder="Files to edit", placeholder="Files to edit",
disabled=self.prompt_pending(), disabled=self.prompt_pending(),
help=( help=(
"Only add the files that need to be *edited* for the task you are working" "Only add the files that need to be *edited* for the task you are working"
" on. Aider will pull in other code to provide relevant context to the LLM." " on. Aider will pull in other relevant code to provide context to the LLM."
), ),
) )
@ -194,7 +194,7 @@ class GUI:
self.info(f"Removed {fname} from the chat") self.info(f"Removed {fname} from the chat")
def do_add_web_page(self): def do_add_web_page(self):
with st.popover("Add web page"): with st.popover("Add a web page to the chat"):
self.do_web() self.do_web()
def do_add_image(self): def do_add_image(self):
@ -234,7 +234,8 @@ class GUI:
st.write("hi") st.write("hi")
def do_clear_chat_history(self): def do_clear_chat_history(self):
if self.button("Clear chat history"): text = "Saves tokens, reduces confusion"
if self.button("Clear chat history", help=text):
self.coder.done_messages = [] self.coder.done_messages = []
self.coder.cur_messages = [] self.coder.cur_messages = []
self.info("Cleared chat history. Now the LLM can't see anything before this line.") self.info("Cleared chat history. Now the LLM can't see anything before this line.")
@ -272,7 +273,7 @@ class GUI:
with self.recent_msgs_empty: with self.recent_msgs_empty:
self.old_prompt = st.selectbox( self.old_prompt = st.selectbox(
"Resend recent chat message", "Resend a recent chat message",
self.state.input_history, self.state.input_history,
placeholder="Choose a recent chat message", placeholder="Choose a recent chat message",
# label_visibility="collapsed", # label_visibility="collapsed",
@ -501,7 +502,15 @@ class GUI:
def gui_main(): def gui_main():
st.set_page_config(layout="wide") st.set_page_config(
layout="wide",
page_title="Aider",
menu_items={
"Get Help": "https://aider.chat/docs/faq.html",
"Report a bug": "https://github.com/paul-gauthier/aider/issues",
"About": "# Aider\nAI pair programming in your browser.",
},
)
GUI() GUI()