1import{b as q}from"../../assets/rank_3-JPmr3u2n.js";import{b as D,an as F,ao as U,ap as $,_ as J}from"../../assets/index-DoWvVrc1.js";import{C as G}from"../../assets/strategy_101_global-Cg-LIY5H.js";import{V as W}from"../../assets/strategy_98-Cq0X9TUi.js";import{d as K,A as Z,k as _,e as i,o as r,p as A,a as t,F as E,r as Q,b as c,aZ as X,l,f as Y,B as ee,w as S,i as T,t as x,c as M,a_ as se,a$ as te,S as ae,aO as ne,K as oe,am as le,a8 as f,aW as re,M as ie,O as ce,b0 as de}from"../../assets/vendor-Bh6u8-zI.js";import"../../assets/pingtai-DLWCcYtj.js";const ue={class:"h-[calc(100%-150px)]"},pe={class:"h-full"},ge={class:"message-container"},me={key:0},fe={class:"w-full h-full flex justify-start align-start"},ve={class:"message user"},he={class:"flex w-full"},ye={class:"mr-16px flex justify-end flex-1"},_e=["src"],xe=["innerHTML"],we=["data-message-index"],be={class:"w-full h-full flex justify-start align-start"},ke={class:"message answer"},Ce={class:"flex answer-message-layout"},Le={key:0,class:"answer-message-card"},Se={class:"flex answer-message-content"},Te=["innerHTML"],Oe={key:0,class:"flex items-centermt-10px mt-10px answer-message-actions"},qe={key:1,class:"h-32px flex items-center"},Ae={class:"ml-10px color-primary"},Ee={class:"bg-[#fff] z-[99] w-full h-138px pr-18px pl-40px absolute bottom-0 left-0"},Me={class:"flex flex-col items-end justify-end border-1px border-solid border-#E8E8E8 rounded-[8px] h-full"},Ne=K({__name:"drawer-chat-form",props:{messageList:{type:Array,default:()=>[]},promptGroup:{type:Array,default:()=>[]},spinLoading:{type:Boolean,default:!1},className:{type:String,default:""},tipsText:{type:String,default:""},currentGroupId:{type:String,default:""},scriptForm:{type:Object,default:()=>{}}},emits:["send","generate-video","copy","collect","updateMessage","updateScript","update:messageList","update:group"],setup(v,{expose:N,emit:B}){const{t:n,locale:I}=D(),u=v,g=B,P=Z(),p=_(""),O=_(null),d=_(null),h=_(""),w=(s=!0)=>{le(()=>{const e=O.value;if(e)try{e.scrollTo({top:e.scrollHeight,behavior:s?"smooth":"auto"})}catch{e.scrollTop=e.scrollHeight}})},V=()=>{if(!p.value)return f.error(n("components-qinghu-ai.drawer-chat-form.738063-92"));const s=u.messageList&&u.messageList.length?u.messageList[u.messageList.length-1]:null,e=p.value.replace(/\n/g,"<br/>");g("updateMessage",e);const o={originalPrompt:(s==null?void 0:s.content)||"",promptType:"EDIT_PROMPT_TEMPLE",userSuggestion:p.value,isStyleTitles:!1};w(),h.value="",R(o)},H=async(s={})=>{const e={type:"VIDEO",text:s==null?void 0:s.content,duration:(s==null?void 0:s.second)||""};s.saveLoading=!0;const o=await U(e);o.code==200&&(s.collectId=o.payload,f.success(n("qinghu-ai.video-script-drawer.995810-15"))),s.saveLoading=!1},R=async s=>{p.value="",d.value=new AbortController,g("updateScript",{script:"",status:"start"}),await re($,{method:"POST",headers:{"Content-Type":"application/json","Accept-Language":I.value,Authorization:`Bearer ${localStorage.getItem("Authorization")}`},body:JSON.stringify({...s,language:n("components.VideoTranslationParams.738063-22")}),signal:d.value.signal,openWhenHidden:!0,onmessage(e){var o;try{const m=JSON.parse(e.data),{role:k,type:y,data:a,index:C,title:L}=m||{};if(y==="chat_number_over"){if(d.value.abort(),d.value=null,(o=u.messageList)!=null&&o.length){const z=u.messageList[u.messageList.length-1];z.loading=!1}return ie.confirm({title:n("qinghu-ai.video-script.120875-9"),icon:ce(de),content:a,cancelText:n("qinghu-ai.video-script.120875-10"),okText:n("qinghu-ai.video-script.120875-11"),keyboard:!1,maskClosable:!1,onOk(){P.push("/product?product=vip")}})}k==="assistant"&&y==="answer"&&typeof a=="string"&&(h.value+=a,g("updateScript",{script:h.value,status:"updating"}),w())}catch{}},async onopen(e){if(e.status&&["401","500","600"].includes(String(e.status)))if(e.status==401){f.error(n("qinghu-ai.video-script.120875-14"));let o=setTimeout(()=>{clearTimeout(o),window.location.reload()},600)}else e.status==500?f.error(n("qinghu-ai.video-script.120875-15")):e.status==600&&f.error(n("qinghu-ai.video-script.120875-15"));return Promise.resolve()}
1,onerror(e){f.error(n("qinghu-ai.video-script.120875-17")),d.value.abort(),d.value=null,g("updateScript",{script:h.value,status:"finish"})},async onclose(){d.value.abort(),d.value=null,g("updateScript",{script:h.value,status:"finish"})}})},j=s=>{g("generate-video",b(s))},b=s=>JSON.parse(JSON.stringify(s)).replace(/\n/g,"<br>");return N({scrollToBottom:w}),(s,e)=>{const o=X,m=ee,k=ae,y=ne;return r(),i("div",{class:A(["drawer-chat-form h-[calc(100%-248px)]",[v.className]])},[t("div",ue,[t("div",pe,[t("div",{class:"h-full overflow-y-auto common-scrollbar",ref_key:"messageContainerRef",ref:O},[t("div",ge,[(r(!0),i(E,null,Q(v.messageList,(a,C)=>(r(),i(E,{key:C},[a.type==="user"?(r(),i("div",me,[t("div",fe,[t("div",ve,[t("div",he,[t("div",ye,[a.imgUrl?(r(),i("img",{key:0,src:a.imgUrl,alt:"",class:"w-50px h-50px"},null,8,_e)):(r(),i("div",{key:1,style:{"max-width":"90%"},innerHTML:b(a.content)},null,8,xe))]),c(o,{src:l(q),style:{"flex-shrink":"0","margin-left":"8px"}},null,8,["src"])])])]),e[1]||(e[1]=t("div",{style:{margin:"20px 0"}},null,-1))])):(r(),i("div",{key:1,class:"answer-message-wrapper","data-message-index":C},[t("div",be,[t("div",ke,[t("div",Ce,[c(o,{src:l(q),class:"avatar"},null,8,["src"]),a.content?(r(),i("div",Le,[t("div",Se,[t("div",{class:"answer-message-text",innerHTML:b(a.content)},null,8,Te)]),!v.spinLoading&&!a.loading?(r(),i("div",Oe,[c(m,{class:"items-center mr-10px answer-action-btn",onClick:L=>l(F)(a.content),style:{display:"flex"}},{default:S(()=>[c(l(G),{class:"mr-2px"}),T(" "+x(l(n)("pages.video-analyse.index.000000-39")),1)]),_:1},8,["onClick"]),c(m,{class:"items-center mr-10px answer-action-btn",onClick:L=>H(a),loading:a.saveLoading,style:{display:"flex"}},{default:S(()=>[a.collectId?(r(),M(l(te),{key:1})):(r(),M(l(se),{key:0})),T(" "+x(l(n)("pages.video-analyse.index.000000-56")),1)]),_:2},1032,["onClick","loading"]),c(m,{class:"items-center answer-action-btn",onClick:L=>j(a.content),style:{display:"flex"}},{default:S(()=>[c(l(W),{class:"mr-2px"}),T(" "+x(l(n)("pages.video-analyse.index.000000-57")),1)]),_:1},8,["onClick"])])):Y("",!0)])):(r(),i("div",qe,[c(k,{class:"h-20px",size:"small"}),t("span",Ae,x(v.tipsText||l(n)("components-qinghu-ai.drawer-chat-form.304388-6")),1)]))])])]),e[2]||(e[2]=t("div",{style:{margin:"20px 0"}},null,-1))],8,we))],64))),128))])],512)])]),t("div",Ee,[t("div",Me,[c(y,{bordered:!1,placeholder:l(n)("components-qinghu-ai.drawer-chat-form.738063-92"),"auto-size":{minRows:4,maxRows:4},value:p.value,"onUpdate:value":e[0]||(e[0]=a=>p.value=a)},null,8,["placeholder","value"]),t("div",{class:A(["actions-icon-button primary mr-10px mb-10px",{disabled:!p.value}]),onClick:V},[c(l(oe))],2)])]),e[3]||(e[3]=t("div",{style:{height:"138px"}},null,-1))],2)}}}),je=J(Ne,[["__scopeId","data-v-6550ecc2"]]);export{je 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.