codacus commited on
Commit
46f15bd
·
unverified ·
1 Parent(s): 0ad4aa5

fix: updated system prompt to have correct indentations (#1139)

Browse files

* updated system prompt to have correct indentations

* removed a section

app/lib/.server/llm/stream-text.ts CHANGED
@@ -96,15 +96,10 @@ function createFilesContext(files: FileMap) {
96
  return '';
97
  }
98
 
99
- const codeWithLinesNumbers = dirent.content
100
- .split('\n')
101
- .map((v, i) => `${i + 1}|${v}`)
102
- .join('\n');
103
-
104
- return `<file path="${path}">\n${codeWithLinesNumbers}\n</file>`;
105
  });
106
 
107
- return `Below are the code files present in the webcontainer:\ncode format:\n<line number>|<line content>\n <codebase>${fileContexts.join('\n\n')}\n\n</codebase>`;
108
  }
109
 
110
  function extractPropertiesFromMessage(message: Message): { model: string; provider: string; content: string } {
 
96
  return '';
97
  }
98
 
99
+ return `<file path="${path}">\n${dirent.content}\n</file>`;
 
 
 
 
 
100
  });
101
 
102
+ return `Below are the code files present in the webcontainer:\n <codebase>\n${fileContexts.join('\n\n')}\n</codebase>`;
103
  }
104
 
105
  function extractPropertiesFromMessage(message: Message): { model: string; provider: string; content: string } {
app/lib/common/prompts/optimized.ts CHANGED
@@ -99,16 +99,12 @@ Examples:
99
  Certainly, I can help you create a JavaScript function to calculate the factorial of a number.
100
 
101
  <boltArtifact id="factorial-function" title="JavaScript Factorial Function">
102
- <boltAction type="file" filePath="index.js">
103
- function factorial(n) {
104
  ...
105
  }
106
 
107
- ...
108
- </boltAction>
109
- <boltAction type="shell">
110
- node index.js
111
- </boltAction>
112
  </boltArtifact>
113
  </assistant_response>
114
  </example>
@@ -119,24 +115,16 @@ node index.js
119
  Certainly! I'd be happy to help you build a snake game using JavaScript and HTML5 Canvas. This will be a basic implementation that you can later expand upon. Let's create the game step by step.
120
 
121
  <boltArtifact id="snake-game" title="Snake Game in HTML and JavaScript">
122
- <boltAction type="file" filePath="package.json">
123
- {
124
  "name": "snake",
125
  "scripts": {
126
  "dev": "vite"
127
  }
128
  ...
129
- }
130
- </boltAction>
131
- <boltAction type="shell">
132
- npm install --save-dev vite
133
- </boltAction>
134
- <boltAction type="file" filePath="index.html">
135
- ...
136
- </boltAction>
137
- <boltAction type="start">
138
- npm run dev
139
- </boltAction>
140
  </boltArtifact>
141
 
142
  Now you can play the Snake game by opening the provided local server URL in your browser. Use the arrow keys to control the snake. Eat the red food to grow and increase your score. The game ends if you hit the wall or your own tail.
@@ -149,8 +137,7 @@ npm run dev
149
  Certainly! I'll create a bouncing ball with real gravity using React. We'll use the react-spring library for physics-based animations.
150
 
151
  <boltArtifact id="bouncing-ball-react" title="Bouncing Ball with Gravity in React">
152
- <boltAction type="file" filePath="package.json">
153
- {
154
  "name": "bouncing-ball",
155
  "private": true,
156
  "version": "0.0.0",
@@ -171,23 +158,12 @@ npm run dev
171
  "@vitejs/plugin-react": "^3.1.0",
172
  "vite": "^4.2.0"
173
  }
174
- }
175
- </boltAction>
176
- <boltAction type="file" filePath="index.html">
177
- ...
178
- </boltAction>
179
- <boltAction type="file" filePath="src/main.jsx">
180
- ...
181
- </boltAction>
182
- <boltAction type="file" filePath="src/index.css">
183
- ...
184
- </boltAction>
185
- <boltAction type="file" filePath="src/App.jsx">
186
- ...
187
- </boltAction>
188
- <boltAction type="start">
189
- npm run dev
190
- </boltAction>
191
  </boltArtifact>
192
 
193
  You can now view the bouncing ball animation in the preview. The ball will start falling from the top of the screen and bounce realistically when it hits the bottom.
 
99
  Certainly, I can help you create a JavaScript function to calculate the factorial of a number.
100
 
101
  <boltArtifact id="factorial-function" title="JavaScript Factorial Function">
102
+ <boltAction type="file" filePath="index.js">function factorial(n) {
 
103
  ...
104
  }
105
 
106
+ ...</boltAction>
107
+ <boltAction type="shell">node index.js</boltAction>
 
 
 
108
  </boltArtifact>
109
  </assistant_response>
110
  </example>
 
115
  Certainly! I'd be happy to help you build a snake game using JavaScript and HTML5 Canvas. This will be a basic implementation that you can later expand upon. Let's create the game step by step.
116
 
117
  <boltArtifact id="snake-game" title="Snake Game in HTML and JavaScript">
118
+ <boltAction type="file" filePath="package.json">{
 
119
  "name": "snake",
120
  "scripts": {
121
  "dev": "vite"
122
  }
123
  ...
124
+ }</boltAction>
125
+ <boltAction type="shell">npm install --save-dev vite</boltAction>
126
+ <boltAction type="file" filePath="index.html">...</boltAction>
127
+ <boltAction type="start">npm run dev</boltAction>
 
 
 
 
 
 
 
128
  </boltArtifact>
129
 
130
  Now you can play the Snake game by opening the provided local server URL in your browser. Use the arrow keys to control the snake. Eat the red food to grow and increase your score. The game ends if you hit the wall or your own tail.
 
137
  Certainly! I'll create a bouncing ball with real gravity using React. We'll use the react-spring library for physics-based animations.
138
 
139
  <boltArtifact id="bouncing-ball-react" title="Bouncing Ball with Gravity in React">
140
+ <boltAction type="file" filePath="package.json">{
 
141
  "name": "bouncing-ball",
142
  "private": true,
143
  "version": "0.0.0",
 
158
  "@vitejs/plugin-react": "^3.1.0",
159
  "vite": "^4.2.0"
160
  }
161
+ }</boltAction>
162
+ <boltAction type="file" filePath="index.html">...</boltAction>
163
+ <boltAction type="file" filePath="src/main.jsx">...</boltAction>
164
+ <boltAction type="file" filePath="src/index.css">...</boltAction>
165
+ <boltAction type="file" filePath="src/App.jsx">...</boltAction>
166
+ <boltAction type="start">npm run dev</boltAction>
 
 
 
 
 
 
 
 
 
 
 
167
  </boltArtifact>
168
 
169
  You can now view the bouncing ball animation in the preview. The ball will start falling from the top of the screen and bounce realistically when it hits the bottom.
app/lib/common/prompts/prompts.ts CHANGED
@@ -231,17 +231,12 @@ Here are some examples of correct usage of artifacts:
231
  Certainly, I can help you create a JavaScript function to calculate the factorial of a number.
232
 
233
  <boltArtifact id="factorial-function" title="JavaScript Factorial Function">
234
- <boltAction type="file" filePath="index.js">
235
- function factorial(n) {
236
- ...
237
- }
238
 
239
- ...
240
- </boltAction>
241
-
242
- <boltAction type="shell">
243
- node index.js
244
- </boltAction>
245
  </boltArtifact>
246
  </assistant_response>
247
  </example>
@@ -253,27 +248,19 @@ Here are some examples of correct usage of artifacts:
253
  Certainly! I'd be happy to help you build a snake game using JavaScript and HTML5 Canvas. This will be a basic implementation that you can later expand upon. Let's create the game step by step.
254
 
255
  <boltArtifact id="snake-game" title="Snake Game in HTML and JavaScript">
256
- <boltAction type="file" filePath="package.json">
257
- {
258
- "name": "snake",
259
- "scripts": {
260
- "dev": "vite"
261
- }
262
- ...
263
- }
264
- </boltAction>
265
-
266
- <boltAction type="shell">
267
- npm install --save-dev vite
268
- </boltAction>
269
-
270
- <boltAction type="file" filePath="index.html">
271
- ...
272
- </boltAction>
273
-
274
- <boltAction type="start">
275
- npm run dev
276
- </boltAction>
277
  </boltArtifact>
278
 
279
  Now you can play the Snake game by opening the provided local server URL in your browser. Use the arrow keys to control the snake. Eat the red food to grow and increase your score. The game ends if you hit the wall or your own tail.
@@ -287,50 +274,38 @@ Here are some examples of correct usage of artifacts:
287
  Certainly! I'll create a bouncing ball with real gravity using React. We'll use the react-spring library for physics-based animations.
288
 
289
  <boltArtifact id="bouncing-ball-react" title="Bouncing Ball with Gravity in React">
290
- <boltAction type="file" filePath="package.json">
291
- {
292
- "name": "bouncing-ball",
293
- "private": true,
294
- "version": "0.0.0",
295
- "type": "module",
296
- "scripts": {
297
- "dev": "vite",
298
- "build": "vite build",
299
- "preview": "vite preview"
300
- },
301
- "dependencies": {
302
- "react": "^18.2.0",
303
- "react-dom": "^18.2.0",
304
- "react-spring": "^9.7.1"
305
- },
306
- "devDependencies": {
307
- "@types/react": "^18.0.28",
308
- "@types/react-dom": "^18.0.11",
309
- "@vitejs/plugin-react": "^3.1.0",
310
- "vite": "^4.2.0"
311
- }
312
- }
313
- </boltAction>
314
-
315
- <boltAction type="file" filePath="index.html">
316
- ...
317
- </boltAction>
318
-
319
- <boltAction type="file" filePath="src/main.jsx">
320
- ...
321
- </boltAction>
322
-
323
- <boltAction type="file" filePath="src/index.css">
324
- ...
325
- </boltAction>
326
-
327
- <boltAction type="file" filePath="src/App.jsx">
328
- ...
329
- </boltAction>
330
-
331
- <boltAction type="start">
332
- npm run dev
333
- </boltAction>
334
  </boltArtifact>
335
 
336
  You can now view the bouncing ball animation in the preview. The ball will start falling from the top of the screen and bounce realistically when it hits the bottom.
 
231
  Certainly, I can help you create a JavaScript function to calculate the factorial of a number.
232
 
233
  <boltArtifact id="factorial-function" title="JavaScript Factorial Function">
234
+ <boltAction type="file" filePath="index.js">function factorial(n) {
235
+ ...
236
+ }
237
+ ...</boltAction>
238
 
239
+ <boltAction type="shell">node index.js</boltAction>
 
 
 
 
 
240
  </boltArtifact>
241
  </assistant_response>
242
  </example>
 
248
  Certainly! I'd be happy to help you build a snake game using JavaScript and HTML5 Canvas. This will be a basic implementation that you can later expand upon. Let's create the game step by step.
249
 
250
  <boltArtifact id="snake-game" title="Snake Game in HTML and JavaScript">
251
+ <boltAction type="file" filePath="package.json">{
252
+ "name": "snake",
253
+ "scripts": {
254
+ "dev": "vite"
255
+ }
256
+ ...
257
+ }</boltAction>
258
+
259
+ <boltAction type="shell">npm install --save-dev vite</boltAction>
260
+
261
+ <boltAction type="file" filePath="index.html">...</boltAction>
262
+
263
+ <boltAction type="start">npm run dev</boltAction>
 
 
 
 
 
 
 
 
264
  </boltArtifact>
265
 
266
  Now you can play the Snake game by opening the provided local server URL in your browser. Use the arrow keys to control the snake. Eat the red food to grow and increase your score. The game ends if you hit the wall or your own tail.
 
274
  Certainly! I'll create a bouncing ball with real gravity using React. We'll use the react-spring library for physics-based animations.
275
 
276
  <boltArtifact id="bouncing-ball-react" title="Bouncing Ball with Gravity in React">
277
+ <boltAction type="file" filePath="package.json">{
278
+ "name": "bouncing-ball",
279
+ "private": true,
280
+ "version": "0.0.0",
281
+ "type": "module",
282
+ "scripts": {
283
+ "dev": "vite",
284
+ "build": "vite build",
285
+ "preview": "vite preview"
286
+ },
287
+ "dependencies": {
288
+ "react": "^18.2.0",
289
+ "react-dom": "^18.2.0",
290
+ "react-spring": "^9.7.1"
291
+ },
292
+ "devDependencies": {
293
+ "@types/react": "^18.0.28",
294
+ "@types/react-dom": "^18.0.11",
295
+ "@vitejs/plugin-react": "^3.1.0",
296
+ "vite": "^4.2.0"
297
+ }
298
+ }</boltAction>
299
+
300
+ <boltAction type="file" filePath="index.html">...</boltAction>
301
+
302
+ <boltAction type="file" filePath="src/main.jsx">...</boltAction>
303
+
304
+ <boltAction type="file" filePath="src/index.css">...</boltAction>
305
+
306
+ <boltAction type="file" filePath="src/App.jsx">...</boltAction>
307
+
308
+ <boltAction type="start">npm run dev</boltAction>
 
 
 
 
 
 
 
 
 
 
 
 
309
  </boltArtifact>
310
 
311
  You can now view the bouncing ball animation in the preview. The ball will start falling from the top of the screen and bounce realistically when it hits the bottom.