v0.5.0 - rework the sidebar #6

Merged
godber merged 3 commits from restructure-sidebar into main 2025-09-13 14:59:48 -07:00
18 changed files with 300 additions and 321 deletions
Showing only changes of commit c29160c9e9 - Show all commits

View File

@@ -18,9 +18,9 @@ def create_app():
__name__, __name__,
external_stylesheets=[ external_stylesheets=[
dbc.themes.BOOTSTRAP, dbc.themes.BOOTSTRAP,
"https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css" "https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css",
], ],
assets_folder=assets_path assets_folder=assets_path,
) )
# Allow callbacks to components that are dynamically created in tabs # Allow callbacks to components that are dynamically created in tabs

View File

@@ -20,4 +20,3 @@ class InteractionCallbacks:
return dash.no_update, dash.no_update return dash.no_update, dash.no_update
return None, None return None, None

View File

@@ -208,7 +208,6 @@ class DataSourceComponent:
] ]
) )
def _create_opensearch_section(self, section_type): def _create_opensearch_section(self, section_type):
"""Create a complete OpenSearch section for either 'data' or 'prompts'.""" """Create a complete OpenSearch section for either 'data' or 'prompts'."""
section_id = section_type # 'data' or 'prompts' section_id = section_type # 'data' or 'prompts'

View File

@@ -87,15 +87,17 @@ class SidebarComponent:
[ [
self.textinput_component.create_text_input_interface(), self.textinput_component.create_text_input_interface(),
], ],
title=html.Span([ title=html.Span(
[
"Generate Embeddings ", "Generate Embeddings ",
html.I( html.I(
className="fas fa-info-circle text-muted", className="fas fa-info-circle text-muted",
style={"cursor": "pointer"}, style={"cursor": "pointer"},
id="generate-embeddings-info-icon", id="generate-embeddings-info-icon",
title="Create new embeddings from text input using various in-browser models" title="Create new embeddings from text input using various in-browser models",
) ),
]), ]
),
item_id="generate-embeddings-accordion", item_id="generate-embeddings-accordion",
) )
@@ -106,15 +108,17 @@ class SidebarComponent:
self.datasource_component.create_success_alert(), self.datasource_component.create_success_alert(),
self.datasource_component.create_tabbed_interface(), self.datasource_component.create_tabbed_interface(),
], ],
title=html.Span([ title=html.Span(
[
"Load Embeddings ", "Load Embeddings ",
html.I( html.I(
className="fas fa-info-circle text-muted", className="fas fa-info-circle text-muted",
style={"cursor": "pointer"}, style={"cursor": "pointer"},
id="load-embeddings-info-icon", id="load-embeddings-info-icon",
title="Load existing embeddings: upload files or read from OpenSearch" title="Load existing embeddings: upload files or read from OpenSearch",
) ),
]), ]
),
item_id="data-sources-accordion", item_id="data-sources-accordion",
) )
@@ -124,14 +128,16 @@ class SidebarComponent:
+ self._create_color_dropdown() + self._create_color_dropdown()
+ self._create_dimension_toggle() + self._create_dimension_toggle()
+ self._create_prompts_toggle(), + self._create_prompts_toggle(),
title=html.Span([ title=html.Span(
[
"Visualization Controls ", "Visualization Controls ",
html.I( html.I(
className="fas fa-info-circle text-muted", className="fas fa-info-circle text-muted",
style={"cursor": "pointer"}, style={"cursor": "pointer"},
id="visualization-controls-info-icon", id="visualization-controls-info-icon",
title="Configure plot settings: select dimensionality reduction method, colors, and display options" title="Configure plot settings: select dimensionality reduction method, colors, and display options",
) ),
]), ]
),
item_id="visualization-controls-accordion", item_id="visualization-controls-accordion",
) )

View File

@@ -294,7 +294,6 @@ class TextInputComponent:
] ]
) )
def _create_status_section(self): def _create_status_section(self):
"""Create status alerts and results preview.""" """Create status alerts and results preview."""
return html.Div( return html.Div(

View File

@@ -5,17 +5,20 @@ import dash_bootstrap_components as dbc
class UploadComponent: class UploadComponent:
@staticmethod @staticmethod
def create_data_upload(): def create_data_upload():
return html.Div([ return html.Div(
[
dcc.Upload( dcc.Upload(
id="upload-data", id="upload-data",
children=html.Div([ children=html.Div(
[
"Upload Data ", "Upload Data ",
html.I( html.I(
className="fas fa-info-circle", className="fas fa-info-circle",
style={"color": "#6c757d", "fontSize": "14px"}, style={"color": "#6c757d", "fontSize": "14px"},
id="data-upload-info" id="data-upload-info",
) ),
]), ]
),
style={ style={
"width": "100%", "width": "100%",
"height": "60px", "height": "60px",
@@ -31,23 +34,27 @@ class UploadComponent:
dbc.Tooltip( dbc.Tooltip(
"Click here or drag and drop NDJSON files containing document embeddings", "Click here or drag and drop NDJSON files containing document embeddings",
target="data-upload-info", target="data-upload-info",
placement="top" placement="top",
),
]
) )
])
@staticmethod @staticmethod
def create_prompts_upload(): def create_prompts_upload():
return html.Div([ return html.Div(
[
dcc.Upload( dcc.Upload(
id="upload-prompts", id="upload-prompts",
children=html.Div([ children=html.Div(
[
"Upload Prompts ", "Upload Prompts ",
html.I( html.I(
className="fas fa-info-circle", className="fas fa-info-circle",
style={"color": "#6c757d", "fontSize": "14px"}, style={"color": "#6c757d", "fontSize": "14px"},
id="prompts-upload-info" id="prompts-upload-info",
) ),
]), ]
),
style={ style={
"width": "100%", "width": "100%",
"height": "60px", "height": "60px",
@@ -64,9 +71,10 @@ class UploadComponent:
dbc.Tooltip( dbc.Tooltip(
"Click here or drag and drop NDJSON files containing prompt embeddings", "Click here or drag and drop NDJSON files containing prompt embeddings",
target="prompts-upload-info", target="prompts-upload-info",
placement="top" placement="top",
),
]
) )
])
@staticmethod @staticmethod
def create_reset_button(): def create_reset_button():

2
uv.lock generated
View File

@@ -412,7 +412,7 @@ wheels = [
[[package]] [[package]]
name = "embeddingbuddy" name = "embeddingbuddy"
version = "0.4.0" version = "0.5.0"
source = { editable = "." } source = { editable = "." }
dependencies = [ dependencies = [
{ name = "dash" }, { name = "dash" },