fix: updated system prompt to have correct indentations (#1139)
Some checks are pending
Docker Publish / docker-build-publish (push) Waiting to run
Update Stable Branch / prepare-release (push) Waiting to run

* updated system prompt to have correct indentations

* removed a section
This commit is contained in:
Anirban Kar 2025-01-22 01:59:07 +05:30 committed by GitHub
parent 0ad4aa56d3
commit 46f15bdde6
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 59 additions and 113 deletions

View File

@ -96,15 +96,10 @@ function createFilesContext(files: FileMap) {
return ''; return '';
} }
const codeWithLinesNumbers = dirent.content return `<file path="${path}">\n${dirent.content}\n</file>`;
.split('\n')
.map((v, i) => `${i + 1}|${v}`)
.join('\n');
return `<file path="${path}">\n${codeWithLinesNumbers}\n</file>`;
}); });
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>`; return `Below are the code files present in the webcontainer:\n <codebase>\n${fileContexts.join('\n\n')}\n</codebase>`;
} }
function extractPropertiesFromMessage(message: Message): { model: string; provider: string; content: string } { function extractPropertiesFromMessage(message: Message): { model: string; provider: string; content: string } {

View File

@ -99,16 +99,12 @@ Examples:
Certainly, I can help you create a JavaScript function to calculate the factorial of a number. Certainly, I can help you create a JavaScript function to calculate the factorial of a number.
<boltArtifact id="factorial-function" title="JavaScript Factorial Function"> <boltArtifact id="factorial-function" title="JavaScript Factorial Function">
<boltAction type="file" filePath="index.js"> <boltAction type="file" filePath="index.js">function factorial(n) {
function factorial(n) {
... ...
} }
... ...</boltAction>
</boltAction> <boltAction type="shell">node index.js</boltAction>
<boltAction type="shell">
node index.js
</boltAction>
</boltArtifact> </boltArtifact>
</assistant_response> </assistant_response>
</example> </example>
@ -119,24 +115,16 @@ node index.js
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. 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.
<boltArtifact id="snake-game" title="Snake Game in HTML and JavaScript"> <boltArtifact id="snake-game" title="Snake Game in HTML and JavaScript">
<boltAction type="file" filePath="package.json"> <boltAction type="file" filePath="package.json">{
{
"name": "snake", "name": "snake",
"scripts": { "scripts": {
"dev": "vite" "dev": "vite"
} }
... ...
} }</boltAction>
</boltAction> <boltAction type="shell">npm install --save-dev vite</boltAction>
<boltAction type="shell"> <boltAction type="file" filePath="index.html">...</boltAction>
npm install --save-dev vite <boltAction type="start">npm run dev</boltAction>
</boltAction>
<boltAction type="file" filePath="index.html">
...
</boltAction>
<boltAction type="start">
npm run dev
</boltAction>
</boltArtifact> </boltArtifact>
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. 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
Certainly! I'll create a bouncing ball with real gravity using React. We'll use the react-spring library for physics-based animations. Certainly! I'll create a bouncing ball with real gravity using React. We'll use the react-spring library for physics-based animations.
<boltArtifact id="bouncing-ball-react" title="Bouncing Ball with Gravity in React"> <boltArtifact id="bouncing-ball-react" title="Bouncing Ball with Gravity in React">
<boltAction type="file" filePath="package.json"> <boltAction type="file" filePath="package.json">{
{
"name": "bouncing-ball", "name": "bouncing-ball",
"private": true, "private": true,
"version": "0.0.0", "version": "0.0.0",
@ -171,23 +158,12 @@ npm run dev
"@vitejs/plugin-react": "^3.1.0", "@vitejs/plugin-react": "^3.1.0",
"vite": "^4.2.0" "vite": "^4.2.0"
} }
} }</boltAction>
</boltAction> <boltAction type="file" filePath="index.html">...</boltAction>
<boltAction type="file" filePath="index.html"> <boltAction type="file" filePath="src/main.jsx">...</boltAction>
... <boltAction type="file" filePath="src/index.css">...</boltAction>
</boltAction> <boltAction type="file" filePath="src/App.jsx">...</boltAction>
<boltAction type="file" filePath="src/main.jsx"> <boltAction type="start">npm run dev</boltAction>
...
</boltAction>
<boltAction type="file" filePath="src/index.css">
...
</boltAction>
<boltAction type="file" filePath="src/App.jsx">
...
</boltAction>
<boltAction type="start">
npm run dev
</boltAction>
</boltArtifact> </boltArtifact>
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. 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.

View File

@ -231,17 +231,12 @@ Here are some examples of correct usage of artifacts:
Certainly, I can help you create a JavaScript function to calculate the factorial of a number. Certainly, I can help you create a JavaScript function to calculate the factorial of a number.
<boltArtifact id="factorial-function" title="JavaScript Factorial Function"> <boltArtifact id="factorial-function" title="JavaScript Factorial Function">
<boltAction type="file" filePath="index.js"> <boltAction type="file" filePath="index.js">function factorial(n) {
function factorial(n) { ...
... }
} ...</boltAction>
... <boltAction type="shell">node index.js</boltAction>
</boltAction>
<boltAction type="shell">
node index.js
</boltAction>
</boltArtifact> </boltArtifact>
</assistant_response> </assistant_response>
</example> </example>
@ -253,27 +248,19 @@ Here are some examples of correct usage of artifacts:
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. 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.
<boltArtifact id="snake-game" title="Snake Game in HTML and JavaScript"> <boltArtifact id="snake-game" title="Snake Game in HTML and JavaScript">
<boltAction type="file" filePath="package.json"> <boltAction type="file" filePath="package.json">{
{ "name": "snake",
"name": "snake", "scripts": {
"scripts": { "dev": "vite"
"dev": "vite" }
} ...
... }</boltAction>
}
</boltAction>
<boltAction type="shell"> <boltAction type="shell">npm install --save-dev vite</boltAction>
npm install --save-dev vite
</boltAction>
<boltAction type="file" filePath="index.html"> <boltAction type="file" filePath="index.html">...</boltAction>
...
</boltAction>
<boltAction type="start"> <boltAction type="start">npm run dev</boltAction>
npm run dev
</boltAction>
</boltArtifact> </boltArtifact>
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. 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:
Certainly! I'll create a bouncing ball with real gravity using React. We'll use the react-spring library for physics-based animations. Certainly! I'll create a bouncing ball with real gravity using React. We'll use the react-spring library for physics-based animations.
<boltArtifact id="bouncing-ball-react" title="Bouncing Ball with Gravity in React"> <boltArtifact id="bouncing-ball-react" title="Bouncing Ball with Gravity in React">
<boltAction type="file" filePath="package.json"> <boltAction type="file" filePath="package.json">{
{ "name": "bouncing-ball",
"name": "bouncing-ball", "private": true,
"private": true, "version": "0.0.0",
"version": "0.0.0", "type": "module",
"type": "module", "scripts": {
"scripts": { "dev": "vite",
"dev": "vite", "build": "vite build",
"build": "vite build", "preview": "vite preview"
"preview": "vite preview" },
}, "dependencies": {
"dependencies": { "react": "^18.2.0",
"react": "^18.2.0", "react-dom": "^18.2.0",
"react-dom": "^18.2.0", "react-spring": "^9.7.1"
"react-spring": "^9.7.1" },
}, "devDependencies": {
"devDependencies": { "@types/react": "^18.0.28",
"@types/react": "^18.0.28", "@types/react-dom": "^18.0.11",
"@types/react-dom": "^18.0.11", "@vitejs/plugin-react": "^3.1.0",
"@vitejs/plugin-react": "^3.1.0", "vite": "^4.2.0"
"vite": "^4.2.0" }
} }</boltAction>
}
</boltAction>
<boltAction type="file" filePath="index.html"> <boltAction type="file" filePath="index.html">...</boltAction>
...
</boltAction>
<boltAction type="file" filePath="src/main.jsx"> <boltAction type="file" filePath="src/main.jsx">...</boltAction>
...
</boltAction>
<boltAction type="file" filePath="src/index.css"> <boltAction type="file" filePath="src/index.css">...</boltAction>
...
</boltAction>
<boltAction type="file" filePath="src/App.jsx"> <boltAction type="file" filePath="src/App.jsx">...</boltAction>
...
</boltAction>
<boltAction type="start"> <boltAction type="start">npm run dev</boltAction>
npm run dev
</boltAction>
</boltArtifact> </boltArtifact>
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. 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.