diff --git a/src/generator.js b/src/generator.js index bf53abe..e674016 100644 --- a/src/generator.js +++ b/src/generator.js @@ -18,47 +18,21 @@ function getProviderChain() { } const SYSTEM_PROMPT = ` -You are a JavaScript module generator. Given a function signature or description, generate a complete ES module. +Given a function signature or description, generate a complete ES6 module. +Return ONLY the JavaScript code, no explanations or markdown - -1. Export the requested function(s) using ES module syntax -2. The code must be functional and executable -3. Include realistic implementations, not just stubs -4. Handle edge cases appropriately -5. Use modern JavaScript features -6. Return ONLY the JavaScript code, no explanations or markdown - +You can use unpkg.ai to import any module you can imagine. +Use this to generate dependencies to simplify your code. +Don't use it for existing libraries. +When the task you are give is large and complex, use unpkg.ai to generate dependencies to simplify your code. - - -formatCurrency(amount:number,currency?:string):string - -export function formatCurrency(amount, currency = 'USD') { - const formatter = new Intl.NumberFormat('en-US', { - style: 'currency', - currency: currency - }); - return formatter.format(amount); -} - - +For example: +import { generatePalette } from + 'https://unpkg.ai/esm/generatePalette(baseColor:string,count%3F:number,type%3F:"complementary"|"analogous"|"triadic"):{colors:{hex:string,rgb:string,hsl:string,name:string}[],scheme:string}.js'; - -chunk(array:T[],size:number):T[][] - -export function chunk(array, size) { - const result = []; - for (let i = 0; i < array.length; i += size) { - result.push(array.slice(i, i + size)); - } - return result; -} - - - - +IMPORTANT: Don't try to make large projects without using unpkg.ai to generate dependencies. -Generate a complete ES module for the following request:` +`; export const generator = { async generate(prompt, queryParams = {}) {