diff --git a/backend/src/build-system/handlers/file-manager/file-arch/index.ts b/backend/src/build-system/handlers/file-manager/file-arch/index.ts index f38b74b4..0f4cf450 100644 --- a/backend/src/build-system/handlers/file-manager/file-arch/index.ts +++ b/backend/src/build-system/handlers/file-manager/file-arch/index.ts @@ -80,10 +80,11 @@ export class FileArchGenerateHandler implements BuildHandler { // 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 { diff --git a/backend/src/build-system/handlers/ux/sitemap-document/index.ts b/backend/src/build-system/handlers/ux/sitemap-document/index.ts index a3565f11..8d78b585 100644 --- a/backend/src/build-system/handlers/ux/sitemap-document/index.ts +++ b/backend/src/build-system/handlers/ux/sitemap-document/index.ts @@ -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 { readonly id = 'op:UX:SMD'; @@ -29,7 +22,11 @@ export class UXSMDHandler implements BuildHandler { 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); diff --git a/backend/src/build-system/handlers/ux/sitemap-structure/index.ts b/backend/src/build-system/handlers/ux/sitemap-structure/index.ts index e16c2b15..e9fb04eb 100644 --- a/backend/src/build-system/handlers/ux/sitemap-structure/index.ts +++ b/backend/src/build-system/handlers/ux/sitemap-structure/index.ts @@ -78,7 +78,6 @@ export class UXSitemapStructureHandler implements BuildHandler { ]; try { - const uxStructureContent = await chatSyncWithClocker( context, { diff --git a/backend/src/build-system/handlers/ux/sitemap-structure/sms-page.ts b/backend/src/build-system/handlers/ux/sitemap-structure/sms-page.ts index e9dcc790..5688cd2e 100644 --- a/backend/src/build-system/handlers/ux/sitemap-structure/sms-page.ts +++ b/backend/src/build-system/handlers/ux/sitemap-structure/sms-page.ts @@ -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 @@ -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 tags. `, - }, - { - role: 'user' as const, - content: `Please enrich the details of Core Components in each block. + }, + { + role: 'user' as const, + content: `Please enrich the details of Core Components in each 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...'); @@ -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 diff --git a/backend/src/build-system/utils/file_generator_util.ts b/backend/src/build-system/utils/file_generator_util.ts index f5d0c220..759b8230 100644 --- a/backend/src/build-system/utils/file_generator_util.ts +++ b/backend/src/build-system/utils/file_generator_util.ts @@ -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 {