From 6cbb98cccd2e24b9c6b68556cb3319f7359aa83a Mon Sep 17 00:00:00 2001 From: arthuridea w <2337583+arthuridea@users.noreply.github.com> Date: Wed, 27 Dec 2023 16:54:34 +0800 Subject: [PATCH] fix:adjust checkbox selection status check. --- src/LLMServiceHub/wwwroot/js/index.js | 2 +- src/LLMServiceHub/wwwroot/js/index.min.js | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/LLMServiceHub/wwwroot/js/index.js b/src/LLMServiceHub/wwwroot/js/index.js index f92ee3b..8f00097 100644 --- a/src/LLMServiceHub/wwwroot/js/index.js +++ b/src/LLMServiceHub/wwwroot/js/index.js @@ -119,7 +119,7 @@ let sendBtnClickEventHandler = function (e) { console.log(`MODEL: ${key} -> ${availableLLM}`); if (!availableLLM){ - return false; + return; } let rndStr = Math.random().toString(36).slice(-8); let request = conversations[key]; diff --git a/src/LLMServiceHub/wwwroot/js/index.min.js b/src/LLMServiceHub/wwwroot/js/index.min.js index 734c8e8..1198733 100644 --- a/src/LLMServiceHub/wwwroot/js/index.min.js +++ b/src/LLMServiceHub/wwwroot/js/index.min.js @@ -1,4 +1,4 @@ -function dateFormat(n,t){let i;const r={"Y+":t.getFullYear().toString(),"m+":(t.getMonth()+1).toString(),"d+":t.getDate().toString(),"H+":t.getHours().toString(),"M+":t.getMinutes().toString(),"S+":t.getSeconds().toString()};for(let t in r)i=new RegExp("("+t+")").exec(n),i&&(n=n.replace(i[1],i[1].length==1?r[t]:r[t].padStart(i[1].length,"0")));return n}function syncCurrentVal(n,t){$(`#${n}-val`).val(t);conversations.ConvErnieTurbo[n]=parseFloat(t);conversations.ConvErnie3_5[n]=parseFloat(t);conversations.ConvErnie4_0[n]=parseFloat(t);$(".llm-model-config").each(function(n,t){let r=$(t).data("llm-name"),i=conversations[r];$(t).html(`温度:${i.temperature};多样性:${i.top_p};惩罚系数:${i.penalty_score};`)})}function exportBlob(n,t){const u=new Blob([n],{type:"text/plain"}),r=URL.createObjectURL(u),i=document.createElement("a");i.href=r;i.download=t;document.body.appendChild(i);i.click();document.body.removeChild(i);URL.revokeObjectURL(r)}let m_t=.95,m_tp=.8,m_ps=1,conversations={ConvErnieTurbo:{temperature:m_t||.95,top_p:m_tp||.8,penalty_score:m_ps||1,stream:!1,conversation_id:"conv-turbo",message:"",model:2,user_id:"7ffe3194-2bf0-48ba-8dbd-e888d7d556d3"},ConvErnie3_5:{temperature:m_t||.95,top_p:m_tp||.8,penalty_score:m_ps||1,stream:!1,conversation_id:"conv-3_5",message:"",model:1,user_id:"7ffe3194-2bf0-48ba-8dbd-e888d7d556d3"},ConvErnie4_0:{temperature:m_t||.95,top_p:m_tp||.8,penalty_score:m_ps||1,stream:!1,conversation_id:"conv-4_0",message:"",model:3,user_id:"7ffe3194-2bf0-48ba-8dbd-e888d7d556d3"}};$("#r-temperature").val(m_t);$("#temperature-val").val(m_t);$("#r-top_p").val(m_tp);$("#top_p-val").val(m_tp);$("#r-penalty_score").val(m_ps);$("#penalty_score-val").val(m_ps);$(".llm-model-config").html(`温度:${m_t};多样性:${m_tp};惩罚系数:${m_ps};`);$(".llm-range-picker").on("change",function(){let n=$(this),t=$(n).val(),i=$(n).data("sync-key");syncCurrentVal(i,t)});$(".btn-discard-llm-setting").on("click",function(){let i=$(this),n=$(i).data("val"),t=$(i).data("rel-key");console.log(n);console.log(t);$(`#r-${t}`).val(n);syncCurrentVal(t,n)});let sendBtnClickEventHandler=function(n){let t=$("#ipt-message").val();$("#ipt-message").val("");$(Object.keys(conversations)).each(function(n,i){var f=$("#chk-"+i).is(":checked");if(console.log(`MODEL: ${i} -> ${f}`),!f)return!1;let e=Math.random().toString(36).slice(-8),r=conversations[i],o="#wrapper_"+i;r.message=t;r.conversation_id=`${r.conversation_id}_${e}`;let u=$(o);if(u){let s=dateFormat("HH:MM:SS",new Date),n=`rpl_${e}`,f;switch(i){case"ConvErnieTurbo":f="ernie_turbo";break;case"ConvErnie3_5":f="ernie_3_5";break;case"ConvErnie4_0":f="ernie_4_0"}const h=` +function dateFormat(n,t){let i;const r={"Y+":t.getFullYear().toString(),"m+":(t.getMonth()+1).toString(),"d+":t.getDate().toString(),"H+":t.getHours().toString(),"M+":t.getMinutes().toString(),"S+":t.getSeconds().toString()};for(let t in r)i=new RegExp("("+t+")").exec(n),i&&(n=n.replace(i[1],i[1].length==1?r[t]:r[t].padStart(i[1].length,"0")));return n}function syncCurrentVal(n,t){$(`#${n}-val`).val(t);conversations.ConvErnieTurbo[n]=parseFloat(t);conversations.ConvErnie3_5[n]=parseFloat(t);conversations.ConvErnie4_0[n]=parseFloat(t);$(".llm-model-config").each(function(n,t){let r=$(t).data("llm-name"),i=conversations[r];$(t).html(`温度:${i.temperature};多样性:${i.top_p};惩罚系数:${i.penalty_score};`)})}function exportBlob(n,t){const u=new Blob([n],{type:"text/plain"}),r=URL.createObjectURL(u),i=document.createElement("a");i.href=r;i.download=t;document.body.appendChild(i);i.click();document.body.removeChild(i);URL.revokeObjectURL(r)}let m_t=.95,m_tp=.8,m_ps=1,conversations={ConvErnieTurbo:{temperature:m_t||.95,top_p:m_tp||.8,penalty_score:m_ps||1,stream:!1,conversation_id:"conv-turbo",message:"",model:2,user_id:"7ffe3194-2bf0-48ba-8dbd-e888d7d556d3"},ConvErnie3_5:{temperature:m_t||.95,top_p:m_tp||.8,penalty_score:m_ps||1,stream:!1,conversation_id:"conv-3_5",message:"",model:1,user_id:"7ffe3194-2bf0-48ba-8dbd-e888d7d556d3"},ConvErnie4_0:{temperature:m_t||.95,top_p:m_tp||.8,penalty_score:m_ps||1,stream:!1,conversation_id:"conv-4_0",message:"",model:3,user_id:"7ffe3194-2bf0-48ba-8dbd-e888d7d556d3"}};$("#r-temperature").val(m_t);$("#temperature-val").val(m_t);$("#r-top_p").val(m_tp);$("#top_p-val").val(m_tp);$("#r-penalty_score").val(m_ps);$("#penalty_score-val").val(m_ps);$(".llm-model-config").html(`温度:${m_t};多样性:${m_tp};惩罚系数:${m_ps};`);$(".llm-range-picker").on("change",function(){let n=$(this),t=$(n).val(),i=$(n).data("sync-key");syncCurrentVal(i,t)});$(".btn-discard-llm-setting").on("click",function(){let i=$(this),n=$(i).data("val"),t=$(i).data("rel-key");console.log(n);console.log(t);$(`#r-${t}`).val(n);syncCurrentVal(t,n)});let sendBtnClickEventHandler=function(n){let t=$("#ipt-message").val();$("#ipt-message").val("");$(Object.keys(conversations)).each(function(n,i){var f=$("#chk-"+i).is(":checked");if(console.log(`MODEL: ${i} -> ${f}`),f){let e=Math.random().toString(36).slice(-8),r=conversations[i],o="#wrapper_"+i;r.message=t;r.conversation_id=`${r.conversation_id}_${e}`;let u=$(o);if(u){let s=dateFormat("HH:MM:SS",new Date),n=`rpl_${e}`,f;switch(i){case"ConvErnieTurbo":f="ernie_turbo";break;case"ConvErnie3_5":f="ernie_3_5";break;case"ConvErnie4_0":f="ernie_4_0"}const h=`