This commit is contained in:
Vikhyath Mondreti
2025-07-10 11:47:36 -07:00
parent 209d822ce9
commit 9ede001202
3 changed files with 6 additions and 5 deletions

View File

@@ -1,6 +1,6 @@
import type { ReactElement } from 'react'
import { useEffect, useMemo, useRef, useState } from 'react'
import { Wand2, AlertTriangle } from 'lucide-react'
import { Wand2 } from 'lucide-react'
import { highlight, languages } from 'prismjs'
import 'prismjs/components/prism-javascript'
import 'prismjs/themes/prism.css'
@@ -365,7 +365,7 @@ export function Code({
className={cn(
'group relative min-h-[100px] rounded-md border bg-background font-mono text-sm transition-colors',
isConnecting && 'ring-2 ring-blue-500 ring-offset-2',
!isValidJson && 'border-destructive border-2 bg-destructive/10'
!isValidJson && 'border-2 border-destructive bg-destructive/10'
)}
title={!isValidJson ? 'Invalid JSON' : undefined}
onDragOver={(e) => e.preventDefault()}

View File

@@ -1,5 +1,5 @@
import { useState } from 'react'
import { Info, AlertTriangle } from 'lucide-react'
import { AlertTriangle, Info } from 'lucide-react'
import { Label } from '@/components/ui/label'
import { Tooltip, TooltipContent, TooltipTrigger } from '@/components/ui/tooltip'
import { getBlock } from '@/blocks/index'

View File

@@ -718,13 +718,14 @@ export class AgentBlockHandler implements BlockHandler {
// All parsing attempts failed
logger.error('Failed to parse response content as JSON:', {
content: content.substring(0, 200) + (content.length > 200 ? '...' : ''),
responseFormat: responseFormat
responseFormat: responseFormat,
})
// Return standard response but include a warning
const standardResponse = this.processStandardResponse(result)
return Object.assign(standardResponse, {
_responseFormatWarning: 'Response format was specified but content could not be parsed as JSON. Falling back to standard format.',
_responseFormatWarning:
'Response format was specified but content could not be parsed as JSON. Falling back to standard format.',
})
}