import { useState } from "react"; import { post } from "../api"; import { useT } from "../i18n"; import { toast } from "../dialogs"; import { Icon } from "./Icon"; import { ModelSelect } from "./ModelSelect"; export const EFFORTS = ["low", "medium", "high", "max"] as const; /** Effort choice for one turn ("" = the model's default). */ export function EffortSelect({ value, onChange, compact }: { value: string; onChange: (v: string) => void; compact?: boolean }) { const t = useT(); return ( ); } /** Redo the last turn, optionally with another model and effort. */ export function RegenerateButton({ sessionId, messageId, model }: { sessionId: string; messageId: string; model: string }) { const t = useT(); const [open, setOpen] = useState(false); const [m, setM] = useState(model); const [effort, setEffort] = useState(""); const [busy, setBusy] = useState(false); const go = async () => { setBusy(true); try { await post(`/sessions/${sessionId}/regenerate`, { message_id: messageId, model: m !== model ? m : undefined, effort: effort || undefined }); setOpen(false); } catch (e: any) { toast(e.message); } finally { setBusy(false); } }; return (