({
setInput,
setFiles,
}: {
setInput: (input: string) => void
setFiles: (files: File[]) => void
})
| 57 | } |
| 58 | |
| 59 | export default function ExamplePanel({ |
| 60 | setInput, |
| 61 | setFiles, |
| 62 | }: { |
| 63 | setInput: (input: string) => void |
| 64 | setFiles: (files: File[]) => void |
| 65 | }) { |
| 66 | const handleReplicateFlowchart = async () => { |
| 67 | setInput("Replicate this flowchart.") |
| 68 | |
| 69 | try { |
| 70 | const response = await fetch("/example.png") |
| 71 | const blob = await response.blob() |
| 72 | const file = new File([blob], "example.png", { type: "image/png" }) |
| 73 | setFiles([file]) |
| 74 | } catch (error) { |
| 75 | console.error("Error loading example image:", error) |
| 76 | } |
| 77 | } |
| 78 | |
| 79 | const handleReplicateArchitecture = async () => { |
| 80 | setInput("Replicate this in aws style") |
| 81 | |
| 82 | try { |
| 83 | const response = await fetch("/architecture.png") |
| 84 | const blob = await response.blob() |
| 85 | const file = new File([blob], "architecture.png", { |
| 86 | type: "image/png", |
| 87 | }) |
| 88 | setFiles([file]) |
| 89 | } catch (error) { |
| 90 | console.error("Error loading architecture image:", error) |
| 91 | } |
| 92 | } |
| 93 | |
| 94 | const handlePdfExample = async () => { |
| 95 | setInput("Summarize this paper as a diagram") |
| 96 | |
| 97 | try { |
| 98 | const response = await fetch("/chain-of-thought.txt") |
| 99 | const blob = await response.blob() |
| 100 | const file = new File([blob], "chain-of-thought.txt", { |
| 101 | type: "text/plain", |
| 102 | }) |
| 103 | setFiles([file]) |
| 104 | } catch (error) { |
| 105 | console.error("Error loading text file:", error) |
| 106 | } |
| 107 | } |
| 108 | |
| 109 | return ( |
| 110 | <div className="py-6 px-2 animate-fade-in"> |
| 111 | {/* Welcome section */} |
| 112 | <div className="text-center mb-6"> |
| 113 | <h2 className="text-lg font-semibold text-foreground mb-2"> |
| 114 | Create diagrams with AI |
| 115 | </h2> |
| 116 | <p className="text-sm text-muted-foreground max-w-xs mx-auto"> |
nothing calls this directly
no outgoing calls
no test coverage detected