mirror of
https://github.com/Aider-AI/aider.git
synced 2025-05-24 14:25:00 +00:00
put web content into a text box
This commit is contained in:
parent
355e072de8
commit
f822fd0554
1 changed files with 16 additions and 11 deletions
27
aider/gui.py
27
aider/gui.py
|
@ -54,6 +54,7 @@ def get_coder():
|
||||||
|
|
||||||
class GUI:
|
class GUI:
|
||||||
prompt = None
|
prompt = None
|
||||||
|
prompt_as = "user"
|
||||||
last_undo_button = None
|
last_undo_button = None
|
||||||
recent_msgs_empty = None
|
recent_msgs_empty = None
|
||||||
web_content_empty = None
|
web_content_empty = None
|
||||||
|
@ -259,10 +260,10 @@ class GUI:
|
||||||
self.show_edit_info(msg)
|
self.show_edit_info(msg)
|
||||||
elif role == "info":
|
elif role == "info":
|
||||||
st.info(msg["message"])
|
st.info(msg["message"])
|
||||||
# elif role == "text":
|
elif role == "text":
|
||||||
# text = msg["message"]
|
text = msg["content"]
|
||||||
# with st.expander(text[0]):
|
with self.messages.expander(text.splitlines()[0]):
|
||||||
# st.text(text)
|
st.text(text)
|
||||||
elif role in ("user", "assistant"):
|
elif role in ("user", "assistant"):
|
||||||
with st.chat_message(role):
|
with st.chat_message(role):
|
||||||
st.write(msg["content"])
|
st.write(msg["content"])
|
||||||
|
@ -321,9 +322,13 @@ class GUI:
|
||||||
self.coder.io.add_to_input_history(self.prompt)
|
self.coder.io.add_to_input_history(self.prompt)
|
||||||
self.state.input_history.append(self.prompt)
|
self.state.input_history.append(self.prompt)
|
||||||
|
|
||||||
self.state.messages.append({"role": "user", "content": self.prompt})
|
self.state.messages.append({"role": self.prompt_as, "content": self.prompt})
|
||||||
with self.messages.chat_message("user"):
|
if self.prompt_as == "user":
|
||||||
st.write(self.prompt)
|
with self.messages.chat_message("user"):
|
||||||
|
st.write(self.prompt)
|
||||||
|
elif self.prompt_as == "text":
|
||||||
|
with self.messages.expander(self.prompt.splitlines()[0]):
|
||||||
|
st.text(self.prompt)
|
||||||
|
|
||||||
# re-render the UI for the prompt_pending state
|
# re-render the UI for the prompt_pending state
|
||||||
st.experimental_rerun()
|
st.experimental_rerun()
|
||||||
|
@ -407,17 +412,17 @@ class GUI:
|
||||||
|
|
||||||
content = self.scraper.scrape(url) or ""
|
content = self.scraper.scrape(url) or ""
|
||||||
if content.strip():
|
if content.strip():
|
||||||
content = f"{url}:\n\n" + content
|
content = f"{url}\n\n" + content
|
||||||
self.prompt = content
|
self.prompt = content
|
||||||
|
self.prompt_as = "text"
|
||||||
else:
|
else:
|
||||||
self.info(f"No web content found for `{url}`.")
|
self.info(f"No web content found for `{url}`.")
|
||||||
self.web_content = None
|
self.web_content = None
|
||||||
|
|
||||||
# with self.messages.expander(content.splitlines()[0]):
|
|
||||||
# st.text(content)
|
|
||||||
|
|
||||||
|
|
||||||
def gui_main():
|
def gui_main():
|
||||||
|
st.set_page_config(layout="wide")
|
||||||
|
|
||||||
coder = get_coder()
|
coder = get_coder()
|
||||||
state = get_state()
|
state = get_state()
|
||||||
GUI(coder, state)
|
GUI(coder, state)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue