Skip to content

Commit

Permalink
Restore chat interface full height (#10314)
Browse files Browse the repository at this point in the history
* changes

* add changeset

* changes

* fix position of additional examples

* Update shaky-shirts-hammer.md

---------

Co-authored-by: Ali Abid <[email protected]>
Co-authored-by: gradio-pr-bot <[email protected]>
Co-authored-by: Abubakar Abid <[email protected]>
  • Loading branch information
4 people authored Jan 8, 2025
1 parent f19ca89 commit 84e72e4
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 22 deletions.
5 changes: 5 additions & 0 deletions .changeset/shaky-shirts-hammer.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"gradio": patch
---

feat:Restore chat interface full height
48 changes: 26 additions & 22 deletions gradio/chat_interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -257,14 +257,19 @@ def __init__(

with Column():
self._render_header()
with Row():
self._render_history_area()
with Column(scale=6):
self._render_chatbot_area(
chatbot, textbox, submit_btn, stop_btn
)
self._render_footer()
self._setup_events()
if self.save_history:
with Row():
self._render_history_area()
with Column(scale=6):
self._render_chatbot_area(
chatbot, textbox, submit_btn, stop_btn
)
self._render_footer()
else:
self._render_chatbot_area(chatbot, textbox, submit_btn, stop_btn)
self._render_footer()

self._setup_events()

def _render_header(self):
if self.title:
Expand All @@ -275,20 +280,19 @@ def _render_header(self):
Markdown(self.description)

def _render_history_area(self):
if self.save_history:
with Column(scale=1, min_width=100):
self.new_chat_button = Button(
"New chat",
variant="primary",
size="md",
icon=utils.get_icon_path("plus.svg"),
)
self.chat_history_dataset = Dataset(
components=[Textbox(visible=False)],
show_label=False,
layout="table",
type="index",
)
with Column(scale=1, min_width=100):
self.new_chat_button = Button(
"New chat",
variant="primary",
size="md",
icon=utils.get_icon_path("plus.svg"),
)
self.chat_history_dataset = Dataset(
components=[Textbox(visible=False)],
show_label=False,
layout="table",
type="index",
)

def _render_chatbot_area(
self,
Expand Down

0 comments on commit 84e72e4

Please sign in to comment.