PageSourceSearch

https://uniai.ai/assets/ReplyPage-D--ewUBz.js

js uniai.ai collected 2026-10-05 13:11:35 UTC 7,143 bytes, 6 lines download raw bytes

1import{a as z,b as T,aZ as H,r,bQ as U,t as q,b9 as G,j as e,bu as $,bG as O,bH as P,L as y,af as F,C as I,k as _,D as B,ac as K,M as Q}from"./index-BawMCgu8.js";import{S as V}from"./Select-CBvYay3K.js";import{u as Z}from"./chat-Cp3tSG9E.js";import{u as J}from"./useTextCreditEstimate-BRFi1zgD.js";import"./locale-en-B8Z5F_o1.js";import"./locale-zh-CN-CFdD1mPv.js";import"./locale-fr-j4CMJpfE.js";import"./locale-de-DuE2gagy.js";import"./locale-it-C6yb6RzN.js";import"./locale-ja-VjZBy5eF.js";import"./locale-ko-Cl0W-Az5.js";import"./locale-es-DwboUZze.js";import"./locale-zh-Hant-uT5aTnfX.js";import"./locale-ru-DEr1xfTZ.js";import"./locale-id-Buh3Uolz.js";import"./locale-pt-BR-CqD5J4_0.js";/**
2 * @license lucide-react v0.309.0 - ISC
3 *
4 * This source code is licensed under the ISC license.
5 * See the LICENSE file in the root directory of this source tree.
6 */const W=z("MessageSquareReply",[["path",{d:"M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z",key:"1lielz"}],["path",{d:"m10 7-3 3 3 3",key:"1eugdv"}],["path",{d:"M17 13v-1a2 2 0 0 0-2-2H7",key:"ernfh3"}]]),X=["auto","friendly","casual","polite","professional","witty","fun","formal"],Y=a=>{switch(a){case"friendly":return"friendly";case"casual":return"casual";case"polite":return"friendly";case"professional":return"professional";case"witty":return"creative";case"fun":return"casual";case"formal":return"formal";default:return"professional"}};function he(){const{t:a,i18n:b}=T(),{requireAuth:v}=H(),[l,j]=r.useState(""),[x,w]=r.useState("auto"),[p,N]=r.useState(()=>U(b.language)),[s,f]=r.useState(""),[n,h]=r.useState(!1),{copy:C,copied:L}=q(),[c,S]=r.useState(!1),d=r.useRef(null),m=r.useRef(null),{selectedModel:u,setSelectedModel:k}=Z(),{estimate:R,insufficient:g}=J(u,l.length);r.useEffect(()=>{n&&m.current&&(m.current.scrollTop=m.current.scrollHeight)},[s,n]);const E=r.useCallback(async()=>{if(v()&&l.trim()){h(!0),f(""),d.current=new AbortController;try{const t=G.replyStream({originalContent:l,tone:Y(x),language:p,model:u},d.current.signal);let o="";for await(const i of t)o+=i,f(o)}catch(t){if(t.name==="AbortError")return;console.error("Reply generation failed:",t)}finally{h(!1),d.current=null}}},[l,x,p,u]),M=()=>{var t;(t=d.current)==null||t.abort(),h(!1)},A=()=>{s&&C(s)},D=()=>{if(!s)return;const t=new Blob([s],{type:"text/plain;charset=utf-8"}),o=URL.createObjectURL(t),i=document.createElement("a");i.href=o,i.download=`reply-${Date.now()}.txt`,i.click(),URL.revokeObjectURL(o)};return e.jsxs("div",{className:"h-full flex flex-col bg-[var(--bg-primary)]",children:[e.jsxs("div",{className:"flex items-center justify-between px-4 md:px-6 py-3 border-b border-ui-border",children:[e.jsx($,{featureKey:"agent_writing",value:u,onChange:k}),e.jsxs("div",{className:"flex items-center gap-2 text-sm text-[var(--text-tertiary)]",children:[e.jsx(W,{className:"w-4 h-4"}),a("reply.title")]})]}),e.jsxs("div",{className:"flex-1 flex flex-col md:flex-row overflow-hidden",children:[e.jsx("div",{className:"w-full md:w-1/2 border-b md:border-b-0 md:border-r border-ui-border flex flex-col overflow-y-auto max-h-[50vh] md:max-h-none",children:e.jsxs("div",{className:"p-4 md:p-6 flex flex-col gap-4 md:gap-6",children:[e.jsxs("div",{children:[e.jsx("label",{className:"text-sm font-medium text-[var(--text-secondary)] mb-2 block",children:a("reply.inputLabel")}),e.jsx("textarea",{className:"w-full h-48 p-4 border border-ui-border rounded-lg resize-none focus:outline-none focus:ring-2 focus:ring-gray-400 bg-[var(--bg-primary)] text-[var(--text-primary)] placeholder-gray-400",placeholder:a("reply.placeholder"),value:l,onChange:t=>j(t.target.value),maxLength:2e3}),e.jsxs("div",{className:"mt-2 text-xs text-[var(--text-tertiary)]",children:[l.length.toLocaleString()," ",a("common.characters","characters")]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"text-sm font-medium text-[var(--text-secondary)] mb-2 block",children:a("reply.toneLabel")}),e.jsx("div",{className:"flex flex-wrap gap-2",children:X.map(t=>e.jsx("button",{onClick:()=>w(t),className:`px-4 py-2 text-sm rounded-full border transition-colors ${x===t?"bg-[var(--bg-tertiary)] border-[var(--text-secondary)] text-[var(--text-primary)]":"border-ui-border text-[var(--text-secondary)] hover:border-gray-400"}`,children:a(`replyPage.tone.${t}`)},t))})]}),e.jsxs("div",{children:[e.jsx("label",{className:"text-sm font-medium text-[var(--text-secondary)] mb-2 block",children:a("reply.languageLabel")}),e.jsx(V,{value:p,onChange:t=>N(t),options:O.map(t=>({value:t.code,label:P(t,b.language)})),className:"w-full"})]}),e.jsx("div",{className:"flex items-center gap-4 mt-4",children:e.jsx("button",{onClick:n?M:E,disabled:(!l.trim()||g)&&!n,title:g&&!n?a("replyPage.
6insufficientCredits",{count:R??0}):void 0,className:"flex-1 bg-[var(--theme)] text-white rounded-lg px-6 py-3 hover:bg-[var(--theme-hover)] disabled:opacity-50 disabled:cursor-not-allowed flex items-center justify-center gap-2 font-medium transition-all",children:n?e.jsxs(e.Fragment,{children:[e.jsx(y,{className:"w-5 h-5 animate-spin"}),a("reply.generating")]}):e.jsxs(e.Fragment,{children:[e.jsx(F,{className:"w-5 h-5"}),a("reply.generate")]})})})]})}),e.jsxs("div",{className:`${c?"fixed inset-0 z-50":"w-full md:w-1/2"} flex flex-col bg-[var(--bg-secondary)]`,children:[e.jsxs("div",{className:"flex items-center justify-between px-4 md:px-6 py-3 md:py-4 border-b border-ui-border",children:[e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsx("span",{className:"text-sm text-[var(--text-tertiary)]",children:a("reply.result")}),n&&e.jsxs("span",{className:"flex items-center gap-1.5 text-xs text-[var(--text-tertiary)] animate-pulse",children:[e.jsx(y,{className:"w-3 h-3 animate-spin"}),a("reply.generating")]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("button",{onClick:A,disabled:!s,className:"p-2 rounded-lg hover:bg-[var(--bg-hover)] text-[var(--text-tertiary)] disabled:opacity-50 disabled:cursor-not-allowed transition-colors",title:a("common.copy","Copy"),children:L?e.jsx(I,{className:"w-4 h-4 text-green-500"}):e.jsx(_,{className:"w-4 h-4"})}),e.jsx("button",{onClick:D,disabled:!s,className:"p-2 rounded-lg hover:bg-[var(--bg-hover)] text-[var(--text-tertiary)] disabled:opacity-50 disabled:cursor-not-allowed transition-colors",title:a("common.download","Download"),children:e.jsx(B,{className:"w-4 h-4"})}),e.jsx("button",{onClick:()=>S(!c),className:"p-2 rounded-lg hover:bg-[var(--bg-hover)] text-[var(--text-tertiary)] transition-colors",title:c?a("common.collapse","Collapse"):a("common.expand","Expand"),children:c?e.jsx(K,{className:"w-4 h-4"}):e.jsx(Q,{className:"w-4 h-4"})})]})]}),e.jsx("div",{ref:m,className:"flex-1 overflow-y-auto p-4 md:p-6",children:s?e.jsx("textarea",{value:s,onChange:t=>f(t.target.value),className:"w-full h-full min-h-[200px] resize-none bg-transparent text-[var(--text-primary)] text-sm leading-relaxed focus:outline-none",maxLength:2e3}):e.jsx("div",{className:"h-full flex items-center justify-center text-[var(--text-muted)]",children:e.jsx("p",{children:a("reply.resultHint")})})})]})]})]})}export{he 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.