Back
Version 2
11/28/2024
/** @jsxImportSource https://esm.sh/react */
import Cerebras from "https://esm.sh/@cerebras/cerebras_cloud_sdk";
import React, { useState, useRef } from "https://esm.sh/react";
import { createRoot } from "https://esm.sh/react-dom/client";
import { Prism as SyntaxHighlighter } from "https://esm.sh/react-syntax-highlighter";
import { tomorrow } from "https://esm.sh/react-syntax-highlighter/dist/esm/styles/prism";
function App() {
const [prompt, setPrompt] = useState("hello llamapalooza");
const [code, setCode] = useState("");
const [loading, setLoading] = useState(false);
const [performance, setPerformance] = useState<
{
tokensPerSecond: number;
totalTokens: number;
time: number;
} | null
>(null);
// Updated state to include a unique ID
const [promptHistory, setPromptHistory] = useState<{
id: string;
prompt: string;
code: string;
performance: {
tokensPerSecond: number;
totalTokens: number;
time: number;
} | null;
timestamp: number;
}[]>([]);
async function handleSubmit(e: React.FormEvent) {
e.preventDefault();
setLoading(true);
caseyg-cerebras_coder.web.val.run
Updated: November 28, 2024