mirror of
https://github.com/Aider-AI/aider.git
synced 2025-05-31 01:35:00 +00:00
refac
This commit is contained in:
parent
d549d5ecab
commit
98d2997035
1 changed files with 93 additions and 74 deletions
21
aider/gui.py
21
aider/gui.py
|
@ -35,7 +35,6 @@ def recent_msgs():
|
||||||
]
|
]
|
||||||
# msgs = 30 * msgs
|
# msgs = 30 * msgs
|
||||||
|
|
||||||
dump(st.session_state.recent_msgs_num)
|
|
||||||
return st.selectbox(
|
return st.selectbox(
|
||||||
"N/A",
|
"N/A",
|
||||||
msgs,
|
msgs,
|
||||||
|
@ -114,6 +113,13 @@ class GUI:
|
||||||
|
|
||||||
def do_cmd_tab(self):
|
def do_cmd_tab(self):
|
||||||
with self.cmds_tab:
|
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.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(
|
||||||
|
@ -126,6 +132,7 @@ class GUI:
|
||||||
st.write("It's best to keep aider's internal files out of your git repo.")
|
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="?")
|
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):
|
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",
|
||||||
|
@ -166,6 +173,7 @@ class GUI:
|
||||||
],
|
],
|
||||||
)
|
)
|
||||||
|
|
||||||
|
def do_tokens_and_cost(self):
|
||||||
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")
|
||||||
|
@ -174,6 +182,7 @@ class GUI:
|
||||||
# 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")
|
||||||
|
|
||||||
|
def do_git(self):
|
||||||
with st.expander("Git", expanded=False):
|
with st.expander("Git", expanded=False):
|
||||||
# st.button("Show last diff")
|
# st.button("Show last diff")
|
||||||
# st.button("Undo last commit")
|
# st.button("Undo last commit")
|
||||||
|
@ -190,6 +199,7 @@ class GUI:
|
||||||
],
|
],
|
||||||
)
|
)
|
||||||
|
|
||||||
|
def do_recent_msgs(self):
|
||||||
self.recent_msgs_empty = st.empty()
|
self.recent_msgs_empty = st.empty()
|
||||||
self.reset_recent_msgs()
|
self.reset_recent_msgs()
|
||||||
|
|
||||||
|
@ -226,6 +236,13 @@ class GUI:
|
||||||
|
|
||||||
def __init__(self, coder):
|
def __init__(self, coder):
|
||||||
self.coder = 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.chat_controls = None
|
||||||
|
|
||||||
self.init_state()
|
self.init_state()
|
||||||
|
@ -254,6 +271,8 @@ class GUI:
|
||||||
st.write(prompt)
|
st.write(prompt)
|
||||||
|
|
||||||
res = self.coder.run(prompt)
|
res = self.coder.run(prompt)
|
||||||
|
# self.coder.io.user_input(with_message)
|
||||||
|
|
||||||
st.session_state.messages.append({"role": "assistant", "content": res})
|
st.session_state.messages.append({"role": "assistant", "content": res})
|
||||||
|
|
||||||
with self.messages.chat_message("assistant"):
|
with self.messages.chat_message("assistant"):
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue