diff --git a/AutoSnap/test-enhanced-flow-ci.js b/AutoSnap/test-enhanced-flow-ci.js index 61e1cef..df39916 100644 --- a/AutoSnap/test-enhanced-flow-ci.js +++ b/AutoSnap/test-enhanced-flow-ci.js @@ -445,6 +445,21 @@ async function navigateToWorklist(page) { } } +/** + * Check if a file path is in the docs folder + * @param {string} filePath - Path to check + * @returns {boolean} True if the file is in the docs folder + */ +function isInDocsFolder(filePath) { + if (!filePath) return false; + + const normalizedPath = filePath.toLowerCase(); + return normalizedPath.startsWith('docs/') || + normalizedPath.startsWith('docs\\') || + normalizedPath.includes('/docs/') || + normalizedPath.includes('\\docs\\'); +} + /** * Detect language from folder path * @param {string} folderPath - Path to the documentation folder @@ -453,17 +468,15 @@ async function navigateToWorklist(page) { function detectLanguageFromFolder(folderPath) { if (!folderPath) return 'English'; - const normalizedPath = folderPath.toLowerCase(); - - // Check if path is in the main docs folder (English) - if (normalizedPath.startsWith('docs/') || - normalizedPath.startsWith('docs\\') || - normalizedPath.includes('/docs/') || - normalizedPath.includes('\\docs\\')) { - console.log(`🔍 Detected English documentation from docs folder: ${folderPath}`); + // IMPORTANT: First check if path is in the main docs folder (English) + // This check must come before any other language pattern checks + if (isInDocsFolder(folderPath)) { + console.log(`✅ DOCS FOLDER DETECTED: ${folderPath} - Setting language to English`); return 'English'; } + const normalizedPath = folderPath.toLowerCase(); + // Common patterns for language folders const languagePatterns = { 'Spanish': ['spanish', 'es', 'docs-es', 'docs-spanish', '/es/', '\\es\\'], @@ -2407,23 +2420,17 @@ if (hasNoDocumentContent) { console.log(`đŸŽ¯ Single file mode: Using specified language from command line: ${languageCodeArg}`); detectedLanguage = languageCodeArg; } else { - // Simple check: if path contains 'docs/', it's English - const normalizedPath = singleFilePath.toLowerCase(); - if (normalizedPath.includes('docs/') || normalizedPath.includes('docs\\')) { - console.log(`🔍 File is in docs folder, setting language to English: ${singleFilePath}`); - detectedLanguage = 'English'; - } else { - detectedLanguage = detectLanguageFromFolder(singleFilePath); - } + // We'll use the detectLanguageFromFolder function which now has proper docs folder detection + console.log(`🔍 Detecting language for file: ${singleFilePath}`); + detectedLanguage = detectLanguageFromFolder(singleFilePath); } // Check if detected language is English (case-insensitive) const isEnglish = detectedLanguage.toLowerCase() === 'english' || detectedLanguage.toLowerCase() === 'en'; // Check if this is ui_change or new_feature mode and file is not from docs folder - const normalizedPath = singleFilePath.toLowerCase(); - // Simple check: if path contains 'docs/', it's in the docs folder - const isDocsFolder = normalizedPath.includes('docs/') || normalizedPath.includes('docs\\'); + // We'll use a function to check if the file is in the docs folder + const isDocsFolder = isInDocsFolder(singleFilePath); console.log(`🔍 Checking if file is from docs folder: ${singleFilePath} - isDocsFolder: ${isDocsFolder}`); @@ -2498,9 +2505,8 @@ if (hasNoDocumentContent) { const nonDocsFiles = processedFileResults.filter(result => { if (!result.filePath) return false; - const normalizedPath = result.filePath.toLowerCase(); - // Simple check: if path contains 'docs/', it's in the docs folder - const isDocsFolder = normalizedPath.includes('docs/') || normalizedPath.includes('docs\\'); + // Use our helper function to check if the file is in the docs folder + const isDocsFolder = isInDocsFolder(result.filePath); console.log(`🔍 Checking if file is from docs folder: ${result.filePath} - isDocsFolder: ${isDocsFolder}`); @@ -2638,7 +2644,7 @@ if (hasNoDocumentContent) { throw new Error('Could not import AIUtilsEnhanced from any location'); } } - const aiUtils = new AIUtilsEnhanced(page); + const aiUtils = new AIUtilsEnhanced(page, { mode }); // Set the current markdown file path for image reference // Priority order: processedFileResults -> processedFiles -> testDocPath -> default diff --git a/AutoSnap/test-enhanced-flow.js b/AutoSnap/test-enhanced-flow.js index 0a94f53..c9c5318 100644 --- a/AutoSnap/test-enhanced-flow.js +++ b/AutoSnap/test-enhanced-flow.js @@ -2593,7 +2593,7 @@ if (hasNoDocumentContent) { throw new Error('Could not import AIUtilsEnhanced from any location'); } } - const aiUtils = new AIUtilsEnhanced(page); + const aiUtils = new AIUtilsEnhanced(page, { mode }); // Set the current markdown file path for image reference // Priority order: processedFileResults -> processedFiles -> testDocPath -> default diff --git a/AutoSnap/tracewrightt/src/ai_utils_enhanced.ts b/AutoSnap/tracewrightt/src/ai_utils_enhanced.ts index d53b453..eb308fc 100644 --- a/AutoSnap/tracewrightt/src/ai_utils_enhanced.ts +++ b/AutoSnap/tracewrightt/src/ai_utils_enhanced.ts @@ -128,8 +128,24 @@ export class AIUtilsEnhanced { if (fileContent && fileContent.length > 0) { console.log(`✅ Path file contains: ${fileContent}`); - // Use the path from the file as the source of truth - const pathFromFile = this.normalizePath(fileContent); + // Check if the file content contains mode information (path|mode format) + let pathFromFile: string; + let mode: string = 'default'; + + if (fileContent.includes('|')) { + const [filePath, modeInfo] = fileContent.split('|'); + pathFromFile = this.normalizePath(filePath); + mode = modeInfo.trim(); + console.log(`📝 Detected mode information: ${mode}`); + // Store mode as an environment variable + process.env.CURRENT_MD_MODE = mode; + // Store mode as a class property for use in other methods + this.currentMode = mode; + } else { + // Legacy format - just the path + pathFromFile = this.normalizePath(fileContent); + } + this.currentMdPath = pathFromFile; console.log(`📝 Using path from file: ${this.currentMdPath}`); @@ -672,15 +688,20 @@ export class AIUtilsEnhanced { let updatedContent = mdContent; let updatesCount = 0; - // First, check for placeholders and replace them if found - console.log(`🔄 Checking for placeholders to replace with image: ${imageName}`); - const placeholderUpdated = this.replacePlaceholderWithImage(updatedContent, imageName); - if (placeholderUpdated.updated) { - console.log(`✅ Successfully replaced ${placeholderUpdated.count} placeholder(s) with image reference`); - updatedContent = placeholderUpdated.content; - updatesCount += placeholderUpdated.count; + // First, check for placeholders and replace them if found - but only in new_feature mode + if (this.currentMode === 'new_feature') { + console.log(`🔍 Mode is new_feature - looking for placeholders to replace`); + console.log(`🔄 Checking for placeholders to replace with image: ${imageName}`); + const placeholderUpdated = this.replacePlaceholderWithImage(updatedContent, imageName); + if (placeholderUpdated.updated) { + console.log(`✅ Successfully replaced ${placeholderUpdated.count} placeholder(s) with image reference`); + updatedContent = placeholderUpdated.content; + updatesCount += placeholderUpdated.count; + } else { + console.log(`â„šī¸ No placeholders were replaced for image: ${imageName}`); + } } else { - console.log(`â„šī¸ No placeholders were replaced for image: ${imageName}`); + console.log(`🔍 Mode is ${this.currentMode || 'default'} - skipping placeholder replacement`); } // Then, update existing image paths in markdown content for this specific image diff --git a/browser_automation_instructions.py b/browser_automation_instructions.py index ca6329c..d0a535a 100644 --- a/browser_automation_instructions.py +++ b/browser_automation_instructions.py @@ -935,22 +935,25 @@ def main(): # Set as environment variable for potential use in instruction generation os.environ['CURRENT_PROCESSING_FILE'] = args.current_file - # Write the current file path to multiple locations to ensure it's found + # Write the current file path and mode to multiple locations to ensure it's found try: + # Include the mode in the file content + file_content = f"{args.current_file}|{scenario_type}" + # Write to the project root root_path_file = 'current_md_path.txt' - print(f"Writing current file path to project root: {root_path_file}") + print(f"Writing current file path and mode to project root: {root_path_file}") with open(root_path_file, 'w', encoding='utf-8') as f: - f.write(args.current_file) + f.write(file_content) # Also write to the AutoSnap directory autosnap_path_file = os.path.join('AutoSnap', 'current_md_path.txt') - print(f"Writing current file path to AutoSnap dir: {autosnap_path_file}") + print(f"Writing current file path and mode to AutoSnap dir: {autosnap_path_file}") os.makedirs(os.path.dirname(autosnap_path_file), exist_ok=True) with open(autosnap_path_file, 'w', encoding='utf-8') as f: - f.write(args.current_file) + f.write(file_content) - print(f"Successfully wrote current file path to text files") + print(f"Successfully wrote current file path and mode ({scenario_type}) to text files") except Exception as e: print(f"ERROR: Failed to write current file path to text file: {e}") diff --git a/docs/6-Image-Viewer/4_MoreOptionsToolbarMenu.md b/docs/6-Image-Viewer/4_MoreOptionsToolbarMenu.md index 3d4ba8f..309c0b4 100644 --- a/docs/6-Image-Viewer/4_MoreOptionsToolbarMenu.md +++ b/docs/6-Image-Viewer/4_MoreOptionsToolbarMenu.md @@ -52,7 +52,7 @@ below features: - **Overlay:** Allows you to overlay different image layers. -![image1](./img/mo3.png) +![image1](img/mo3.png) - **Scout Lines:** Enables you to view scout lines on the image. @@ -104,7 +104,7 @@ Here's a structured layout for the **Calibration Tool** section in the Help Manu This feature links multiple series of images together. It offers two options: -![mo4](./img/mo4.png) +![mo4](img/mo4.png) - **Unlink**: Click to unlink the series. @@ -117,7 +117,7 @@ options: This feature allows you to download the current image or study. It offers two options: -![mo5](./img/mo5.png) +![mo5](img/mo5.png) - **Download Image**: Downloads the currently viewed image. @@ -129,7 +129,7 @@ Allows you to change the settings of the Image Viewer for several categories as well as view the About Image Viewer software details (as seen below). -![mo6-1](./img/mo6-1.png) +![mo6-1](img/mo6-1.png) ### 1. Hanging Protocols @@ -177,17 +177,17 @@ seen below). - **Functionality:** Users can toggle this setting to automatically hide or show the viewport menu for a cleaner workspace. When enabled, the menu remains hidden until the user actively interacts with it. - +![toggle-viewport-menu](img/toggle-viewport-menu.png) **Popout in Window** Allows you to open the current image in a separate window. -![mo7](./img/mo7.png) +![mo7](img/mo7.png) **Fullscreen Mode (Toggle Button)** Allows you to view the image in full screen mode. Clicking the button again will exit full screen mode. -![mo8](./img/mo8.png) +![mo8](img/mo8.png) diff --git a/docs/6-Image-Viewer/img/mo1.png b/docs/6-Image-Viewer/img/mo1.png index 740333d..0877829 100644 Binary files a/docs/6-Image-Viewer/img/mo1.png and b/docs/6-Image-Viewer/img/mo1.png differ diff --git a/docs/6-Image-Viewer/img/mo2.png b/docs/6-Image-Viewer/img/mo2.png index aca6f9a..4ea8786 100644 Binary files a/docs/6-Image-Viewer/img/mo2.png and b/docs/6-Image-Viewer/img/mo2.png differ diff --git a/docs/6-Image-Viewer/img/mo3.png b/docs/6-Image-Viewer/img/mo3.png index 01da453..4f68917 100644 Binary files a/docs/6-Image-Viewer/img/mo3.png and b/docs/6-Image-Viewer/img/mo3.png differ diff --git a/docs/6-Image-Viewer/img/mo4.png b/docs/6-Image-Viewer/img/mo4.png index 3819361..7ba1368 100644 Binary files a/docs/6-Image-Viewer/img/mo4.png and b/docs/6-Image-Viewer/img/mo4.png differ diff --git a/docs/6-Image-Viewer/img/mo5.png b/docs/6-Image-Viewer/img/mo5.png index b4ea089..a1df7f2 100644 Binary files a/docs/6-Image-Viewer/img/mo5.png and b/docs/6-Image-Viewer/img/mo5.png differ diff --git a/docs/6-Image-Viewer/img/mo6-1.png b/docs/6-Image-Viewer/img/mo6-1.png index 370e49c..b5c5ad1 100644 Binary files a/docs/6-Image-Viewer/img/mo6-1.png and b/docs/6-Image-Viewer/img/mo6-1.png differ diff --git a/docs/6-Image-Viewer/img/mo7.png b/docs/6-Image-Viewer/img/mo7.png index 03bf68e..8be85e7 100644 Binary files a/docs/6-Image-Viewer/img/mo7.png and b/docs/6-Image-Viewer/img/mo7.png differ diff --git a/docs/6-Image-Viewer/img/mo8.png b/docs/6-Image-Viewer/img/mo8.png index 54d195e..ae18a7d 100644 Binary files a/docs/6-Image-Viewer/img/mo8.png and b/docs/6-Image-Viewer/img/mo8.png differ diff --git a/docs/6-Image-Viewer/img/toggle-viewport-menu.png b/docs/6-Image-Viewer/img/toggle-viewport-menu.png index 07b4975..55b045f 100644 Binary files a/docs/6-Image-Viewer/img/toggle-viewport-menu.png and b/docs/6-Image-Viewer/img/toggle-viewport-menu.png differ