Vjay15 commited on
Commit
84875a9
·
verified ·
1 Parent(s): 4e0e3c6

Updated llm_utils.py to have a proper README.md file structure

Browse files
Files changed (1) hide show
  1. llm_utils.py +48 -3
llm_utils.py CHANGED
@@ -34,7 +34,12 @@ def generate_app_files(brief: str, checks: List[str], attachments: Optional[List
34
  'Create a single-page web application that implements the requirements.\n\n'
35
  'Output format - JSON object with:\n'
36
  '- "index": Complete HTML file with implementation\n'
37
- '- "README": Documentation markdown file\n\n'
 
 
 
 
 
38
  'Technical requirements:\n'
39
  '1. Process data client-side\n'
40
  '2. Use CDN libraries when needed\n'
@@ -128,8 +133,48 @@ def generate_app_files(brief: str, checks: List[str], attachments: Optional[List
128
  result["assets"] = sanitized_assets
129
  return result
130
 
131
- # Fallback: return the assistant output as the index.html and a basic README
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
132
  return {
133
  "index": content,
134
- "README": f"# {brief}\n\n{content}",
135
  }
 
34
  'Create a single-page web application that implements the requirements.\n\n'
35
  'Output format - JSON object with:\n'
36
  '- "index": Complete HTML file with implementation\n'
37
+ '- "README": Documentation markdown file following this structure:\n'
38
+ ' 1. Summary/Overview of the application\n'
39
+ ' 2. Setup instructions\n'
40
+ ' 3. Usage guide with examples\n'
41
+ ' 4. Code explanation and architecture\n'
42
+ ' 5. License information (MIT License)\n\n'
43
  'Technical requirements:\n'
44
  '1. Process data client-side\n'
45
  '2. Use CDN libraries when needed\n'
 
133
  result["assets"] = sanitized_assets
134
  return result
135
 
136
+ # Fallback: return the assistant output as the index.html and a structured README
137
+ readme_template = f"""# {brief}
138
+
139
+ ## Summary
140
+ A web application that {brief.lower()}
141
+
142
+ ## Setup
143
+ 1. Clone the repository
144
+ 2. Open index.html in a web browser
145
+ 3. No additional setup required as all dependencies are loaded via CDN
146
+
147
+ ## Usage
148
+ {content}
149
+
150
+ ## Code Explanation
151
+ The application is built using vanilla JavaScript and processes data client-side.
152
+ Please refer to the code comments in index.html for detailed implementation details.
153
+
154
+ ## License
155
+ MIT License
156
+
157
+ Copyright (c) {os.getenv('GITHUB_USER', '2024')}
158
+
159
+ Permission is hereby granted, free of charge, to any person obtaining a copy
160
+ of this software and associated documentation files (the "Software"), to deal
161
+ in the Software without restriction, including without limitation the rights
162
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
163
+ copies of the Software, and to permit persons to whom the Software is
164
+ furnished to do so, subject to the following conditions:
165
+
166
+ The above copyright notice and this permission notice shall be included in all
167
+ copies or substantial portions of the Software.
168
+
169
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
170
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
171
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
172
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
173
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
174
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
175
+ SOFTWARE."""
176
+
177
  return {
178
  "index": content,
179
+ "README": readme_template,
180
  }