diff options
| author | Fuwn <[email protected]> | 2025-09-30 01:43:45 -0700 |
|---|---|---|
| committer | Fuwn <[email protected]> | 2025-09-30 01:43:45 -0700 |
| commit | e45237e44cadc9248f5248554c01e5e256b1a492 (patch) | |
| tree | c51657abc70b808f9d02701777e4e47947ecd2c8 /packages/gateway | |
| parent | fix(gateway:moderationAgent): Update model response handling (diff) | |
| download | umabotdiscord-e45237e44cadc9248f5248554c01e5e256b1a492.tar.xz umabotdiscord-e45237e44cadc9248f5248554c01e5e256b1a492.zip | |
style(gateway:aiModeration): Lint
Diffstat (limited to 'packages/gateway')
| -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]; |