Update app.py
Browse files
app.py
CHANGED
@@ -91,17 +91,14 @@ def generate_guide_section(file_path, file_content, guide_type):
|
|
91 |
|
92 |
if guide_type == "User Guide":
|
93 |
prompt = f"""Based on the following UI-related code file, generate a section for a user guide:
|
94 |
-
|
95 |
File: {file_path}
|
96 |
Content:
|
97 |
{file_content}
|
98 |
-
|
99 |
Please focus on:
|
100 |
1. The specific features and functionality this UI component provides to the end users
|
101 |
2. Step-by-step instructions on how to use these features
|
102 |
3. Any user interactions or inputs required
|
103 |
4. Expected outcomes or results for the user
|
104 |
-
|
105 |
Important formatting instructions:
|
106 |
- The output should be in plain text no markdown for example do not use * or ** or # or ##. Instead use numbers like 1., 2. for bullets
|
107 |
- Use clear section titles
|
@@ -111,17 +108,14 @@ def generate_guide_section(file_path, file_content, guide_type):
|
|
111 |
"""
|
112 |
else: # Administration Guide
|
113 |
prompt = f"""Based on the following UI-related code file, generate a section for an System guide:
|
114 |
-
|
115 |
File: {file_path}
|
116 |
Content:
|
117 |
{file_content}
|
118 |
-
|
119 |
Please focus on explaining what that component is and does:
|
120 |
1. Any configuration options or settings related to this UI component
|
121 |
2. Security considerations or access control related to this feature
|
122 |
3. How to monitor or troubleshoot issues with this component
|
123 |
4. Best practices for managing and maintaining this part of the system
|
124 |
-
|
125 |
Important formatting instructions:
|
126 |
- The output should be in plain text no markdown for example for example do not use * or ** or # or ##. Instead use numbers like 1., 2. for bullets
|
127 |
- Use clear section titles
|
@@ -185,10 +179,8 @@ app.layout = dbc.Container([
|
|
185 |
dbc.Row([
|
186 |
dbc.Col([
|
187 |
html.H1("Automated Guide Generator", className="text-center my-4"),
|
188 |
-
|
189 |
-
|
190 |
-
dbc.Row([
|
191 |
-
dbc.Col([
|
192 |
dbc.Card([
|
193 |
dbc.CardBody([
|
194 |
dbc.Form([
|
@@ -246,8 +238,8 @@ app.layout = dbc.Container([
|
|
246 |
|
247 |
@app.callback(
|
248 |
[Output("generated-guide", "children"),
|
249 |
-
Output("download-docx", "
|
250 |
-
Output("download-md", "
|
251 |
[Input("generate-button", "n_clicks")],
|
252 |
[State("git-provider", "value"),
|
253 |
State("repo-url", "value"),
|
@@ -273,12 +265,10 @@ def update_output(n_clicks, git_provider, repo_url, guide_type, exclude_folders)
|
|
273 |
# Convert the guide_text to a format that can be displayed in the Dash app
|
274 |
if guide_text:
|
275 |
preview_content = html.Pre(guide_text, style={"whiteSpace": "pre-wrap", "wordBreak": "break-word"})
|
276 |
-
download_buttons_disabled = False
|
277 |
else:
|
278 |
preview_content = "No content generated."
|
279 |
-
download_buttons_disabled = True
|
280 |
|
281 |
-
return preview_content,
|
282 |
|
283 |
@app.callback(
|
284 |
Output("download-docx-file", "data"),
|
|
|
91 |
|
92 |
if guide_type == "User Guide":
|
93 |
prompt = f"""Based on the following UI-related code file, generate a section for a user guide:
|
|
|
94 |
File: {file_path}
|
95 |
Content:
|
96 |
{file_content}
|
|
|
97 |
Please focus on:
|
98 |
1. The specific features and functionality this UI component provides to the end users
|
99 |
2. Step-by-step instructions on how to use these features
|
100 |
3. Any user interactions or inputs required
|
101 |
4. Expected outcomes or results for the user
|
|
|
102 |
Important formatting instructions:
|
103 |
- The output should be in plain text no markdown for example do not use * or ** or # or ##. Instead use numbers like 1., 2. for bullets
|
104 |
- Use clear section titles
|
|
|
108 |
"""
|
109 |
else: # Administration Guide
|
110 |
prompt = f"""Based on the following UI-related code file, generate a section for an System guide:
|
|
|
111 |
File: {file_path}
|
112 |
Content:
|
113 |
{file_content}
|
|
|
114 |
Please focus on explaining what that component is and does:
|
115 |
1. Any configuration options or settings related to this UI component
|
116 |
2. Security considerations or access control related to this feature
|
117 |
3. How to monitor or troubleshoot issues with this component
|
118 |
4. Best practices for managing and maintaining this part of the system
|
|
|
119 |
Important formatting instructions:
|
120 |
- The output should be in plain text no markdown for example for example do not use * or ** or # or ##. Instead use numbers like 1., 2. for bullets
|
121 |
- Use clear section titles
|
|
|
179 |
dbc.Row([
|
180 |
dbc.Col([
|
181 |
html.H1("Automated Guide Generator", className="text-center my-4"),
|
182 |
+
html.P("Generate a user guide or administration guide based on the UI-related code in a Git repository using Gemini AI. Select a Git provider, enter repository details, choose the guide type, and let AI create a comprehensive guide.", className="text-center mb-4"),
|
183 |
+
|
|
|
|
|
184 |
dbc.Card([
|
185 |
dbc.CardBody([
|
186 |
dbc.Form([
|
|
|
238 |
|
239 |
@app.callback(
|
240 |
[Output("generated-guide", "children"),
|
241 |
+
Output("download-docx", "n_clicks"),
|
242 |
+
Output("download-md", "n_clicks")],
|
243 |
[Input("generate-button", "n_clicks")],
|
244 |
[State("git-provider", "value"),
|
245 |
State("repo-url", "value"),
|
|
|
265 |
# Convert the guide_text to a format that can be displayed in the Dash app
|
266 |
if guide_text:
|
267 |
preview_content = html.Pre(guide_text, style={"whiteSpace": "pre-wrap", "wordBreak": "break-word"})
|
|
|
268 |
else:
|
269 |
preview_content = "No content generated."
|
|
|
270 |
|
271 |
+
return preview_content, 0, 0 # Return the preview content and reset n_clicks for download buttons
|
272 |
|
273 |
@app.callback(
|
274 |
Output("download-docx-file", "data"),
|