fixed refactored code and validated inputs #2

Merged
godber merged 3 commits from validate-inputs into main 2025-08-14 08:11:28 -07:00
19 changed files with 371 additions and 539 deletions
Showing only changes of commit 6a995635ac - Show all commits

View File

@@ -6,6 +6,7 @@
"Bash(uv add:*)"
],
"deny": [],
"ask": []
"ask": [],
"defaultMode": "acceptEdits"
}
}

View File

@@ -90,7 +90,7 @@ uv run python main.py
The application follows a modular architecture for improved maintainability and testability:
```
```text
src/embeddingbuddy/
├── config/ # Configuration management
│ └── settings.py # Centralized app settings

View File

@@ -13,8 +13,6 @@ class DataProcessingCallbacks:
Output("processed-data", "data", allow_duplicate=True),
Output("upload-error-alert", "children", allow_duplicate=True),
Output("upload-error-alert", "is_open", allow_duplicate=True),
Output("upload-success-alert", "children", allow_duplicate=True),
Output("upload-success-alert", "is_open", allow_duplicate=True),
],
Input("upload-data", "contents"),
State("upload-data", "filename"),
@@ -22,7 +20,7 @@ class DataProcessingCallbacks:
)
def process_uploaded_file(contents, filename):
if contents is None:
return None, "", False, "", False
return None, "", False
processed_data = self.processor.process_upload(contents, filename)
@@ -32,11 +30,8 @@ class DataProcessingCallbacks:
{"error": processed_data.error},
error_message,
True, # Show error alert
"",
False, # Hide success alert
)
success_message = f"Successfully loaded {len(processed_data.documents)} documents from {filename or 'file'}"
return (
{
"documents": [
@@ -46,8 +41,6 @@ class DataProcessingCallbacks:
},
"",
False, # Hide error alert
success_message,
True, # Show success alert
)
@callback(

View File

@@ -12,7 +12,6 @@ class SidebarComponent:
[
html.H5("Upload Data", className="mb-3"),
self.upload_component.create_error_alert(),
self.upload_component.create_success_alert(),
self.upload_component.create_data_upload(),
self.upload_component.create_prompts_upload(),
self.upload_component.create_reset_button(),

View File

@@ -63,13 +63,3 @@ class UploadComponent:
className="mb-3",
)
@staticmethod
def create_success_alert():
"""Create success alert component for successful uploads."""
return dbc.Alert(
id="upload-success-alert",
dismissable=True,
is_open=False,
color="success",
className="mb-3",
)