import { useState } from "react"; import { patch } from "../api"; import { useT } from "../i18n"; /** Instructions for one chat: added to the system prompt of every turn. */ export function InstructionsDialog({ sessionId, value, onClose }: { sessionId: string; value: string; onClose: () => void }) { const t = useT(); const [text, setText] = useState(value); const [busy, setBusy] = useState(false); const [error, setError] = useState(); const save = async (next: string) => { setBusy(true); try { await patch(`/sessions/${sessionId}`, { instructions: next }); onClose(); } catch (e: any) { setError(e.message); setBusy(false); } }; return (
e.stopPropagation()}>

{t("instructions.title")}

{t("instructions.hint")}