You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
2 lines
11 KiB
2 lines
11 KiB
"use strict";(self.webpackChunk=self.webpackChunk||[]).push([[4413],{48975:function(Y,D,t){t.d(D,{Z:function(){return de}});var e=t(59301),F=t(43428),v=t(73755),T=t(26743),S=t(46651),P=t(3113),Z=t(98135),h=t(63144),E=t(22822),y=t(50457),w=t(59455),O=t(56102),d={wrp:"wrp___H70W8","file-list":"file-list___S5XYJ"},s=t(8591),o=t(95237),m=t(43604),x=t(35472),G=Object.defineProperty,I=Object.getOwnPropertySymbols,U=Object.prototype.hasOwnProperty,j=Object.prototype.propertyIsEnumerable,X=(a,r,n)=>r in a?G(a,r,{enumerable:!0,configurable:!0,writable:!0,value:n}):a[r]=n,H=(a,r)=>{for(var n in r||(r={}))U.call(r,n)&&X(a,n,r[n]);if(I)for(var n of I(r))j.call(r,n)&&X(a,n,r[n]);return a},ae=(a,r)=>{var n={};for(var i in a)U.call(a,i)&&r.indexOf(i)<0&&(n[i]=a[i]);if(a!=null&&I)for(var i of I(a))r.indexOf(i)<0&&j.call(a,i)&&(n[i]=a[i]);return n},oe=(a,r,n)=>new Promise((i,C)=>{var b=u=>{try{f(n.next(u))}catch(p){C(p)}},B=u=>{try{f(n.throw(u))}catch(p){C(p)}},f=u=>u.done?i(u.value):Promise.resolve(u.value).then(b,B);f((n=n.apply(a,r)).next())}),le=({data:a,hideTextEffect:r,onCallback:n,fileList:i,allowCopy:C})=>{const[b,B]=(0,e.useState)(""),[f,u]=(0,e.useState)(!0),p=(0,e.useRef)();(0,e.useEffect)(()=>a.text?(u(!0),r?B(a.text):(()=>oe(void 0,null,function*(){for(let l=0;l<a.text.length;l++)B(a.text.substring(0,l+1)+(a.text.length-1>l?" __":"")),yield new Promise(A=>setTimeout(A,30));u(!1),n==null||n(a)}))(),()=>B("")):void 0,[]),(0,e.useEffect)(()=>{var _;(_=p.current)==null||_.scrollIntoView({behavior:"smooth"})},[b]);const J=_=>{if(_===0)return"0 B";const l=1024,A=["B","KB","MB","GB","TB","PB","EB","ZB","YB"],R=Math.floor(Math.log(_)/Math.log(l));return parseFloat((_/Math.pow(l,R)).toFixed(2))+" "+A[R]};return e.createElement("div",{ref:p,className:`${d.wrp} fadeIn animated`},e.createElement(E.U,{components:{code(_){var l=_,{node:A,inline:R,className:V,children:M}=l,W=ae(l,["node","inline","className","children"]);const K=/language-(\w+)/.exec(V||"");return!R&&K?e.createElement("div",{style:{position:"relative"}},e.createElement(O.CopyToClipboard,{text:String(M).replace(/\n$/,""),onCopy:()=>s.ZP.success({content:"\u590D\u5236\u6210\u529F",key:"copy"})},e.createElement("button",{style:{position:"absolute",top:0,right:0,padding:"4px 8px",borderRadius:"0 0 0 5px",border:"none",backgroundColor:"#007bff",color:"#fff",cursor:"pointer",fontSize:"12px"}},"\u590D\u5236")),e.createElement(y.Z,H({style:w.Z,language:K[1],PreTag:"div",showLineNumbers:!0,lineNumberStyle:{minWidth:"40px"}},W),String(M||"").replace(/\n$/,""))):e.createElement("code",H({className:V},W),M)}}},b),i&&!f&&e.createElement(o.Z,{className:`${d["file-list"]} animated fadeIn`},e.createElement(m.Z,null,e.createElement(x.Z,{className:"font20 mr10"})),e.createElement(m.Z,null,i==null?void 0:i.name,e.createElement("br",null),J(i==null?void 0:i.size))),!f&&C&&e.createElement("div",{className:"tr"},e.createElement(O.CopyToClipboard,{text:String(b).replace(/\n$/,""),onCopy:()=>s.ZP.success({content:"\u590D\u5236\u6210\u529F",key:"copy"})},e.createElement("button",{style:{padding:"4px 8px",borderRadius:"0 0 0 5px",border:"none",backgroundColor:"#007bff",color:"#fff",cursor:"pointer",fontSize:"12px"}},"\u590D\u5236\u5185\u5BB9"))))},g={flex_box_center:"flex_box_center___GmElr",flex_space_between:"flex_space_between____pbWi",flex_box_vertical_center:"flex_box_vertical_center___COMWd",flex_box_center_end:"flex_box_center_end___lmAQf",flex_box_column:"flex_box_column___OJb7M","ai-wrp":"ai-wrp___AEGoS","loading-wanx":"loading-wanx___GtiUv","dot-flashing":"dot-flashing___xJNVn","dot-fade":"dot-fade___KWn1a","footer-container":"footer-container___HTy33","has-file":"has-file___Yj5gd","footer-container-upload":"footer-container-upload___UB3Ny","input-container":"input-container___M88BT","chat-container":"chat-container___pNTrU","chat-message":"chat-message___isXl8",incoming:"incoming___rQ8Nk",outgoing:"outgoing___P3ZLW"},re=t(76265),se=t(35099),ie=t(81407),ue=t(90784),ce=(a,r,n)=>new Promise((i,C)=>{var b=u=>{try{f(n.next(u))}catch(p){C(p)}},B=u=>{try{f(n.throw(u))}catch(p){C(p)}},f=u=>u.done?i(u.value):Promise.resolve(u.value).then(b,B);f((n=n.apply(a,r)).next())}),de=({defaultData:a,title:r,placeholder:n,hideUpload:i,hideInputBox:C,aiIcon:b,userIcon:B,children:f})=>{var u,p;const[J,_]=(0,e.useState)(!1),[l,A]=(0,e.useState)([]),[R,V]=(0,e.useState)([]),[M,W]=(0,e.useState)(!1),K=["daiao","pu428f3pz","wangwei10061"],[$,Q]=(0,e.useState)([...a||[]]),L=(0,e.useRef)($),k=(0,e.useRef)(),[z,q]=(0,e.useState)("");(0,e.useEffect)(()=>{L.current=$},[$]);const ee=()=>{_(!0)},me=()=>{_(!1)},fe=c=>ce(void 0,null,function*(){const N=yield(0,re.ZP)("https://ai-data.educoder.net/v1/chat-messages",{method:"post",body:{inputs:{description:"\u4E3A\u6211\u751F\u6210\u4E00\u4E2A\u9762\u5411\u5BF9\u8C61\u7684\u6848\u4F8B"},query:c,response_mode:"blocking",conversation_id:k.current||"",user:"abc-sssdd",files:[]},mode:"cors",headers:{"Content-Type":"application/json",Authorization:"Bearer app-pnyfYJSuVEnMCSoTpF37uJdp"}});W(!1),L.current[L.current.length-1].text=N==null?void 0:N.answer,L.current[L.current.length-1].loading=!1,k.current=N==null?void 0:N.conversation_id,Q([...L.current])}),pe=c=>{q(c.target.value)},te=()=>{z.trim()!==""&&(q(""),A([]),Q([...$,{text:z,done:!1,key:Date.now(),sender:"user",fileList:l[0]},{text:z,done:!1,loading:!0,key:Date.now(),sender:"AI",allowCopy:!0}]),W(!0),setTimeout(()=>fe(z),300))},ve=c=>{var N;if(c.key==="Enter"){if(c.preventDefault(),l!=null&&l.length&&((N=l==null?void 0:l[0])==null?void 0:N.status)!=="done"||M)return;te()}},he=({fileList:c})=>{console.log(":newFileList:",c),A(c)};return e.createElement("div",null,K.includes((u=(0,se.eY)())==null?void 0:u.login)&&(f?e.createElement("div",{onClick:ee},e.createElement(h.Outlet,null),f):e.createElement("div",{style:{width:60,height:60,position:"fixed",zIndex:2,right:20,bottom:"35%",cursor:"pointer"},onClick:ee},e.createElement("img",{src:"/images/ai_teacher.png",width:60}))),e.createElement(F.Z,{maskClosable:!1,width:800,title:r||"\u5934\u6B4CAI",onClose:me,open:J,className:g.answerWrp},e.createElement("div",{className:g["ai-wrp"]},e.createElement("div",{className:g["chat-container"]},e.createElement(v.Z,{itemLayout:"horizontal",dataSource:$,renderItem:c=>e.createElement(v.Z.Item,{className:`${g["chat-message"]} ${c.sender==="AI"?"outgoing":"incoming"}`},e.createElement(v.Z.Item.Meta,{avatar:e.createElement(T.C,{size:50,src:c.sender==="AI"?b||"/images/ai_icon.png":B||"/images/ai_user.png"}),description:c.loading?e.createElement("div",{className:g["loading-wanx"]},e.createElement("div",{className:g["dot-flashing"]}),e.createElement("div",{className:g["dot-flashing"]}),e.createElement("div",{className:g["dot-flashing"]})):e.createElement(le,{allowCopy:c.allowCopy,data:{text:c.text},fileList:c.fileList,hideTextEffect:c.hideTextEffect})}))})),!C&&e.createElement("div",{className:`${g["footer-container"]} ${l.length>=1&&g["has-file"]}`},!i&&e.createElement("div",{className:g["footer-container-upload"]},e.createElement(S.default,{action:"https://ai-data.educoder.net/v1/datasets/dc9e6c03-a629-4e9e-bd81-06fb93c29aa1/document/create_by_file",listType:"picture",fileList:[...l],onChange:he,iconRender:()=>e.createElement(x.Z,null),accept:".doc,.docx,.xml,application/msword,application/vnd.openxmlformats-officedocument.wordprocessingml.document",beforeUpload:c=>{const ne=["application/msword","application/vnd.openxmlformats-officedocument.wordprocessingml.document","application/vnd.ms-excel","application/vnd.openxmlformats-officedocument.spreadsheetml.sheet","application/vnd.ms-powerpoint","application/vnd.openxmlformats-officedocument.presentationml.presentation"].includes(c.type);return ne||z.error("\u53EA\u80FD\u4E0A\u4F20Office\u6587\u6863\uFF01"),ne},headers:{Authorization:"Bearer dataset-xBnNgFqcMjLGAXz7pFgXzGwY"},data:{data:JSON.stringify({indexing_technique:"high_quality",process_rule:{rules:{pre_processing_rules:[{id:"remove_extra_spaces",enabled:!0},{id:"remove_urls_emails",enabled:!0}],segmentation:{separator:"###",max_tokens:500}},mode:"custom"}})},className:"upload-list-inline",maxCount:1},l.length>=1?null:e.createElement(P.ZP,{icon:e.createElement(ie.Z,null)}))),e.createElement("div",{className:g["input-container"]},e.createElement(Z.default.TextArea,{rows:1,placeholder:n||"\u5728\u8FD9\u91CC\u8F93\u5165\u95EE\u9898",value:z,onChange:pe,onKeyPress:ve}),e.createElement(P.ZP,{type:"primary",shape:"circle",icon:e.createElement(ue.Z,null),disabled:!!(l!=null&&l.length)&&((p=l==null?void 0:l[0])==null?void 0:p.status)!=="done"||M,onClick:te}))))))}},29487:function(Y,D,t){t.d(D,{t:function(){return O}});var e=t(59301),F=t(3113),v={buttonFixed:"buttonFixed___vyq30",button:"button___hxmYv",buttonWrap:"buttonWrap___uK8dl"},T=t(92310),S=t.n(T),P=Object.defineProperty,Z=Object.getOwnPropertySymbols,h=Object.prototype.hasOwnProperty,E=Object.prototype.propertyIsEnumerable,y=(d,s,o)=>s in d?P(d,s,{enumerable:!0,configurable:!0,writable:!0,value:o}):d[s]=o,w=(d,s)=>{for(var o in s||(s={}))h.call(s,o)&&y(d,o,s[o]);if(Z)for(var o of Z(s))E.call(s,o)&&y(d,o,s[o]);return d};const O=({cancelText:d="\u53D6\u6D88",okText:s="\u786E\u5B9A",loading:o=!1,hasOkBtn:m=!0,hasCancelBtn:x=!0,okButtonProps:G={},onCancel:I=()=>{},onOk:U=()=>{},className:j=""})=>e.createElement("div",{className:S()(v.buttonFixed,j)},e.createElement("div",{className:v.buttonWrap},x&&e.createElement(F.ZP,{size:"middle",className:`${v.button} mr20`,onClick:I},d),m&&e.createElement(F.ZP,w({size:"middle",type:"primary",className:`${v.button} mr20`,loading:o,onClick:U},G),s)))},79164:function(Y,D,t){t.d(D,{Z:function(){return S}});var e=t(59301),F=t(71418),v={loading:"loading___lueiN"},S=({loading:P})=>P?e.createElement("div",{className:v.loading},e.createElement(F.Z,null)):e.createElement(e.Fragment,null)},3381:function(Y,D,t){t.d(D,{S:function(){return P},m:function(){return Z}});var e=t(15826),F=t(8591),v=t(43418),T=t(59301),S=(h,E,y)=>new Promise((w,O)=>{var d=m=>{try{o(y.next(m))}catch(x){O(x)}},s=m=>{try{o(y.throw(m))}catch(x){O(x)}},o=m=>m.done?w(m.value):Promise.resolve(m.value).then(d,s);o((y=y.apply(h,E)).next())});const P=h=>{let E=document.createElement("textarea");return E.value=h,E.value},Z=(h,E,y,w,O)=>S(void 0,null,function*(){var d,s;const o=yield h({type:"shixunsDetail/saveCopyForExercise",payload:{id:y,save_type:w}});w===1?((o==null?void 0:o.status)==0&&F.ZP.success("\u4FDD\u5B58\u6210\u529F"),(d=o==null?void 0:o.data)!=null&&d.exists_same_shixun_name?h({type:"classroomList/setActionTabs",payload:{key:"\u91CD\u540D\u4FEE\u6539",name:(s=o==null?void 0:o.data)==null?void 0:s.shixun_name}}):h({type:"classroomList/setActionTabs",payload:{}})):(h({type:"classroomList/setActionTabs",payload:{}}),(o==null?void 0:o.status)===0&&v.default.info({title:"\u63D0\u793A",width:460,icon:null,centered:!0,content:T.createElement("div",null,T.createElement("div",null,"\u5B9E\u8BAD\u540C\u6B65\u4FEE\u6539\u5B8C\u6210\uFF0C\u8BF7\u9A8C\u8BC1\u5B9E\u8BAD\u662F\u5426\u53EF\u4EE5\u6B63\u5E38\u4F7F\u7528\u3002")),okText:"\u524D\u5F80\u539F\u5B9E\u8BAD",onOk:()=>{var m,x;(0,e.xg)(`/shixuns/${(x=(m=E==null?void 0:E.detail)==null?void 0:m.fork_from)==null?void 0:x.fork_identifier}/challenges`)}}))})}}]);
|