Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/main'
Browse files Browse the repository at this point in the history
actions-user committed Jan 22, 2025
2 parents 958c8a5 + 46f15bd commit 5044e8b
Showing 5 changed files with 71 additions and 124 deletions.
6 changes: 3 additions & 3 deletions app/components/chat/Chat.client.tsx
Original file line number Diff line number Diff line change
@@ -274,7 +274,7 @@ export const ChatImpl = memo(

runAnimation();

if (!chatStarted && messageInput && autoSelectTemplate) {
if (!chatStarted && _input && autoSelectTemplate) {
setFakeLoading(true);
setMessages([
{
@@ -296,7 +296,7 @@ export const ChatImpl = memo(
// reload();

const { template, title } = await selectStarterTemplate({
message: messageInput,
message: _input,
model,
provider,
});
@@ -319,7 +319,7 @@ export const ChatImpl = memo(
{
id: `${new Date().getTime()}`,
role: 'user',
content: messageInput,
content: _input,

// annotations: ['hidden'],
},
9 changes: 2 additions & 7 deletions app/lib/.server/llm/stream-text.ts
Original file line number Diff line number Diff line change
@@ -96,15 +96,10 @@ function createFilesContext(files: FileMap) {
return '';
}

const codeWithLinesNumbers = dirent.content
.split('\n')
.map((v, i) => `${i + 1}|${v}`)
.join('\n');

return `<file path="${path}">\n${codeWithLinesNumbers}\n</file>`;
return `<file path="${path}">\n${dirent.content}\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 } {
54 changes: 15 additions & 39 deletions app/lib/common/prompts/optimized.ts
Original file line number Diff line number Diff line change
@@ -99,16 +99,12 @@ Examples:
Certainly, I can help you create a JavaScript function to calculate the factorial of a number.
<boltArtifact id="factorial-function" title="JavaScript Factorial Function">
<boltAction type="file" filePath="index.js">
function factorial(n) {
<boltAction type="file" filePath="index.js">function factorial(n) {
...
}
...
</boltAction>
<boltAction type="shell">
node index.js
</boltAction>
...</boltAction>
<boltAction type="shell">node index.js</boltAction>
</boltArtifact>
</assistant_response>
</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.
<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",
"scripts": {
"dev": "vite"
}
...
}
</boltAction>
<boltAction type="shell">
npm install --save-dev vite
</boltAction>
<boltAction type="file" filePath="index.html">
...
</boltAction>
<boltAction type="start">
npm run dev
</boltAction>
}</boltAction>
<boltAction type="shell">npm install --save-dev vite</boltAction>
<boltAction type="file" filePath="index.html">...</boltAction>
<boltAction type="start">npm run dev</boltAction>
</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.
@@ -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.
<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",
"private": true,
"version": "0.0.0",
@@ -171,23 +158,12 @@ npm run dev
"@vitejs/plugin-react": "^3.1.0",
"vite": "^4.2.0"
}
}
</boltAction>
<boltAction type="file" filePath="index.html">
...
</boltAction>
<boltAction type="file" filePath="src/main.jsx">
...
</boltAction>
<boltAction type="file" filePath="src/index.css">
...
</boltAction>
<boltAction type="file" filePath="src/App.jsx">
...
</boltAction>
<boltAction type="start">
npm run dev
</boltAction>
}</boltAction>
<boltAction type="file" filePath="index.html">...</boltAction>
<boltAction type="file" filePath="src/main.jsx">...</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>
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.
125 changes: 50 additions & 75 deletions app/lib/common/prompts/prompts.ts
Original file line number Diff line number Diff line change
@@ -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.
<boltArtifact id="factorial-function" title="JavaScript Factorial Function">
<boltAction type="file" filePath="index.js">
function factorial(n) {
...
}
<boltAction type="file" filePath="index.js">function factorial(n) {
...
}
...</boltAction>
...
</boltAction>
<boltAction type="shell">
node index.js
</boltAction>
<boltAction type="shell">node index.js</boltAction>
</boltArtifact>
</assistant_response>
</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.
<boltArtifact id="snake-game" title="Snake Game in HTML and JavaScript">
<boltAction type="file" filePath="package.json">
{
"name": "snake",
"scripts": {
"dev": "vite"
}
...
}
</boltAction>
<boltAction type="shell">
npm install --save-dev vite
</boltAction>
<boltAction type="file" filePath="index.html">
...
</boltAction>
<boltAction type="start">
npm run dev
</boltAction>
<boltAction type="file" filePath="package.json">{
"name": "snake",
"scripts": {
"dev": "vite"
}
...
}</boltAction>
<boltAction type="shell">npm install --save-dev vite</boltAction>
<boltAction type="file" filePath="index.html">...</boltAction>
<boltAction type="start">npm run dev</boltAction>
</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.
@@ -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.
<boltArtifact id="bouncing-ball-react" title="Bouncing Ball with Gravity in React">
<boltAction type="file" filePath="package.json">
{
"name": "bouncing-ball",
"private": true,
"version": "0.0.0",
"type": "module",
"scripts": {
"dev": "vite",
"build": "vite build",
"preview": "vite preview"
},
"dependencies": {
"react": "^18.2.0",
"react-dom": "^18.2.0",
"react-spring": "^9.7.1"
},
"devDependencies": {
"@types/react": "^18.0.28",
"@types/react-dom": "^18.0.11",
"@vitejs/plugin-react": "^3.1.0",
"vite": "^4.2.0"
}
}
</boltAction>
<boltAction type="file" filePath="index.html">
...
</boltAction>
<boltAction type="file" filePath="src/main.jsx">
...
</boltAction>
<boltAction type="file" filePath="src/index.css">
...
</boltAction>
<boltAction type="file" filePath="src/App.jsx">
...
</boltAction>
<boltAction type="start">
npm run dev
</boltAction>
<boltAction type="file" filePath="package.json">{
"name": "bouncing-ball",
"private": true,
"version": "0.0.0",
"type": "module",
"scripts": {
"dev": "vite",
"build": "vite build",
"preview": "vite preview"
},
"dependencies": {
"react": "^18.2.0",
"react-dom": "^18.2.0",
"react-spring": "^9.7.1"
},
"devDependencies": {
"@types/react": "^18.0.28",
"@types/react-dom": "^18.0.11",
"@vitejs/plugin-react": "^3.1.0",
"vite": "^4.2.0"
}
}</boltAction>
<boltAction type="file" filePath="index.html">...</boltAction>
<boltAction type="file" filePath="src/main.jsx">...</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>
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.
1 change: 1 addition & 0 deletions app/lib/modules/llm/providers/deepseek.ts
Original file line number Diff line number Diff line change
@@ -15,6 +15,7 @@ export default class DeepseekProvider extends BaseProvider {
staticModels: ModelInfo[] = [
{ name: 'deepseek-coder', label: 'Deepseek-Coder', provider: 'Deepseek', maxTokenAllowed: 8000 },
{ name: 'deepseek-chat', label: 'Deepseek-Chat', provider: 'Deepseek', maxTokenAllowed: 8000 },
{ name: 'deepseek-reasoner', label: 'Deepseek-Reasoner', provider: 'Deepseek', maxTokenAllowed: 8000 },
];

getModelInstance(options: {

0 comments on commit 5044e8b

Please sign in to comment.