bolt.diy/app/lib/common/prompt-library.ts
KevIsDev 3cafbb6f59 feat(prompts): add fine-tuned prompt and update mobile app instructions
Introduce a new fine-tuned prompt for better results and update mobile app development instructions to ensure comprehensive guidance. The changes include enhanced design guidelines, improved database handling, and clearer artifact creation rules for better project setup.
2025-04-24 10:59:29 +01:00

64 lines
1.6 KiB
TypeScript

import { getSystemPrompt } from './prompts/prompts';
import optimized from './prompts/optimized';
import { getFineTunedPrompt } from './prompts/new-prompt';
export interface PromptOptions {
cwd: string;
allowedHtmlElements: string[];
modificationTagName: string;
supabase?: {
isConnected: boolean;
hasSelectedProject: boolean;
credentials?: {
anonKey?: string;
supabaseUrl?: string;
};
};
}
export class PromptLibrary {
static library: Record<
string,
{
label: string;
description: string;
get: (options: PromptOptions) => string;
}
> = {
default: {
label: 'Default Prompt',
description: 'This is the battle tested default system Prompt',
get: (options) => getSystemPrompt(options.cwd, options.supabase),
},
enhanced: {
label: 'Fine Tuned Prompt',
description: 'An fine tuned prompt for better results',
get: (options) => getFineTunedPrompt(options.cwd, options.supabase),
},
optimized: {
label: 'Optimized Prompt (experimental)',
description: 'an Experimental version of the prompt for lower token usage',
get: (options) => optimized(options),
},
};
static getList() {
return Object.entries(this.library).map(([key, value]) => {
const { label, description } = value;
return {
id: key,
label,
description,
};
});
}
static getPropmtFromLibrary(promptId: string, options: PromptOptions) {
const prompt = this.library[promptId];
if (!prompt) {
throw 'Prompt Now Found';
}
return this.library[promptId]?.get(options);
}
}