fixed refactored code and validated inputs #2
@@ -6,6 +6,7 @@
|
||||
"Bash(uv add:*)"
|
||||
],
|
||||
"deny": [],
|
||||
"ask": []
|
||||
"ask": [],
|
||||
"defaultMode": "acceptEdits"
|
||||
}
|
||||
}
|
@@ -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
|
||||
|
@@ -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(
|
||||
|
@@ -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(),
|
||||
|
@@ -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",
|
||||
)
|
||||
|
Reference in New Issue
Block a user