1import{r as t,q as E,j as r,b as N}from"./app-ZLct92ex.js";import{I as j}from"./input-BwMmU2IR.js";import{L as b}from"./label-DX4ZBjM9.js";import{A as y,a as k}from"./alert-EH5d7Vtn.js";const _=({training:i})=>{const[a,n]=t.useState(!1),[e,m]=t.useState(i?.generative_model_name||""),[u,d]=t.useState(i?.generative_model_name||""),{flash:o}=E().props,[f,l]=t.useState(o?.error||""),c=t.useRef(null);t.useEffect(()=>{a&&c.current&&c.current.focus()},[a]),t.useEffect(()=>{o?.error&&l(o.error)},[o]);const x=()=>{d(e),n(!0)},p=()=>{if(!e.trim()||e===u){n(!1);return}N.post("/training/name",{name:e},{preserveScroll:!0,onSuccess:()=>{n(!1),l(""),d(e)},onError:s=>{l(s.message||s.name||"Failed to update name")}})},h=async s=>{s.key==="Enter"?(s.preventDefault(),p()):s.key==="Escape"&&(n(!1),m(u))},v=()=>{p()},g=s=>{m(s.target.value)};return r.jsxs("div",{className:"space-y-2",children:[r.jsx(b,{className:"text-sm font-medium text-muted-foreground",children:"Model Name"}),r.jsx("div",{onClick:x,className:`w-full sm:w-[300px] transition-colors ${a?"":"cursor-pointer hover:bg-accent/50"}`,children:a?r.jsx(j,{ref:c,type:"text",value:e,onChange:g,onKeyDown:h,onBlur:v,placeholder:"Enter model name...",className:"w-full"}):r.jsx("div",{className:"p-2 rounded-md border bg-background",children:r.jsx("span",{className:e?"":"text-muted-foreground",children:e||"Click to add model name"})})}),f&&r.jsx(y,{variant:"destructive",children:r.jsx(k,{children:f})})]})};export{_ as default};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.