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
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():
@ -75,11 +80,12 @@ class GUI:
self.cmds_tab, self.settings_tab = st.tabs(["Commands", "Settings"])
def do_cmd_tab(self):
with self.cmds_tab:
with st.expander("Recommended actions", expanded=True):
with st.popover("Create a git repo to track changes"):
st.write(
"Aider works best when your code is stored in a git repo. \n[See the FAQ for"
" more info](https://aider.chat/docs/faq.html#how-does-aider-use-git)"
"Aider works best when your code is stored in a git repo. \n[See the FAQ"
" for more info](https://aider.chat/docs/faq.html#how-does-aider-use-git)"
)
st.button("Create git repo", key=random.random(), help="?")
@ -90,11 +96,11 @@ class GUI:
with st.expander("Add to the chat", expanded=True):
st.multiselect(
"Files for the LLM to edit",
search(),
default=["aider/main.py", "aider/io.py"],
self.coder.get_all_relative_files(),
default=self.coder.get_inchat_relative_files(),
help=(
"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."
"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."
),
)
with st.popover("Add web page"):
@ -105,8 +111,8 @@ class GUI:
st.file_uploader("Image file")
with st.popover("Run shell commands, tests, etc"):
st.markdown(
"Run a shell command and optionally share the output with the LLM. This is a"
" great way to run your program or run tests and have the LLM fix bugs."
"Run a shell command and optionally share the output with the LLM. This is"
" a great way to run your program or run tests and have the LLM fix bugs."
)
st.text_input("Command:")
st.radio(
@ -114,8 +120,8 @@ class GUI:
[
"Review the output and decide whether to share",
(
"Automatically share the output on non-zero exit code (ie, if any tests"
" fail)"
"Automatically share the output on non-zero exit code (ie, if any"
" tests fail)"
),
],
)
@ -221,19 +227,12 @@ class GUI:
self.init_state()
self.do_sidebar()
with self.cmds_tab:
self.do_cmd_tab()
self.do_messages_container()
with self.messages:
self.mock_tool_output()
self.chat()
def chat(self):
prompt = st.chat_input("Say something", on_submit=self.clear_controls)
# dump(old_prompt, prompt)
if self.old_prompt:
prompt = self.old_prompt