Skip to content

Commit e5cc2ed

Browse files
committed
update ux sitemap
1 parent 580f27d commit e5cc2ed

File tree

2 files changed

+30
-15
lines changed

2 files changed

+30
-15
lines changed

backend/src/build-system/handlers/ux/sitemap-document/prompt.ts

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,9 @@
11
// Define and export the system prompts object
22
export const prompts = {
3-
generateUxsmdrompt: (
4-
projectName: string,
5-
prdDocument: string,
6-
platform: string,
7-
): string => {
8-
return `You are an expert frontend develper and ux designer. Your job is to analyze and expand upon the details provided, generating a Full UX Sitemap Document based on the following inputs:
3+
generateUxsmdrompt: (projectName: string, platform: string): string => {
4+
return `You are an expert frontend develper and ux designer. Your job is to analyze and expand upon the details provided, generating a Full UX Sitemap Document based on the following inputs provide later:
95
- Project name: ${projectName}
10-
- product requirements document: ${prdDocument}
6+
- product requirements document: {}
117
- Platform: ${platform}
128
139
Follow these rules as a guide to ensure clarity and completeness in your UX Sitemap Document.

backend/src/build-system/handlers/ux/sitemap-document/uxsmd.ts

Lines changed: 27 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import { prompts } from './prompt';
44
import { ModelProvider } from 'src/common/model-provider';
55
import { Logger } from '@nestjs/common';
66
import { removeCodeBlockFences } from 'src/build-system/utils/strings';
7+
import { MessageInterface } from 'src/common/model-provider/types';
78

89
export class UXSMDHandler implements BuildHandler<string> {
910
readonly id = 'op:UX:SMD';
@@ -19,14 +20,10 @@ export class UXSMDHandler implements BuildHandler<string> {
1920
const prdContent = context.getNodeData('op:PRD');
2021

2122
// Generate the prompt dynamically
22-
const prompt = prompts.generateUxsmdrompt(
23-
projectName,
24-
prdContent,
25-
platform,
26-
);
23+
const prompt = prompts.generateUxsmdrompt(projectName, platform);
2724

2825
// Send the prompt to the LLM server and process the response
29-
const uxsmdContent = await this.generateUXSMDFromLLM(prompt);
26+
const uxsmdContent = await this.generateUXSMDFromLLM(prompt, prdContent);
3027

3128
// Store the generated document in the context
3229
context.setGlobalContext('uxsmdDocument', uxsmdContent);
@@ -38,13 +35,35 @@ export class UXSMDHandler implements BuildHandler<string> {
3835
};
3936
}
4037

41-
private async generateUXSMDFromLLM(prompt: string): Promise<string> {
38+
private async generateUXSMDFromLLM(
39+
prompt: string,
40+
prdContent: string,
41+
): Promise<string> {
42+
const messages: MessageInterface[] = [
43+
{
44+
role: 'system',
45+
content: prompt,
46+
},
47+
{
48+
role: 'user',
49+
content: `This is the product requiremnt ${prdContent}`,
50+
},
51+
{
52+
role: 'assistant',
53+
content: 'Here is the initial UX Sitemap Document...',
54+
},
55+
{
56+
role: 'user',
57+
content: 'Add more detail about user flows.',
58+
},
59+
];
60+
4261
const modelProvider = ModelProvider.getInstance();
4362
const model = 'gpt-4o-mini';
4463

4564
const uxsmdContent = await modelProvider.chatSync({
4665
model,
47-
messages: [{ content: prompt, role: 'system' }],
66+
messages,
4867
});
4968

5069
this.logger.log('Received full UXSMD content from LLM server.');

0 commit comments

Comments
 (0)