This commit is contained in:
Paul Gauthier 2024-04-26 14:32:45 -07:00
parent bf55573814
commit 882e68c046

View file

@ -15,7 +15,12 @@ if "recent_msgs_num" not in st.session_state:
st.session_state.recent_msgs_num = 0 st.session_state.recent_msgs_num = 0
diff = Path("aider/tmp.diff").read_text() # st.cache_data
def get_diff():
return Path("/Users/gauthier/Projects/aider/aider/tmp.diff").read_text()
diff = get_diff()
def recent_msgs(): def recent_msgs():
@ -75,11 +80,12 @@ class GUI:
self.cmds_tab, self.settings_tab = st.tabs(["Commands", "Settings"]) self.cmds_tab, self.settings_tab = st.tabs(["Commands", "Settings"])
def do_cmd_tab(self): def do_cmd_tab(self):
with self.cmds_tab:
with st.expander("Recommended actions", expanded=True): with st.expander("Recommended actions", expanded=True):
with st.popover("Create a git repo to track changes"): with st.popover("Create a git repo to track changes"):
st.write( st.write(
"Aider works best when your code is stored in a git repo. \n[See the FAQ for" "Aider works best when your code is stored in a git repo. \n[See the FAQ"
" more info](https://aider.chat/docs/faq.html#how-does-aider-use-git)" " for more info](https://aider.chat/docs/faq.html#how-does-aider-use-git)"
) )
st.button("Create git repo", key=random.random(), help="?") st.button("Create git repo", key=random.random(), help="?")
@ -90,11 +96,11 @@ class GUI:
with st.expander("Add to the chat", expanded=True): with st.expander("Add to the chat", expanded=True):
st.multiselect( st.multiselect(
"Files for the LLM to edit", "Files for the LLM to edit",
search(), self.coder.get_all_relative_files(),
default=["aider/main.py", "aider/io.py"], default=self.coder.get_inchat_relative_files(),
help=( help=(
"Only add the files that need to be *edited* for the task you are working on." "Only add the files that need to be *edited* for the task you are working"
" Aider will pull in other code to provide relevant context to the LLM." " on. Aider will pull in other code to provide relevant context to the LLM."
), ),
) )
with st.popover("Add web page"): with st.popover("Add web page"):
@ -105,8 +111,8 @@ class GUI:
st.file_uploader("Image file") st.file_uploader("Image file")
with st.popover("Run shell commands, tests, etc"): with st.popover("Run shell commands, tests, etc"):
st.markdown( st.markdown(
"Run a shell command and optionally share the output with the LLM. This is a" "Run a shell command and optionally share the output with the LLM. This is"
" great way to run your program or run tests and have the LLM fix bugs." " a great way to run your program or run tests and have the LLM fix bugs."
) )
st.text_input("Command:") st.text_input("Command:")
st.radio( st.radio(
@ -114,8 +120,8 @@ class GUI:
[ [
"Review the output and decide whether to share", "Review the output and decide whether to share",
( (
"Automatically share the output on non-zero exit code (ie, if any tests" "Automatically share the output on non-zero exit code (ie, if any"
" fail)" " tests fail)"
), ),
], ],
) )
@ -221,19 +227,12 @@ class GUI:
self.init_state() self.init_state()
self.do_sidebar() self.do_sidebar()
with self.cmds_tab:
self.do_cmd_tab() self.do_cmd_tab()
self.do_messages_container() self.do_messages_container()
with self.messages:
self.mock_tool_output()
self.chat() self.chat()
def chat(self): def chat(self):
prompt = st.chat_input("Say something", on_submit=self.clear_controls) prompt = st.chat_input("Say something", on_submit=self.clear_controls)
# dump(old_prompt, prompt)
if self.old_prompt: if self.old_prompt:
prompt = self.old_prompt prompt = self.old_prompt