Back

Version 102

11/23/2024
/** @jsxImportSource https://esm.sh/react */
import { MicrophoneIcon, MoonIcon, StopIcon, SunIcon, XCircleIcon } from "https://esm.sh/@heroicons/react/24/solid";
import React, { useEffect, useRef, useState } from "https://esm.sh/react";
import { createRoot } from "https://esm.sh/react-dom/client";

function App() {
const [notification, setNotification] = useState({ type: "success", message: "" });

const [question, setQuestion] = useState("");
const [response, setResponse] = useState("");
const [isLoading, setIsLoading] = useState(false);
const [copyStatus, setCopyStatus] = useState("");
const [isDarkMode, setIsDarkMode] = useState(() => {
const savedTheme = localStorage.getItem("theme");
if (savedTheme) return savedTheme === "dark";
return window.matchMedia("(prefers-color-scheme: dark)").matches;
});
const [isListening, setIsListening] = useState(false);
const recognitionRef = useRef<any>(null);

useEffect(() => {
const savedTheme = localStorage.getItem("theme");
if (savedTheme === "dark") {
setIsDarkMode(true);
document.documentElement.classList.add("dark");
} else {
setIsDarkMode(false);
document.documentElement.classList.remove("dark");
}

// Initialize speech recognition
const SpeechRecognition = (window as any).SpeechRecognition
|| (window as any).webkitSpeechRecognition
|| (window as any).mozSpeechRecognition
|| (window as any).msSpeechRecognition;

spinningideas-reflective_qa.web.val.run
Updated: December 14, 2024