MCPcopy Create free account
hub / github.com/CodeFox-Repo/codefox / PromptToolService

Class PromptToolService

backend/src/prompt-tool/prompt-tool.service.ts:6–68  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

4
5@Injectable()
6export class PromptToolService {
7 private readonly logger = new Logger(PromptToolService.name);
8
9 async regenerateDescription(description: string): Promise<string> {
10 try {
11 const result = await generateText({
12 model: openrouter(DEFAULT_MODEL),
13 // The prompt asks for 300-500 words; reserving the model's whole
14 // output window instead gets the request rejected on a small balance.
15 maxOutputTokens: 2048,
16 // ai@7 rejects role:'system' inside `messages` (allowSystemInMessages
17 // defaults to false) — it throws before any request is made.
18 instructions: `You help users transform brief project descriptions into comprehensive, well-structured requests that provide clear guidance for implementation.
19
20Format requirements:
211. Begin with "Please create a..." or similar phrasing that clearly states the project goal
222. Structure the response with clearly defined sections using double asterisks for bold headers (e.g., **Page Structure & Layout**, **Color & Theme**)
233. Include 5-7 detailed sections that cover relevant aspects of the project
244. For each section, provide 3-5 specific requirements or suggestions
255. Use professional, detailed language while maintaining a conversational tone
266. Ensure the entire description remains coherent and focused on the original project idea
277. Include specific technical details where appropriate
288. End with a clear call to action or summary statement
299. Total length should be approximately 300-500 words
3010. Do NOT use markdown syntax, just plain text with double asterisks for section headers
3111. Return the text exactly as it should appear to the end user, with no additional formatting
32
33Example:
34Input: "create a business card website"
35Output: "**Please create a personal 'business card' style website** that showcases my professional identity and work portfolio effectively. The site should function as my digital presence with a clean, modern aesthetic.
36
37**Page Structure & Layout**
38Feature a striking hero section with my name/logo prominently displayed, followed by a concise tagline that captures my professional essence. Implement a minimalist navigation system with smooth scrolling to different sections. Create distinct areas for my bio, skills/services, portfolio highlights, and contact information.
39
40**Color & Theme**
41Utilize a professional color scheme with 2-3 primary colors that reflect my industry and personal brand. Incorporate subtle background textures or patterns that add visual interest without overwhelming the content. Maintain consistent styling elements throughout to create a cohesive experience.
42
43**Content Components**
44Include a brief but compelling personal bio that highlights my expertise and unique value proposition. Feature 3-5 of my best work examples with brief descriptions. Add testimonials or endorsements if available. Present my skills or services using visually appealing icons or graphics.
45
46**Technical Requirements**
47Ensure the site is fully responsive across all device sizes with optimized images and assets. Implement subtle animations or transitions that enhance the user experience without feeling excessive. Add SEO-friendly metadata and structure to improve discoverability.
48
49**Interactive Elements**
50Include easy-to-find contact options with a simple form or direct email link. Add social media integration with recognizable icons. Consider implementing a downloadable resume/CV option or digital business card feature.
51
52Please compile this into a clean, professional website that effectively represents my personal brand while making it easy for potential clients or employers to understand my value and get in touch."`,
53 prompt: description,
54 });
55
56 this.logger.debug('Enhanced description generated');
57 return result.text;
58 } catch (error) {
59 this.logger.error(
60 `Error generating enhanced description: ${error.message}`,
61 );
62 throw new Error('Failed to enhance project description');
63 }

Callers

nothing calls this directly

Calls 1

getInstanceMethod · 0.45

Tested by

no test coverage detected