@@ -29,7 +29,7 @@ function dateFormat(n,t){let i;const r={"Y+":t.getFullYear().toString(),"m+":(t.
@@ -40,7 +40,7 @@ function dateFormat(n,t){let i;const r={"Y+":t.getFullYear().toString(),"m+":(t.
- `;$(g).appendTo($(u));$(nt).appendTo($(u));let w=$(u).closest(".scrollable"),tt=$(w).height();$(w).scrollTop(tt);console.log("sending request with:");console.log(r);var a=!1,b=12e4,v=[],f=0,e=0,s=-1,h=null,y=50,p=0,k=function(){var i,t,r,o,c,l,a;if(p>b&&clearInterval(h),i=v[f],i){if(t=i.chunk||"",s>0&&(f==s||!t)){clearInterval(h);f=0;return}r=0;t&&(r=t.length||0,o=t[e]||"",o&&(c=($(`#reply_hid_${n}`).val()||"")+o,$(`#reply_hid_${n}`).val(c),$(`#reply_${n}`).html(marked.parse(c)),l=$(u).closest(".scrollable"),a=$(l).prop("scrollTop")+$("#reply_"+n).height(),$(l).scrollTop(a)));e++;e==r&&(e=0,f++);p+=y}};EventSource=SSE;c=new SSE(apiEndpoint,{headers:{"Content-Type":"application/json"},payload:JSON.stringify(r),withCredentials:!0,debug:!1,start:!1,method:"POST"});c.addEventListener("message",function(t){var u=useSSE?t.data:t.source.chunk,i=JSON.parse(u),r;i&&(r=i.aigc_message,v.push({row:i.llm_response_data.sentence_id,chunk:r.split("")}),a||($(`#reply_time_${n}`).html(dateFormat("HH:MM:SS",new Date)),h=setInterval(k,y),a=!0),i.llm_response_data.is_end&&(s=i.llm_response_data.sentence_id))});c.stream()}}});n.preventDefault()};$(document).on("keyup",function(n){var t=n||window.event,i=t.which||t.keyCode||t.charCode;i==13&&t.ctrlKey&&sendBtnClickEventHandler(n)});$(".btn-send-message").on("click",sendBtnClickEventHandler);$(".btn-export").on("click",function(){let t=dateFormat("YYYYmmddHHMMSS",new Date),r=$(this).closest(".card"),u=$(this).data("key")+"-"+t+".txt",f=$(r).find(".chat-bubble"),n=[];n.push(`--------------${t}-------------
+ `;$(g).appendTo($(o));$(nt).appendTo($(o));let w=$(o).closest(".scrollable"),tt=$(w).height();$(w).scrollTop(tt);console.log("sending request with:");console.log(u);var y=!1,b=12e4,e=[],r=0,f=0,s=-1,c=null,p=50,l=0,k=function(){var i,t,u,h,a,v,y;if(console.log(`typeChunk--->[${r}][${f}] chunkQueue.length->${e.length} lastsentence->${s}`),l>b){console.log(`timeout: ${l}`);clearInterval(c);return}if(!(e.length
0&&r==e.length){console.log(`>>>>>>>> end:: curChunkIdx->${r} chunkQueue.length->${e.length} curCharIdx->${f} lastsentence->${s},ret.`);clearInterval(c);r=0;return}if((i=e[r],i)&&(t=i.chunk||"",t)){if(u=0,t&&(u=t.length||0,h=t[f]||"",h&&(a=($(`#reply_hid_${n}`).val()||"")+h,$(`#reply_hid_${n}`).val(a),$(`#reply_${n}`).html(marked.parse(a)),v=$(o).closest(".scrollable"),y=$(v).prop("scrollTop")+$("#reply_"+n).height(),$(v).scrollTop(y))),f>=u){console.log("line end...");console.log(t);console.log(`[${r}][${f}] | lastsentence: ${s}`);f=0;r++;return}f++;l+=p}}};EventSource=SSE;a=new SSE(apiEndpoint,{headers:{"Content-Type":"application/json"},payload:JSON.stringify(u),withCredentials:!0,debug:!1,start:!1,method:"POST"});a.addEventListener("message",function(t){var u=useSSE?t.data:t.source.chunk,i=JSON.parse(u),r;console.log(`-------------${h} message in ↓-------------`);console.log(i);i&&(r=i.aigc_message,e.push({row:i.llm_response_data.sentence_id,chunk:r.split("")}),y||($(`#reply_time_${n}`).html(dateFormat("HH:MM:SS",new Date)),c=setInterval(k,p),y=!0),i.llm_response_data.is_end&&(s=i.llm_response_data.sentence_id))});a.stream()}}});n.preventDefault()};$(document).on("keyup",function(n){var t=n||window.event,i=t.which||t.keyCode||t.charCode;i==13&&t.ctrlKey&&sendBtnClickEventHandler(n)});$(".btn-send-message").on("click",sendBtnClickEventHandler);$(".btn-export").on("click",function(){let t=dateFormat("YYYYmmddHHMMSS",new Date),r=$(this).closest(".card"),u=$(this).data("key")+"-"+t+".txt",f=$(r).find(".chat-bubble"),n=[];n.push(`--------------${t}-------------
`);$(f).each(function(t,i){let r=$(i).find(".chat-bubble-author").text(),u=$(i).find(".chat-bubble-date").text(),f=$(i).find(".chat-bubble-body").text();n.push(`[${r}] ${u}
`);n.push(f.trim());n.push("\r\n-------------------------------\r\n")});let i=n.join("");console.log(i);exportBlob(i,u)});
\ No newline at end of file