-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest-prompt.js
More file actions
61 lines (49 loc) · 1.9 KB
/
Copy pathtest-prompt.js
File metadata and controls
61 lines (49 loc) · 1.9 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
#!/usr/bin/env node
/**
* Test the agent with a custom prompt
*/
import { getLLMClient } from "./src/llm/client.js";
import { getConfig } from "./src/config/index.js";
import chalk from "chalk";
async function main() {
const config = getConfig();
if (!config.openrouterApiKey) {
console.log(chalk.red("Error: OPENROUTER_API_KEY not set in .env"));
process.exit(1);
}
const prompt = process.argv.slice(2).join(" ");
if (!prompt) {
console.log(chalk.yellow("Usage: node test-prompt.js <your prompt>"));
console.log(chalk.gray("\nExamples:"));
console.log(chalk.gray(" node test-prompt.js Build me a todo app"));
console.log(chalk.gray(" node test-prompt.js Create a landing page for my coffee shop"));
console.log(chalk.gray(" node test-prompt.js Write a tweet about AI agents"));
process.exit(1);
}
console.log(chalk.cyan("\n🤖 Processing prompt...\n"));
console.log(chalk.gray(`Prompt: "${prompt}"\n`));
const llm = getLLMClient();
try {
const result = await llm.generate({
prompt,
systemPrompt: `You are an elite AI agent. Your task is to deliver outstanding work.
PROJECT BUILDING RULES:
- When asked to build ANYTHING (website, app, tool, game, landing page) - use create_file for each file, then finalize_project
- Create complete, working code - not stubs
- Make it visually appealing and professional
Text Responses:
- For writing, analysis, answers - respond directly with well-crafted text`,
tools: true,
});
console.log(chalk.green("\n✅ Response:\n"));
console.log(result.text);
if (result.projectBuild?.success) {
console.log(chalk.cyan("\n📦 Project built:"));
console.log(chalk.gray(` Files: ${result.projectBuild.files.join(", ")}`));
console.log(chalk.gray(` Zip: ${result.projectBuild.zipPath}`));
}
} catch (error) {
console.log(chalk.red("\n❌ Error:"), error.message);
}
}
main();