This commit is contained in:
Paul Gauthier 2024-04-26 14:59:02 -07:00
parent d549d5ecab
commit 98d2997035

View file

@ -35,7 +35,6 @@ def recent_msgs():
]
# msgs = 30 * msgs
dump(st.session_state.recent_msgs_num)
return st.selectbox(
"N/A",
msgs,
@ -114,6 +113,13 @@ class GUI:
def do_cmd_tab(self):
with self.cmds_tab:
self.do_recommended_actions()
self.do_add_to_chat()
self.do_tokens_and_cost()
self.do_git()
self.do_recent_msgs()
def do_recommended_actions(self):
with st.expander("Recommended actions", expanded=True):
with st.popover("Create a git repo to track changes"):
st.write(
@ -126,6 +132,7 @@ class GUI:
st.write("It's best to keep aider's internal files out of your git repo.")
st.button("Add `.aider*` to `.gitignore`", key=random.random(), help="?")
def do_add_to_chat(self):
with st.expander("Add to the chat", expanded=True):
st.multiselect(
"Files for the LLM to edit",
@ -166,6 +173,7 @@ class GUI:
],
)
def do_tokens_and_cost(self):
with st.expander("Tokens and costs", expanded=True):
with st.popover("Show token usage"):
st.write("hi")
@ -174,6 +182,7 @@ class GUI:
# st.metric("Cost to send next message", "$0.0013", help="foo")
st.metric("Total cost this session", "$0.22")
def do_git(self):
with st.expander("Git", expanded=False):
# st.button("Show last diff")
# st.button("Undo last commit")
@ -190,6 +199,7 @@ class GUI:
],
)
def do_recent_msgs(self):
self.recent_msgs_empty = st.empty()
self.reset_recent_msgs()
@ -226,6 +236,13 @@ class GUI:
def __init__(self, coder):
self.coder = coder
# Force the coder to cooperate, regardless of cmd line args
self.coder.yield_stream = True
self.coder.stream = True
self.coder.io.yes = True
self.coder.pretty = False
self.chat_controls = None
self.init_state()
@ -254,6 +271,8 @@ class GUI:
st.write(prompt)
res = self.coder.run(prompt)
# self.coder.io.user_input(with_message)
st.session_state.messages.append({"role": "assistant", "content": res})
with self.messages.chat_message("assistant"):