Skip to content

Commit

Permalink
[autofix.ci] apply automated fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
autofix-ci[bot] authored Jan 17, 2025
1 parent a8a402b commit 9e63a90
Show file tree
Hide file tree
Showing 5 changed files with 40 additions and 37 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -80,10 +80,11 @@ export class FileArchGenerateHandler implements BuildHandler<string> {
// validate with virutual dir
const { graph, nodes, fileInfos } = buildDependencyGraph(jsonData);
if (!validateAgainstVirtualDirectory(nodes, this.virtualDir)) {

this.logger.error('Validate Against Virtual Directory Fail !!!');
throw new ResponseParsingError('Failed to validate against virtualDirectory.');
}
this.logger.error('Validate Against Virtual Directory Fail !!!');
throw new ResponseParsingError(
'Failed to validate against virtualDirectory.',
);
}

this.logger.log('File architecture document generated successfully.');
return {
Expand Down
13 changes: 5 additions & 8 deletions backend/src/build-system/handlers/ux/sitemap-document/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,7 @@ import { BuilderContext } from 'src/build-system/context';
import { prompts } from './prompt';
import { Logger } from '@nestjs/common';
import { removeCodeBlockFences } from 'src/build-system/utils/strings';
import { MessageInterface } from 'src/common/model-provider/types';
import { chatSyncWithClocker } from 'src/build-system/utils/handler-helper';
import {
MissingConfigurationError,
ModelUnavailableError,
ResponseParsingError,
} from 'src/build-system/errors';
import { OpenAIModelProvider } from 'src/common/model-provider/openai-model-provider';

export class UXSMDHandler implements BuildHandler<string> {
readonly id = 'op:UX:SMD';
Expand All @@ -29,7 +22,11 @@ export class UXSMDHandler implements BuildHandler<string> {
const prompt = prompts.generateUxsmdPrompt(projectName, platform);

// Send the prompt to the LLM server and process the response
const uxsmdContent = await this.generateUXSMDFromLLM(context, prompt, prdContent);
const uxsmdContent = await this.generateUXSMDFromLLM(
context,
prompt,
prdContent,
);

// Store the generated document in the context
context.setGlobalContext('uxsmdDocument', uxsmdContent);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,6 @@ export class UXSitemapStructureHandler implements BuildHandler<string> {
];

try {

const uxStructureContent = await chatSyncWithClocker(
context,
{
Expand Down
53 changes: 30 additions & 23 deletions backend/src/build-system/handlers/ux/sitemap-structure/sms-page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,11 @@ import { Logger } from '@nestjs/common';
import { BuilderContext } from 'src/build-system/context';
import { BuildHandler, BuildResult } from 'src/build-system/types';
import { prompts } from './prompt';
import { removeCodeBlockFences } from 'src/build-system/utils/strings';
import { MessageInterface } from 'src/common/model-provider/types';
import { batchChatSyncWithClock } from 'src/build-system/utils/handler-helper';
import {
MissingConfigurationError,
ResponseParsingError,
} from 'src/build-system/errors';
import { OpenAIModelProvider } from 'src/common/model-provider/openai-model-provider';

export class UXSitemapStructurePagebyPageHandler
implements BuildHandler<string>
Expand Down Expand Up @@ -65,33 +62,39 @@ export class UXSitemapStructurePagebyPageHandler

this.logger.log('Processing each Global Component...');

const requests = globalSections.map((globalSection) => ({
model: 'gpt-4o',
messages: [{
role: 'system' as const,
content: globalComponentPrompt,
},
{
role: 'user' as const,
content: `
const requests = globalSections.map((globalSection) => ({
model: 'gpt-4o',
messages: [
{
role: 'system' as const,
content: globalComponentPrompt,
},
{
role: 'user' as const,
content: `
This is the Global Components Section (GCS) of the UX SiteMap Structre (SMS) :
${globalSection}
Please generate the Full UX Sitemap Structre for this section now. Provide the information exclusively within <global_component> tags.
`,
},
{
role: 'user' as const,
content: `Please enrich the details of Core Components in each <global_component> block.
},
{
role: 'user' as const,
content: `Please enrich the details of Core Components in each <global_component> block.
Specifically:
- **Descriptive Component Names**: Include a clear, meaningful name (C#.X. [Component Name]) and explain its purpose on this page.
- **States and Interactions**: Define possible UI states (e.g., Default, Hover, Clicked) and describe typical user interactions (e.g., click, drag, input).
- **Access Restrictions**: Note any conditions (e.g., login required, admin-only) that govern access to the component.`,
},
]
}));
},
],
}));

const refinedGlobalCompSections = await batchChatSyncWithClock(context, 'generate global components', this.id, requests);
const refinedGlobalCompSections = await batchChatSyncWithClock(
context,
'generate global components',
this.id,
requests,
);
refinedSections.push(refinedGlobalCompSections);

this.logger.log('Processing each Page View...');
Expand Down Expand Up @@ -140,11 +143,15 @@ export class UXSitemapStructurePagebyPageHandler
- **Essential Content**: Identify critical information displayed in the component and explain its importance to the user experience.
- **Missing Elements**: Review the structure and add any components, features, or details that may be missing to ensure a complete and robust UX structure.`,
},
]
],
}));


const refinedPageViewSections = await batchChatSyncWithClock(context, 'generate global components', this.id, page_view_requests);
const refinedPageViewSections = await batchChatSyncWithClock(
context,
'generate global components',
this.id,
page_view_requests,
);
refinedSections.push(refinedPageViewSections);

// TODO: deal with chat clocker
Expand Down
1 change: 0 additions & 1 deletion backend/src/build-system/utils/file_generator_util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import * as path from 'path';
import { Logger } from '@nestjs/common';
import { VirtualDirectory } from '../virtual-dir';
import { extractJsonFromMarkdown } from 'src/build-system/utils/strings';
import normalizePath from 'normalize-path';
import toposort from 'toposort';

interface FileDependencyInfo {
Expand Down

0 comments on commit 9e63a90

Please sign in to comment.