()
| 19 | } |
| 20 | |
| 21 | async function loadPrompts() { |
| 22 | const prompts = {} |
| 23 | const promptNames = ['writeStep', 'healStep', 'generatePageObject'] |
| 24 | |
| 25 | for (const name of promptNames) { |
| 26 | let promptPath |
| 27 | |
| 28 | if (store.codeceptDir) { |
| 29 | promptPath = path.join(store.codeceptDir, `prompts/${name}.js`) |
| 30 | } |
| 31 | |
| 32 | if (!promptPath || !fileExists(promptPath)) { |
| 33 | promptPath = path.join(__dirname, `template/prompts/${name}.js`) |
| 34 | } |
| 35 | |
| 36 | try { |
| 37 | const resolvedPath = resolveImportModulePath(promptPath) |
| 38 | const module = await import(resolvedPath) |
| 39 | prompts[name] = module.default || module |
| 40 | debug(`Loaded prompt ${name} from ${promptPath}`) |
| 41 | } catch (err) { |
| 42 | debug(`Failed to load prompt ${name}:`, err.message) |
| 43 | } |
| 44 | } |
| 45 | |
| 46 | return prompts |
| 47 | } |
| 48 | |
| 49 | class AiAssistant { |
| 50 | constructor() { |
no test coverage detected