(text: string)
| 49 | * @returns An array of content inside $$$ blocks, or empty array if none found. |
| 50 | */ |
| 51 | export function extractMultipleAgentConfigs(text: string): string[] { |
| 52 | const agentBlockRegex = /\$\$\$\s*\n?([\s\S]*?)\n?\$\$\$/g; |
| 53 | const matches = Array.from(text.matchAll(agentBlockRegex)); |
| 54 | return matches.map(match => match[1] ? match[1].trim() : '').filter(config => config.length > 0); |
| 55 | } |
| 56 | |
| 57 | /** |
| 58 | * Extracts the image request text from a string. |