2025-03-25 02:24:12 +00:00
|
|
|
export default function ExamplePanel({
|
|
|
|
|
setInput,
|
|
|
|
|
setFiles,
|
|
|
|
|
}: {
|
|
|
|
|
setInput: (input: string) => void;
|
2025-03-27 08:02:03 +00:00
|
|
|
setFiles: (files: File[]) => void;
|
2025-03-25 02:24:12 +00:00
|
|
|
}) {
|
|
|
|
|
// New handler for the "Replicate this flowchart" button
|
|
|
|
|
const handleReplicateFlowchart = async () => {
|
|
|
|
|
setInput("Replicate this flowchart.");
|
|
|
|
|
|
|
|
|
|
try {
|
|
|
|
|
// Fetch the example image
|
|
|
|
|
const response = await fetch("/example.png");
|
|
|
|
|
const blob = await response.blob();
|
|
|
|
|
const file = new File([blob], "example.png", { type: "image/png" });
|
|
|
|
|
|
|
|
|
|
// Set the file to the files state
|
2025-03-27 08:02:03 +00:00
|
|
|
setFiles([file]);
|
2025-03-25 02:24:12 +00:00
|
|
|
} catch (error) {
|
|
|
|
|
console.error("Error loading example image:", error);
|
|
|
|
|
}
|
|
|
|
|
};
|
2025-11-10 09:13:21 +09:00
|
|
|
|
|
|
|
|
// Handler for the "Replicate this in aws style" button
|
|
|
|
|
const handleReplicateArchitecture = async () => {
|
|
|
|
|
setInput("Replicate this in aws style");
|
|
|
|
|
|
|
|
|
|
try {
|
|
|
|
|
// Fetch the architecture image
|
|
|
|
|
const response = await fetch("/architecture.png");
|
|
|
|
|
const blob = await response.blob();
|
2025-11-10 10:28:37 +09:00
|
|
|
const file = new File([blob], "architecture.png", {
|
|
|
|
|
type: "image/png",
|
|
|
|
|
});
|
2025-11-10 09:13:21 +09:00
|
|
|
|
|
|
|
|
// Set the file to the files state
|
|
|
|
|
setFiles([file]);
|
|
|
|
|
} catch (error) {
|
|
|
|
|
console.error("Error loading architecture image:", error);
|
|
|
|
|
}
|
|
|
|
|
};
|
2025-03-25 02:24:12 +00:00
|
|
|
return (
|
|
|
|
|
<div className="px-4 py-2 border-t border-b border-gray-100">
|
|
|
|
|
<p className="text-sm text-gray-500 mb-2">
|
|
|
|
|
{" "}
|
|
|
|
|
Start a conversation to generate or modify diagrams.
|
|
|
|
|
</p>
|
|
|
|
|
<p className="text-sm text-gray-500 mb-2">
|
|
|
|
|
{" "}
|
|
|
|
|
You can also upload images to use as references.
|
|
|
|
|
</p>
|
2025-12-01 14:07:50 +09:00
|
|
|
<p className="text-sm text-gray-500 mb-2">
|
|
|
|
|
Try these examples{" "}
|
|
|
|
|
<span className="text-xs text-gray-400">(cached for instant response)</span>:
|
|
|
|
|
</p>
|
2025-03-25 02:24:12 +00:00
|
|
|
<div className="flex flex-wrap gap-5">
|
2025-11-17 15:12:16 +09:00
|
|
|
<button
|
|
|
|
|
className="text-xs bg-gray-100 hover:bg-gray-200 text-gray-800 font-medium py-1 px-2 rounded"
|
|
|
|
|
onClick={() => setInput("Give me a **animated connector** diagram of transformer's architecture")}
|
|
|
|
|
>
|
|
|
|
|
Draw diagram with Animated Connectors
|
|
|
|
|
</button>
|
2025-11-10 09:13:21 +09:00
|
|
|
<button
|
|
|
|
|
className="text-xs bg-gray-100 hover:bg-gray-200 text-gray-800 font-medium py-1 px-2 rounded"
|
|
|
|
|
onClick={handleReplicateArchitecture}
|
|
|
|
|
>
|
2025-11-17 15:12:16 +09:00
|
|
|
Create AWS architecture
|
2025-11-10 09:13:21 +09:00
|
|
|
</button>
|
2025-03-25 02:24:12 +00:00
|
|
|
<button
|
|
|
|
|
className="text-xs bg-gray-100 hover:bg-gray-200 text-gray-800 font-medium py-1 px-2 rounded"
|
|
|
|
|
onClick={handleReplicateFlowchart}
|
|
|
|
|
>
|
2025-11-17 15:12:16 +09:00
|
|
|
Replicate flowchart
|
2025-03-25 02:24:12 +00:00
|
|
|
</button>
|
|
|
|
|
<button
|
|
|
|
|
className="text-xs bg-gray-100 hover:bg-gray-200 text-gray-800 font-medium py-1 px-2 rounded"
|
|
|
|
|
onClick={() => setInput("Draw a cat for me")}
|
|
|
|
|
>
|
2025-11-17 15:12:16 +09:00
|
|
|
Draw a cat
|
2025-03-25 02:24:12 +00:00
|
|
|
</button>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
);
|
|
|
|
|
}
|