diff --git a/src/LLMServiceHub/wwwroot/js/index.js b/src/LLMServiceHub/wwwroot/js/index.js index 4ae7c31..ccf0306 100644 --- a/src/LLMServiceHub/wwwroot/js/index.js +++ b/src/LLMServiceHub/wwwroot/js/index.js @@ -209,10 +209,10 @@ let sendBtnClickEventHandler = function (e) { contentType: 'application/json', data: JSON.stringify(request) }).done(function (data, status, xhr) { - //console.log(data); + console.log(data); if (data) { $(`#reply_time_${replyId}`).html(dateFormat('HH:MM:SS', new Date())); - var markdeownResult = data.result; + var markdeownResult = data.result.result; const typing = new EasyTyper({ output: '', isEnd: false, diff --git a/src/LLMServiceHub/wwwroot/js/index.min.js b/src/LLMServiceHub/wwwroot/js/index.min.js index 6ddc61e..2696140 100644 --- a/src/LLMServiceHub/wwwroot/js/index.min.js +++ b/src/LLMServiceHub/wwwroot/js/index.min.js @@ -39,7 +39,7 @@ function dateFormat(n,t){let i;const r={"Y+":t.getFullYear().toString(),"m+":(t. - `;$(h).appendTo($(u));$(c).appendTo($(u));let o=$(u).closest(".scrollable"),l=$(o).height();$(o).scrollTop(l);console.log("sending request with:");console.log(r);$.ajax(apiEndpoint,{method:"POST",dataType:"json",contentType:"application/json",data:JSON.stringify(r)}).done(function(t){if(t){$(`#reply_time_${n}`).html(dateFormat("HH:MM:SS",new Date));var i=t.result;const r=new EasyTyper({output:"",isEnd:!1,speed:20,singleBack:!1,sleep:0,type:"normal",backSpeed:40,sentencePause:!0},marked.parse(i),()=>{},t=>{$("#reply_"+n).html(`${t}`);let i=$(u).closest(".scrollable"),r=$(i).prop("scrollTop")+$("#reply_"+n).height();$(i).scrollTop(r)})}}).fail(function(t){console.log(t);$("#reply_"+n).html("发生错误")})}});n.preventDefault()};$(document).on("keyup",function(n){var t=n||window.event,i=t.which||t.keyCode||t.charCode;i==13&&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}------------- + `;$(h).appendTo($(u));$(c).appendTo($(u));let o=$(u).closest(".scrollable"),l=$(o).height();$(o).scrollTop(l);console.log("sending request with:");console.log(r);$.ajax(apiEndpoint,{method:"POST",dataType:"json",contentType:"application/json",data:JSON.stringify(r)}).done(function(t){if(console.log(t),t){$(`#reply_time_${n}`).html(dateFormat("HH:MM:SS",new Date));var i=t.result.result;const r=new EasyTyper({output:"",isEnd:!1,speed:20,singleBack:!1,sleep:0,type:"normal",backSpeed:40,sentencePause:!0},marked.parse(i),()=>{},t=>{$("#reply_"+n).html(`${t}`);let i=$(u).closest(".scrollable"),r=$(i).prop("scrollTop")+$("#reply_"+n).height();$(i).scrollTop(r)})}}).fail(function(t){console.log(t);$("#reply_"+n).html("发生错误")})}});n.preventDefault()};$(document).on("keyup",function(n){var t=n||window.event,i=t.which||t.keyCode||t.charCode;i==13&&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