Skip to content

Commit

Permalink
Fix rendering of chat info button (#252)
Browse files Browse the repository at this point in the history
Co-authored-by: Philip Meier <github.pmeier@posteo.de>
  • Loading branch information
nenb and pmeier authored Dec 18, 2023
1 parent c9fd83d commit a437e7e
Showing 1 changed file with 10 additions and 16 deletions.
26 changes: 10 additions & 16 deletions ragna/deploy/_ui/central_view.py
Original file line number Diff line number Diff line change
Expand Up @@ -242,6 +242,14 @@ def __init__(self, api_wrapper, **params):
super().__init__(**params)

self.api_wrapper = api_wrapper
self.chat_info_button = pn.widgets.Button(
# The name will be filled at runtime in self.header
name="",
on_click=self.on_click_chat_info_wrapper,
button_style="outline",
icon="info-circle",
stylesheets=[":host { margin-top:10px; }"],
)
self.on_click_chat_info = None

def on_click_chat_info_wrapper(self, event):
Expand Down Expand Up @@ -613,26 +621,12 @@ def header(self):

chat_documents_pills.append(pill)

chat_info_button = None
if self.current_chat is not None:
button_name = f"{self.current_chat['metadata']['assistant']} | {self.current_chat['metadata']['source_storage']}"
chat_info_button = pn.widgets.Button(
name=button_name, button_style="outline", icon="info-circle"
)
chat_info_button.stylesheets.append(
"""
:host {
margin-top:10px;
}
"""
)
chat_info_button.on_click(self.on_click_chat_info_wrapper)
self.chat_info_button.name = f"{self.current_chat['metadata']['assistant']} | {self.current_chat['metadata']['source_storage']}"

return pn.Row(
chat_name_header,
*chat_documents_pills,
chat_info_button,
self.chat_info_button,
stylesheets=[
""":host {
background-color: #F9F9F9;
Expand Down

0 comments on commit a437e7e

Please sign in to comment.