diff options
Diffstat (limited to 'packages')
| -rw-r--r-- | packages/gateway/src/listeners/moderationAgent/utilities.ts | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/packages/gateway/src/listeners/moderationAgent/utilities.ts b/packages/gateway/src/listeners/moderationAgent/utilities.ts index a5e6aec..0f9e2a8 100644 --- a/packages/gateway/src/listeners/moderationAgent/utilities.ts +++ b/packages/gateway/src/listeners/moderationAgent/utilities.ts @@ -362,7 +362,7 @@ Remember: Only enforce the exact rules provided. Do not make assumptions or inte .replace(/,\s*}/g, "}") .replace(/,\s*]/g, "]") .replace(/(\w+):/g, '"$1":'); - + if (jsonContent.includes("'") && !jsonContent.includes('"')) { jsonContent = jsonContent.replace(/'/g, '"'); } else if (jsonContent.includes("'") && jsonContent.includes('"')) { @@ -376,7 +376,7 @@ Remember: Only enforce the exact rules provided. Do not make assumptions or inte try { let fallbackContent = content; - + if (fallbackContent.includes("```json")) { const match = fallbackContent.match(/```json\s*([\s\S]*?)\s*```/); @@ -386,7 +386,7 @@ Remember: Only enforce the exact rules provided. Do not make assumptions or inte if (match) fallbackContent = match[1].trim(); } - + const jsonMatch = fallbackContent.match(/\{[\s\S]*\}/); if (jsonMatch) fallbackContent = jsonMatch[0]; |