Update app.py
Browse files
app.py
CHANGED
@@ -229,15 +229,20 @@ app.layout = dbc.Container([
|
|
229 |
dbc.Card([
|
230 |
dbc.CardBody([
|
231 |
html.H4("Preview", className="card-title"),
|
232 |
-
|
|
|
|
|
|
|
|
|
233 |
])
|
234 |
], className="mt-4"),
|
235 |
], width=6),
|
236 |
])
|
237 |
], fluid=True)
|
238 |
|
|
|
239 |
@app.callback(
|
240 |
-
[Output("generated-guide", "
|
241 |
Output("download-docx", "n_clicks"),
|
242 |
Output("download-md", "n_clicks")],
|
243 |
[Input("generate-button", "n_clicks")],
|
@@ -262,15 +267,12 @@ def update_output(n_clicks, git_provider, repo_url, guide_type, exclude_folders)
|
|
262 |
thread.join() # Wait for the thread to complete
|
263 |
|
264 |
# Retrieve the generated guide text
|
265 |
-
guide_text = thread.
|
266 |
|
267 |
-
|
268 |
-
|
269 |
-
preview_content = dcc.Markdown(guide_text, style={"whiteSpace": "pre-wrap", "wordBreak": "break-word"})
|
270 |
-
else:
|
271 |
-
preview_content = "No content generated."
|
272 |
|
273 |
-
return
|
274 |
|
275 |
@app.callback(
|
276 |
Output("download-docx-file", "data"),
|
|
|
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")],
|
|
|
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"),
|