We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent daae72b commit a85ba33Copy full SHA for a85ba33
backend/src/entities/visualizations/panel-position/use-cases/generate-panel-position-with-ai.use.case.ts
@@ -345,16 +345,11 @@ IMPORTANT:
345
}
346
347
private cleanQueryResponse(aiResponse: string): string {
348
- let cleaned = aiResponse.trim();
349
- if (cleaned.startsWith('```sql')) {
350
- cleaned = cleaned.slice(6);
351
- } else if (cleaned.startsWith('```')) {
352
- cleaned = cleaned.slice(3);
353
- }
354
- if (cleaned.endsWith('```')) {
355
- cleaned = cleaned.slice(0, -3);
356
357
- return cleaned.trim();
+ return aiResponse
+ .trim()
+ .replace(/^```[a-zA-Z]*\n?/, '')
+ .replace(/```\s*$/, '')
+ .trim();
358
359
360
private normalizeWhitespace(query: string): string {
0 commit comments