(content: string)
| 37 | }, [responseText]); |
| 38 | |
| 39 | const formatAgentFile = (content: string) => { |
| 40 | const lines = content.split('\n'); |
| 41 | return ( |
| 42 | <div className="bg-gradient-to-r from-gray-50 to-gray-100 rounded-lg border border-gray-200 shadow-sm overflow-hidden"> |
| 43 | <div className="p-4"> |
| 44 | {lines.map((line, index) => { |
| 45 | const keyValueMatch = line.match(/^([a-z_]+):\s*(.+)$/); |
| 46 | if (keyValueMatch && keyValueMatch.length >= 3) { |
| 47 | const key = keyValueMatch[1]; |
| 48 | const value = keyValueMatch[2]; |
| 49 | return ( |
| 50 | <div key={index} className="flex items-start mb-2"> |
| 51 | <div className="w-48 font-medium text-gray-600">{key}:</div> |
| 52 | <div className="flex-1 text-gray-800">{value}</div> |
| 53 | </div> |
| 54 | ); |
| 55 | } |
| 56 | const sectionMatch = line.match(/^([a-z_]+):\s*\|$/); |
| 57 | if (sectionMatch && sectionMatch.length >= 2) { |
| 58 | const key = sectionMatch[1]; |
| 59 | return ( |
| 60 | <div key={index} className="flex flex-col mb-2 mt-4"> |
| 61 | <div className="w-full font-medium text-gray-600 border-b border-gray-300 pb-1 mb-2">{key}:</div> |
| 62 | </div> |
| 63 | ); |
| 64 | } |
| 65 | if (line.trim() === "") { |
| 66 | return <div key={index} className="h-2"></div>; |
| 67 | } |
| 68 | return ( |
| 69 | <div key={index} className="pl-6 text-gray-700 whitespace-pre-wrap mb-1"> |
| 70 | {line} |
| 71 | </div> |
| 72 | ); |
| 73 | })} |
| 74 | </div> |
| 75 | {isLoading && ( |
| 76 | <div className="bg-gradient-to-r from-blue-50 to-blue-100 h-1 w-full animate-pulse"></div> |
| 77 | )} |
| 78 | </div> |
| 79 | ); |
| 80 | }; |
| 81 | return <div className="agent-response w-full">{formattedResponse}</div>; |
| 82 | }; |
| 83 |
no outgoing calls
no test coverage detected