bluenevus commited on
Commit
dd2e659
·
verified ·
1 Parent(s): 3d0e539

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -23
app.py CHANGED
@@ -191,7 +191,7 @@ app.layout = dbc.Container([
191
  {"label": "GitLab", "value": "GitLab"},
192
  {"label": "Gitea", "value": "Gitea"}
193
  ],
194
- placeholder="Select Git Provider",
195
  className="mb-3",
196
  ),
197
  dbc.Input(id="repo-url", type="text", placeholder="Repository URL (owner/repo)", className="mb-3"),
@@ -201,6 +201,7 @@ app.layout = dbc.Container([
201
  {"label": "User Guide", "value": "User Guide"},
202
  {"label": "Administration Guide", "value": "Administration Guide"}
203
  ],
 
204
  inline=True,
205
  className="mb-3",
206
  ),
@@ -224,26 +225,13 @@ app.layout = dbc.Container([
224
  ], className="mt-4"),
225
  color="primary",
226
  ),
227
- ], width=6),
228
- dbc.Col([
229
- dbc.Card([
230
- dbc.CardBody([
231
- html.H4("Preview", className="card-title"),
232
- dcc.Textarea(
233
- id="generated-guide",
234
- style={"width": "100%", "height": "400px", "resize": "vertical"},
235
- readOnly=True
236
- ),
237
- ])
238
- ], className="mt-4"),
239
- ], width=6),
240
  ])
241
  ], fluid=True)
242
 
243
  # Update the callback
244
  @app.callback(
245
- [Output("generated-guide", "value"),
246
- Output("download-docx", "n_clicks"),
247
  Output("download-md", "n_clicks")],
248
  [Input("generate-button", "n_clicks")],
249
  [State("git-provider", "value"),
@@ -266,13 +254,7 @@ def update_output(n_clicks, git_provider, repo_url, guide_type, exclude_folders)
266
  thread.start()
267
  thread.join() # Wait for the thread to complete
268
 
269
- # Retrieve the generated guide text
270
- guide_text = thread._return if hasattr(thread, '_return') else None
271
-
272
- if guide_text is None:
273
- guide_text = "No content generated."
274
-
275
- return guide_text, 0, 0 # Return the raw markdown text and reset n_clicks for download buttons
276
 
277
  @app.callback(
278
  Output("download-docx-file", "data"),
 
191
  {"label": "GitLab", "value": "GitLab"},
192
  {"label": "Gitea", "value": "Gitea"}
193
  ],
194
+ value="GitHub", # Set default value to GitHub
195
  className="mb-3",
196
  ),
197
  dbc.Input(id="repo-url", type="text", placeholder="Repository URL (owner/repo)", className="mb-3"),
 
201
  {"label": "User Guide", "value": "User Guide"},
202
  {"label": "Administration Guide", "value": "Administration Guide"}
203
  ],
204
+ value="User Guide", # Set default value to User Guide
205
  inline=True,
206
  className="mb-3",
207
  ),
 
225
  ], className="mt-4"),
226
  color="primary",
227
  ),
228
+ ], width=12), # Changed to full width
 
 
 
 
 
 
 
 
 
 
 
 
229
  ])
230
  ], fluid=True)
231
 
232
  # Update the callback
233
  @app.callback(
234
+ [Output("download-docx", "n_clicks"),
 
235
  Output("download-md", "n_clicks")],
236
  [Input("generate-button", "n_clicks")],
237
  [State("git-provider", "value"),
 
254
  thread.start()
255
  thread.join() # Wait for the thread to complete
256
 
257
+ return 0, 0 # Reset n_clicks for download buttons
 
 
 
 
 
 
258
 
259
  @app.callback(
260
  Output("download-docx-file", "data"),