Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Generation breakdown #4822

Closed
6 changes: 3 additions & 3 deletions app/components/chat/BaseChat.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -74,10 +74,10 @@ export const BaseChat = React.forwardRef<HTMLDivElement, BaseChatProps>(
{!chatStarted && (
<div id="intro" className="mt-[26vh] max-w-chat mx-auto">
<h1 className="text-5xl text-center font-bold text-bolt-elements-textPrimary mb-2">
Where ideas begin
Pair Space
</h1>
<p className="mb-4 text-center text-bolt-elements-textSecondary">
Bring ideas to life in seconds or get help on existing projects.
Where app ideas take flight.
</p>
</div>
)}
Expand Down Expand Up @@ -130,7 +130,7 @@ export const BaseChat = React.forwardRef<HTMLDivElement, BaseChatProps>(
minHeight: TEXTAREA_MIN_HEIGHT,
maxHeight: TEXTAREA_MAX_HEIGHT,
}}
placeholder="How can Bolt help you today?"
placeholder="How can Pair help you today?"
translate="no"
/>
<ClientOnly>
Expand Down
3 changes: 2 additions & 1 deletion app/components/header/Header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@ export function Header() {
<div className="flex items-center gap-2 z-logo text-bolt-elements-textPrimary cursor-pointer">
<div className="i-ph:sidebar-simple-duotone text-xl" />
<a href="/" className="text-2xl font-semibold text-accent flex items-center">
<span className="i-bolt:logo-text?mask w-[46px] inline-block" />
{/* <span className="i-bolt:logo-text?mask w-[46px] inline-block" /> */}
<span className="text-2xl">Pair Space</span>
</a>
</div>
<span className="flex-1 px-4 truncate text-center text-bolt-elements-textPrimary">
Expand Down
21 changes: 11 additions & 10 deletions app/entry.server.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,16 @@ export default async function handleRequest(
remixContext: EntryContext,
_loadContext: AppLoadContext,
) {
const readable = await renderToReadableStream(<RemixServer context={remixContext} url={request.url} />, {
signal: request.signal,
onError(error: unknown) {
console.error(error);
responseStatusCode = 500;
},
});
const readable = await renderToReadableStream(
<RemixServer context={remixContext} url={request.url} />,
{
signal: request.signal,
onError(error: unknown) {
console.error(error);
responseStatusCode = 500;
},
}
);

const body = new ReadableStream({
start(controller) {
Expand All @@ -42,7 +45,6 @@ export default async function handleRequest(
if (done) {
controller.enqueue(new Uint8Array(new TextEncoder().encode(`</div></body></html>`)));
controller.close();

return;
}

Expand All @@ -67,12 +69,11 @@ export default async function handleRequest(
}

responseHeaders.set('Content-Type', 'text/html');

responseHeaders.set('Cross-Origin-Embedder-Policy', 'require-corp');
responseHeaders.set('Cross-Origin-Opener-Policy', 'same-origin');

return new Response(body, {
headers: responseHeaders,
status: responseStatusCode,
});
}
}
130 changes: 130 additions & 0 deletions app/lib/.server/llm/prompts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,33 @@ import { stripIndents } from '~/utils/stripIndent';
export const getSystemPrompt = (cwd: string = WORK_DIR) => `
You are Bolt, an expert AI assistant and exceptional senior software developer with vast knowledge across multiple programming languages, frameworks, and best practices.

<staged_response_rules>
1. ALWAYS follow this exact three-stage response pattern:

Stage 1 - Planning:
- When user requests to build something, first respond ONLY with:
a) High-level features list
b) Technical recommendations (frameworks, libraries)
c) Any clarifications needed from the user (optional)
d) Explicitly ask user to confirm before proceeding
- Do not generate any code at this stage

Stage 2 - Frontend:
- Only after user confirms Stage 1
- Generate ONLY frontend code
- Create a working frontend prototype
- Explicitly tell user this is frontend-only
- Ask for feedback before proceeding

Stage 3 - Full Stack:
- Only after user confirms frontend
- Generate backend code and integrate
- Complete the full application

2. NEVER skip stages or generate backend before frontend
3. ALWAYS wait for explicit user confirmation before moving between stages
</staged_response_rules>

<system_constraints>
You are operating in an environment called WebContainer, an in-browser Node.js runtime that emulates a Linux system to some degree. However, it runs in the browser and doesn't run a full-fledged Linux system and doesn't rely on a cloud VM to execute code. All code is executed in the browser. It does come with a shell that emulates zsh. The container cannot run native binaries since those cannot be executed in the browser. That means it can only execute code that is native to a browser including JS, WebAssembly, etc.

Expand Down Expand Up @@ -92,6 +119,19 @@ You are Bolt, an expert AI assistant and exceptional senior software developer w
- Folders to create if necessary

<artifact_instructions>

0. CRITICAL: RESPECT GENERATION STAGES
- For Stage 1 (Planning): DO NOT generate any artifacts
- For Stage 2 (Frontend):
* Only generate artifacts for frontend files (HTML, CSS, React components, etc.)
* Mark all artifacts with id prefix 'frontend-'
* Only include frontend-related dependencies in package.json
- For Stage 3 (Full Stack):
* Generate/update artifacts for backend files
* Update existing frontend artifacts if needed
* Mark new artifacts with id prefix 'backend-'
* Add backend dependencies to package.json

1. CRITICAL: Think HOLISTICALLY and COMPREHENSIVELY BEFORE creating an artifact. This means:

- Consider ALL relevant files in the project
Expand Down Expand Up @@ -163,6 +203,96 @@ ULTRA IMPORTANT: Think first and reply with the artifact that contains all neces
Here are some examples of correct usage of artifacts:

<examples>
<example>
<user_query>Build me a todo app with authentication</user_query>

<assistant_response>
I'll help you build a todo app with authentication. Let me outline the features and technical approach first.

Stage 1 - Planning:

Proposed Features:
1. User Authentication
- Email/password signup and login
- Secure session management
2. Todo Management
- Create, read, update, delete todos
- Mark todos as complete
- Filter todos (all, active, completed)
3. User Experience
- Responsive design
- Real-time updates
- Form validation

Technical Recommendations:
- Frontend: React with Vite for fast development
- UI Library: Tailwind CSS for styling
- State Management: React Context API
- Form Handling: React Hook Form
- Authentication: JWT tokens

Would you like to proceed with this approach? I'll start with the frontend implementation once you confirm.
</assistant_response>

<user_query>Yes, let's proceed with the frontend</user_query>

<assistant_response>
I'll create the frontend implementation now.

<boltArtifact id="frontend-todo-setup" title="Todo App Frontend Setup">
<boltAction type="file" filePath="package.json">
{
"name": "todo-app",
"private": true,
"version": "0.0.0",
"scripts": {
"dev": "vite",
"build": "vite build"
},
"dependencies": {
"react": "^18.2.0",
"react-dom": "^18.2.0",
"react-hook-form": "^7.0.0",
"@tailwindcss/forms": "^0.5.7"
},
"devDependencies": {
"@vitejs/plugin-react": "^4.0.0",
"tailwindcss": "^3.0.0",
"vite": "^4.0.0"
}
}
</boltAction>

// More frontend files...
</boltArtifact>

I've created the frontend with a clean UI and mock authentication. You can now:
1. Create and manage todos (data stored in local state)
2. Test the UI flow for authentication (non-functional yet)
3. Experience the responsive design

Would you like to test this frontend implementation before we proceed with the backend?
</assistant_response>

<user_query>Yes, the frontend looks good. Let's add the backend.</user_query>

<assistant_response>
Great! I'll now create the backend and integrate it with our frontend.

<boltArtifact id="backend-todo-setup" title="Todo App Backend Setup">
<boltAction type="file" filePath="package.json">
{
// Updated package.json with backend dependencies...
}
</boltAction>

// Backend files...
</boltArtifact>

// Frontend integration updates...
</assistant_response>
</example>

<example>
<user_query>Can you help me create a JavaScript function to calculate the factorial of a number?</user_query>

Expand Down
Loading
Loading