Compare commits

..

2 Commits

Author SHA1 Message Date
48a45b5447 Fixes 2025-11-06 10:21:44 -08:00
5bd6331ad9 Better greed 2025-11-06 10:21:42 -08:00
2 changed files with 45 additions and 3 deletions

View File

@@ -47,9 +47,27 @@ const AGENTS = {
export default function Playground() {
const [isScriptRunning, setIsScriptRunning] = useState(false);
const [isEditorReady, setIsEditorReady] = useState(false);
const [fontSize, setFontSize] = useState(14);
const [bulkRounds, setBulkRounds] = useState(1000);
const [selectedAgent, setSelectedAgent] = useState("Self");
const [fontSize, setFontSize] = useState(() => {
if (typeof window !== "undefined") {
const saved = localStorage.getItem("playground-fontSize");
return saved ? parseInt(saved, 10) : 14;
}
return 14;
});
const [bulkRounds, setBulkRounds] = useState(() => {
if (typeof window !== "undefined") {
const saved = localStorage.getItem("playground-bulkRounds");
return saved ? parseInt(saved, 10) : 1000;
}
return 1000;
});
const [selectedAgent, setSelectedAgent] = useState(() => {
if (typeof window !== "undefined") {
const saved = localStorage.getItem("playground-selectedAgent");
return saved || "Self";
}
return "Self";
});
const [isHelpOpen, setIsHelpOpen] = useState(false);
const [scriptName, setScriptName] = useState("");
const [saveSecret, setSaveSecret] = useState("");
@@ -122,6 +140,30 @@ export default function Playground() {
loadSavedScripts();
}, [loadSavedScripts]);
// Save font size to localStorage
useEffect(() => {
if (typeof window !== "undefined") {
localStorage.setItem("playground-fontSize", fontSize.toString());
}
}, [fontSize]);
// Save bulk rounds to localStorage
useEffect(() => {
if (typeof window !== "undefined") {
localStorage.setItem(
"playground-bulkRounds",
bulkRounds.toString()
);
}
}, [bulkRounds]);
// Save selected agent to localStorage
useEffect(() => {
if (typeof window !== "undefined") {
localStorage.setItem("playground-selectedAgent", selectedAgent);
}
}, [selectedAgent]);
const runHuman = useCallback(async () => {
if (resultRef.current) {
resultRef.current.value = "";