forked from stackblitz/bolt.new
-
Notifications
You must be signed in to change notification settings - Fork 3.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #744 from thecodacus/system-prompt-variations
feat(experimental): Add Configurable System Prompts Feature
- Loading branch information
Showing
13 changed files
with
340 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
{ "commit": "eb1d5417e77e699e0489f09814e87fb5afed9dd5" , "version": "" } | ||
{ "commit": "bb941802094c6186e805f99a6c165431ae86d216" } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
import { getSystemPrompt } from './prompts/prompts'; | ||
import optimized from './prompts/optimized'; | ||
|
||
export interface PromptOptions { | ||
cwd: string; | ||
allowedHtmlElements: string[]; | ||
modificationTagName: 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), | ||
}, | ||
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); | ||
} | ||
} |
Oops, something went wrong.