bluenevus commited on
Commit
9f88b96
·
verified ·
1 Parent(s): 717943b

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +22 -1
app.py CHANGED
@@ -91,6 +91,15 @@ app.layout = dbc.Container([
91
  dbc.Col([
92
  html.Div(style={"height": "20px"}), # Small gap
93
  html.Div(id="loading-output"), # Text status box
 
 
 
 
 
 
 
 
 
94
  dcc.Loading(
95
  id="loading-indicator",
96
  type="dot",
@@ -176,7 +185,19 @@ def remove_file(n_clicks, existing_files):
176
  removed_file = triggered_id.split('"index":')[1].split('}')[0].strip('"')
177
 
178
  uploaded_files.pop(removed_file, None)
179
- return [file for file in existing_files if file['props']['children'][1]['children'] != removed_file]
 
 
 
 
 
 
 
 
 
 
 
 
180
 
181
  def generate_matrix_with_gpt(matrix_type, file_contents):
182
  prompt = f"""Generate a {matrix_type} based on the following project artifacts:
 
91
  dbc.Col([
92
  html.Div(style={"height": "20px"}), # Small gap
93
  html.Div(id="loading-output"), # Text status box
94
+ html.Div([ # New row for progress indicator
95
+ dcc.Loading(
96
+ id="loading-indicator",
97
+ type="dot",
98
+ children=[html.Div(style={"height": "50px"})] # Increased height for visibility
99
+ ),
100
+ ], className="my-3"), # Add margin for separation
101
+ html.Div(id='matrix-preview', className="border p-3 mb-3"),
102
+ html.Div(id="loading-output"), # Text status box
103
  dcc.Loading(
104
  id="loading-indicator",
105
  type="dot",
 
185
  removed_file = triggered_id.split('"index":')[1].split('}')[0].strip('"')
186
 
187
  uploaded_files.pop(removed_file, None)
188
+
189
+ # Updated file filtering logic
190
+ return [
191
+ file for file in existing_files
192
+ if isinstance(file, dict) and
193
+ 'props' in file and
194
+ 'children' in file['props'] and
195
+ isinstance(file['props']['children'], list) and
196
+ len(file['props']['children']) > 1 and
197
+ isinstance(file['props']['children'][1], dict) and
198
+ 'children' in file['props']['children'][1] and
199
+ file['props']['children'][1]['children'] != removed_file
200
+ ]
201
 
202
  def generate_matrix_with_gpt(matrix_type, file_contents):
203
  prompt = f"""Generate a {matrix_type} based on the following project artifacts: