From c29160c9e9549ea9e2a5b2951d9cd99ff866b99f Mon Sep 17 00:00:00 2001 From: Austin Godber Date: Sat, 13 Sep 2025 14:43:09 -0700 Subject: [PATCH] format --- src/embeddingbuddy/app.py | 4 +- .../ui/callbacks/interactions.py | 1 - .../ui/components/datasource.py | 1 - src/embeddingbuddy/ui/components/sidebar.py | 60 +++++---- src/embeddingbuddy/ui/components/textinput.py | 1 - src/embeddingbuddy/ui/components/upload.py | 126 ++++++++++-------- uv.lock | 2 +- 7 files changed, 103 insertions(+), 92 deletions(-) diff --git a/src/embeddingbuddy/app.py b/src/embeddingbuddy/app.py index 3ea272e..dae0a47 100644 --- a/src/embeddingbuddy/app.py +++ b/src/embeddingbuddy/app.py @@ -18,9 +18,9 @@ def create_app(): __name__, external_stylesheets=[ 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 diff --git a/src/embeddingbuddy/ui/callbacks/interactions.py b/src/embeddingbuddy/ui/callbacks/interactions.py index 36d76ec..b9130f7 100644 --- a/src/embeddingbuddy/ui/callbacks/interactions.py +++ b/src/embeddingbuddy/ui/callbacks/interactions.py @@ -20,4 +20,3 @@ class InteractionCallbacks: return dash.no_update, dash.no_update return None, None - diff --git a/src/embeddingbuddy/ui/components/datasource.py b/src/embeddingbuddy/ui/components/datasource.py index dd6e824..2d4c630 100644 --- a/src/embeddingbuddy/ui/components/datasource.py +++ b/src/embeddingbuddy/ui/components/datasource.py @@ -208,7 +208,6 @@ class DataSourceComponent: ] ) - def _create_opensearch_section(self, section_type): """Create a complete OpenSearch section for either 'data' or 'prompts'.""" section_id = section_type # 'data' or 'prompts' diff --git a/src/embeddingbuddy/ui/components/sidebar.py b/src/embeddingbuddy/ui/components/sidebar.py index 94ad9f9..f807e44 100644 --- a/src/embeddingbuddy/ui/components/sidebar.py +++ b/src/embeddingbuddy/ui/components/sidebar.py @@ -87,15 +87,17 @@ class SidebarComponent: [ self.textinput_component.create_text_input_interface(), ], - title=html.Span([ - "Generate Embeddings ", - html.I( - className="fas fa-info-circle text-muted", - style={"cursor": "pointer"}, - id="generate-embeddings-info-icon", - title="Create new embeddings from text input using various in-browser models" - ) - ]), + title=html.Span( + [ + "Generate Embeddings ", + html.I( + className="fas fa-info-circle text-muted", + style={"cursor": "pointer"}, + id="generate-embeddings-info-icon", + title="Create new embeddings from text input using various in-browser models", + ), + ] + ), item_id="generate-embeddings-accordion", ) @@ -106,15 +108,17 @@ class SidebarComponent: self.datasource_component.create_success_alert(), self.datasource_component.create_tabbed_interface(), ], - title=html.Span([ - "Load Embeddings ", - html.I( - className="fas fa-info-circle text-muted", - style={"cursor": "pointer"}, - id="load-embeddings-info-icon", - title="Load existing embeddings: upload files or read from OpenSearch" - ) - ]), + title=html.Span( + [ + "Load Embeddings ", + html.I( + className="fas fa-info-circle text-muted", + style={"cursor": "pointer"}, + id="load-embeddings-info-icon", + title="Load existing embeddings: upload files or read from OpenSearch", + ), + ] + ), item_id="data-sources-accordion", ) @@ -124,14 +128,16 @@ class SidebarComponent: + self._create_color_dropdown() + self._create_dimension_toggle() + self._create_prompts_toggle(), - title=html.Span([ - "Visualization Controls ", - html.I( - className="fas fa-info-circle text-muted", - style={"cursor": "pointer"}, - id="visualization-controls-info-icon", - title="Configure plot settings: select dimensionality reduction method, colors, and display options" - ) - ]), + title=html.Span( + [ + "Visualization Controls ", + html.I( + className="fas fa-info-circle text-muted", + style={"cursor": "pointer"}, + id="visualization-controls-info-icon", + title="Configure plot settings: select dimensionality reduction method, colors, and display options", + ), + ] + ), item_id="visualization-controls-accordion", ) diff --git a/src/embeddingbuddy/ui/components/textinput.py b/src/embeddingbuddy/ui/components/textinput.py index aed6e3a..b19f925 100644 --- a/src/embeddingbuddy/ui/components/textinput.py +++ b/src/embeddingbuddy/ui/components/textinput.py @@ -294,7 +294,6 @@ class TextInputComponent: ] ) - def _create_status_section(self): """Create status alerts and results preview.""" return html.Div( diff --git a/src/embeddingbuddy/ui/components/upload.py b/src/embeddingbuddy/ui/components/upload.py index d924170..b60abfe 100644 --- a/src/embeddingbuddy/ui/components/upload.py +++ b/src/embeddingbuddy/ui/components/upload.py @@ -5,68 +5,76 @@ import dash_bootstrap_components as dbc class UploadComponent: @staticmethod def create_data_upload(): - return html.Div([ - dcc.Upload( - id="upload-data", - children=html.Div([ - "Upload Data ", - html.I( - className="fas fa-info-circle", - style={"color": "#6c757d", "fontSize": "14px"}, - id="data-upload-info" - ) - ]), - style={ - "width": "100%", - "height": "60px", - "lineHeight": "60px", - "borderWidth": "1px", - "borderStyle": "dashed", - "borderRadius": "5px", - "textAlign": "center", - "margin-bottom": "20px", - }, - multiple=False, - ), - dbc.Tooltip( - "Click here or drag and drop NDJSON files containing document embeddings", - target="data-upload-info", - placement="top" - ) - ]) + return html.Div( + [ + dcc.Upload( + id="upload-data", + children=html.Div( + [ + "Upload Data ", + html.I( + className="fas fa-info-circle", + style={"color": "#6c757d", "fontSize": "14px"}, + id="data-upload-info", + ), + ] + ), + style={ + "width": "100%", + "height": "60px", + "lineHeight": "60px", + "borderWidth": "1px", + "borderStyle": "dashed", + "borderRadius": "5px", + "textAlign": "center", + "margin-bottom": "20px", + }, + multiple=False, + ), + dbc.Tooltip( + "Click here or drag and drop NDJSON files containing document embeddings", + target="data-upload-info", + placement="top", + ), + ] + ) @staticmethod def create_prompts_upload(): - return html.Div([ - dcc.Upload( - id="upload-prompts", - children=html.Div([ - "Upload Prompts ", - html.I( - className="fas fa-info-circle", - style={"color": "#6c757d", "fontSize": "14px"}, - id="prompts-upload-info" - ) - ]), - style={ - "width": "100%", - "height": "60px", - "lineHeight": "60px", - "borderWidth": "1px", - "borderStyle": "dashed", - "borderRadius": "5px", - "textAlign": "center", - "margin-bottom": "20px", - "borderColor": "#28a745", - }, - multiple=False, - ), - dbc.Tooltip( - "Click here or drag and drop NDJSON files containing prompt embeddings", - target="prompts-upload-info", - placement="top" - ) - ]) + return html.Div( + [ + dcc.Upload( + id="upload-prompts", + children=html.Div( + [ + "Upload Prompts ", + html.I( + className="fas fa-info-circle", + style={"color": "#6c757d", "fontSize": "14px"}, + id="prompts-upload-info", + ), + ] + ), + style={ + "width": "100%", + "height": "60px", + "lineHeight": "60px", + "borderWidth": "1px", + "borderStyle": "dashed", + "borderRadius": "5px", + "textAlign": "center", + "margin-bottom": "20px", + "borderColor": "#28a745", + }, + multiple=False, + ), + dbc.Tooltip( + "Click here or drag and drop NDJSON files containing prompt embeddings", + target="prompts-upload-info", + placement="top", + ), + ] + ) @staticmethod def create_reset_button(): diff --git a/uv.lock b/uv.lock index c9424db..69e3885 100644 --- a/uv.lock +++ b/uv.lock @@ -412,7 +412,7 @@ wheels = [ [[package]] name = "embeddingbuddy" -version = "0.4.0" +version = "0.5.0" source = { editable = "." } dependencies = [ { name = "dash" },