Created
April 3, 2025 14:51
-
-
Save automenta/f58d5eee2f39a8a87e9d115f6c582ed2 to your computer and use it in GitHub Desktop.
Comparative Synthesizer
This file contains hidden or 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
/* | |
Comparative Synthesizer | |
To use this script, follow the prompts: | |
- Enter your initial prompt | |
- For each variation: | |
- Copy the prompt | |
- Paste into browser | |
- Paste result back into terminal | |
- Answer y/n for more variations | |
- Choose 1 or 2 step synthesis | |
Outputs the formatted comparison/synthesis text that you can copy and use elsewhere. | |
*/ | |
const readline = require('readline'); | |
const rl = readline.createInterface({ | |
input: process.stdin, | |
output: process.stdout | |
}); | |
function askQuestion(question) { | |
return new Promise((resolve) => { | |
rl.question(question, (answer) => { | |
resolve(answer.trim()); | |
}); | |
}); | |
} | |
async function collectVariations() { | |
const variations = []; | |
let prompt; | |
// Step 1: Read initial prompt | |
//prompt = await askQuestion('Please enter your prompt: '); | |
//console.log('Prompt received. For each variation:\n1. Copy the prompt\n2. Paste it in your browser\n3. Paste the result here'); | |
// Step 2 & 3: Collect variations | |
while (true) { | |
console.log('\nReady for next variation...'); | |
const result = await askQuestion('Please paste the result from your browser: '); | |
variations.push(result); | |
const more = await askQuestion('Are there more variations to collect? (y/n): '); | |
if (more.toLowerCase() !== 'y') break; | |
} | |
// Step 4: Ask about synthesis mode | |
const mode = await askQuestion('Should synthesis be in 1 or 2 steps? (1/2): '); | |
// Generate output based on mode | |
if (mode === '1') { | |
// 1-step mode | |
let output = '# Compare and synthesize:\n\n----\n\n'; | |
variations.forEach((variation, index) => { | |
output += `## Variation ${index + 1}\n${variation}\n\n----\n`; | |
}); | |
output += '\n# Synthesize, choosing the best parts of each.'; | |
console.log(output); | |
} else { | |
// 2-step mode (default) | |
let output = '# Compare:\n\n----\n\n'; | |
variations.forEach((variation, index) => { | |
output += `## ${String.fromCharCode(65 + index)}\n${variation}\n\n----\n`; | |
}); | |
output += '\n# Synthesize, choosing the best parts of each.'; | |
console.log(output); | |
} | |
rl.close(); | |
} | |
console.log('Starting variation collection process...'); | |
collectVariations().catch(console.error); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment