sg-paisou 0.0.1-beta.2 → 0.0.1-beta.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/ai-chat-sdk.es.js
CHANGED
|
@@ -64509,4 +64509,3 @@ export {
|
|
|
64509
64509
|
_Y as getImageUrl,
|
|
64510
64510
|
EY as hasImage
|
|
64511
64511
|
};
|
|
64512
|
-
//# sourceMappingURL=ai-chat-sdk.es.js.map
|
package/dist/ai-chat-sdk.umd.js
CHANGED
|
@@ -3199,4 +3199,3 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
3199
3199
|
transition: opacity 0.3s ease;
|
|
3200
3200
|
`,document.body.appendChild(e),requestAnimationFrame(()=>{e.style.opacity="1"}),setTimeout(()=>{e.style.opacity="0",setTimeout(()=>{document.body.contains(e)&&document.body.removeChild(e)},300)},2e3)},Qj={key:0,class:"dialogs"},dj={key:0,class:"insolubility-content"},pj=["src"],fj={class:"insolubility-content-text"},mj=["src"],hj={key:1,class:"feedback-dialog"},gj={class:"feedback-header"},_j=["src"],Ej={class:"feedback-content"},bj={class:"feedback-tags"},yj=["onClick"],vj=["disabled"],Sj=E4(V.defineComponent({__name:"Dialogs",props:{visible:{type:Boolean,default:!1},dialogType:{default:"insolubility"},feedbackType:{default:"angry"},currentLongPressMessageId:{default:""},subject_id:{default:""}},emits:["close","submit","tracking"],setup(r,{expose:e,emit:t}){const i=_3(),Q=r,p=t,T=lt.insolubilityIcon,d=lt.photographIcon,c=lt.feedbackThinkieImg,n=[{value:"wrong_answer",label:"Wrong answer"},{value:"difficult_to_understand",label:"Difficult to understand"},{value:"too_much_detail",label:"Too much detail"},{value:"poor_formatting",label:"Poor formatting"},{value:"lacks_detail",label:"Lacks detail"}],a=V.computed(()=>Q.feedbackType==="thumbsDown"?[...n,{value:"slow",label:"Slow"},{value:"wrong_explanation",label:"Wrong explanation"}]:n),s=V.ref([]),o=V.ref(""),u=V.computed(()=>s.value.length>0),l=()=>{s.value=[],o.value=""},m=()=>cG(),f=g=>{const y=s.value.indexOf(g);y>-1?s.value.splice(y,1):s.value.push(g)},h=()=>{l(),p("close")},E=g=>({wrong_answer:1,difficult_to_understand:2,too_much_detail:3,poor_formatting:4,lacks_detail:5,slow:6,wrong_explanation:7})[g]||0,_=async()=>{if(!u.value)return;const g=Q.feedbackType==="thumbsDown"?Q.subject_id:i.questionInfo.sessionId||"",y=s.value.map(v=>E(v));p("tracking",{eventName:"SnapThink_Result_Feedback",eventShowName:"结果页用户反馈",eventType:"click",feedback_source:Q.feedbackType==="thumbsDown"?1:2,feedback_type:1,feedback_tag:y.length>0?y:void 0,detail:o.value.trim()||void 0}),await K2({subject_id:g,tags:s.value,content:o.value.trim(),vote:"downvote"}),yd(),l(),p("close",Q.subject_id||"")};return e({handleClose:h,handleSubmit:_}),(g,y)=>r.visible?(V.openBlock(),V.createElementBlock("div",Qj,[r.dialogType==="insolubility"?(V.openBlock(),V.createElementBlock("div",dj,[V.createElementVNode("img",{src:V.unref(T),class:"insolubility-content-img",alt:""},null,8,pj),V.createElementVNode("div",fj,[y[2]||(y[2]=V.createElementVNode("span",null,"Oops, Sorry",-1)),y[3]||(y[3]=V.createElementVNode("span",{class:"insolubility-content-text-subtext"},"Thinkie can't explain this question.",-1)),V.createElementVNode("div",{class:"insolubility-content-button",onClick:m},[V.createElementVNode("img",{src:V.unref(d),alt:""},null,8,mj),y[1]||(y[1]=V.createElementVNode("span",null,"Snap another one",-1))])])])):V.createCommentVNode("",!0),r.dialogType==="feedback"?(V.openBlock(),V.createElementBlock("div",hj,[V.createElementVNode("div",gj,[V.createElementVNode("img",{src:V.unref(c),class:"feedback-robot-img",alt:"Feedback"},null,8,_j),V.createElementVNode("div",{class:"close-button",onClick:h},[...y[4]||(y[4]=[V.createElementVNode("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none"},[V.createElementVNode("path",{d:"M18 6L6 18M6 6L18 18",stroke:"#999999","stroke-width":"2.4","stroke-linecap":"round"})],-1)])])]),V.createElementVNode("div",Ej,[y[5]||(y[5]=V.createElementVNode("div",{class:"feedback-title"},"Problem Feedback",-1)),y[6]||(y[6]=V.createElementVNode("div",{class:"feedback-subtitle"},"Can you tell us what went wrong?",-1)),V.createElementVNode("div",bj,[(V.openBlock(!0),V.createElementBlock(V.Fragment,null,V.renderList(a.value,v=>(V.openBlock(),V.createElementBlock("div",{key:v.value,class:V.normalizeClass(["feedback-tag",{active:s.value.includes(v.value)}]),onClick:S=>f(v.value)},V.toDisplayString(v.label),11,yj))),128))]),V.withDirectives(V.createElementVNode("textarea",{"onUpdate:modelValue":y[0]||(y[0]=v=>o.value=v),class:"feedback-textarea",placeholder:"Tell us more how we can improve",rows:"5"},null,512),[[V.vModelText,o.value]]),V.createElementVNode("button",{class:V.normalizeClass(["feedback-submit",{disabled:!u.value}]),disabled:!u.value,onClick:_}," Submit ",10,vj)])])):V.createCommentVNode("",!0)])):V.createCommentVNode("",!0)}}),[["__scopeId","data-v-c11ba595"]]),Aj=["src","alt"],Lj=E4(V.defineComponent({__name:"ImagePreview",props:{visible:{type:Boolean},imageUrl:{},alt:{default:"预览图片"}},emits:["close"],setup(r,{emit:e}){const t=e,i=()=>{t("close")};return(Q,p)=>r.visible?(V.openBlock(),V.createElementBlock("div",{key:0,class:"image-preview-overlay",onClick:i},[V.createElementVNode("div",{class:"image-preview-container",onClick:p[0]||(p[0]=V.withModifiers(()=>{},["stop"]))},[V.createElementVNode("img",{src:r.imageUrl,alt:r.alt,class:"preview-image"},null,8,Aj)])])):V.createCommentVNode("",!0)}}),[["__scopeId","data-v-5465193a"]]);async function Cj(r,e){const t=r.getReader();let i;for(;!(i=await t.read()).done;)e(i.value)}function Dj(r){let e,t,i,Q=!1;return function(T){e===void 0?(e=T,t=0,i=-1):e=Oj(e,T);const d=e.length;let c=0;for(;t<d;){Q&&(e[t]===10&&(c=++t),Q=!1);let n=-1;for(;t<d&&n===-1;++t)switch(e[t]){case 58:i===-1&&(i=t-c);break;case 13:Q=!0;case 10:n=t;break}if(n===-1)break;r(e.subarray(c,n),i),c=t,i=-1}c===d?e=void 0:c!==0&&(e=e.subarray(c),t-=c)}}function xj(r,e,t){let i=vd();const Q=new TextDecoder;return function(T,d){if(T.length===0)t==null||t(i),i=vd();else if(d>0){const c=Q.decode(T.subarray(0,d)),n=d+(T[d+1]===32?2:1),a=Q.decode(T.subarray(n));switch(c){case"data":i.data=i.data?i.data+`
|
|
3201
3201
|
`+a:a;break;case"event":i.event=a;break;case"id":r(i.id=a);break;case"retry":const s=parseInt(a,10);isNaN(s)||e(i.retry=s);break}}}}function Oj(r,e){const t=new Uint8Array(r.length+e.length);return t.set(r),t.set(e,r.length),t}function vd(){return{data:"",event:"",id:"",retry:void 0}}var Mj=function(r,e){var t={};for(var i in r)Object.prototype.hasOwnProperty.call(r,i)&&e.indexOf(i)<0&&(t[i]=r[i]);if(r!=null&&typeof Object.getOwnPropertySymbols=="function")for(var Q=0,i=Object.getOwnPropertySymbols(r);Q<i.length;Q++)e.indexOf(i[Q])<0&&Object.prototype.propertyIsEnumerable.call(r,i[Q])&&(t[i[Q]]=r[i[Q]]);return t};const p0="text/event-stream",Nj=1e3,Sd="last-event-id";function Ad(r,e){var{signal:t,headers:i,onopen:Q,onmessage:p,onclose:T,onerror:d,openWhenHidden:c,fetch:n}=e,a=Mj(e,["signal","headers","onopen","onmessage","onclose","onerror","openWhenHidden","fetch"]);return new Promise((s,o)=>{const u=Object.assign({},i);u.accept||(u.accept=p0);let l;function m(){l.abort(),document.hidden||y()}c||document.addEventListener("visibilitychange",m);let f=Nj,h=0;function E(){document.removeEventListener("visibilitychange",m),window.clearTimeout(h),l.abort()}t==null||t.addEventListener("abort",()=>{E(),s()});const _=n??window.fetch,g=Q??Rj;async function y(){var v;l=new AbortController;try{const S=await _(r,Object.assign(Object.assign({},a),{headers:u,signal:l.signal}));await g(S),await Cj(S.body,Dj(xj(b=>{b?u[Sd]=b:delete u[Sd]},b=>{f=b},p))),T==null||T(),E(),s()}catch(S){if(!l.signal.aborted)try{const b=(v=d==null?void 0:d(S))!==null&&v!==void 0?v:f;window.clearTimeout(h),h=window.setTimeout(y,b)}catch(b){E(),o(b)}}}y()})}function Rj(r){const e=r.headers.get("content-type");if(!(e!=null&&e.startsWith(p0)))throw new Error(`Expected content-type to be ${p0}, Actual: ${e}`)}class wj{constructor(){u1(this,"audioQueue",[]);u1(this,"currentAudio",null);u1(this,"isPlaying",!1);u1(this,"isMuted",!1);u1(this,"manualPlayAudio",null);u1(this,"manualPlayMessageId",null);u1(this,"autoPlayMessageId",null);u1(this,"autoPlayCallbacks",{});u1(this,"currentAbortController",null);u1(this,"isStreamComplete",!0);u1(this,"isCleared",!1);u1(this,"manualPlayAbortController",null);u1(this,"manualPlayRequestId",null)}addAudio(e){if(this.isMuted||this.isCleared){console.log("[TTS] Skipping audio add - player is muted or cleared");return}const t=new Audio(URL.createObjectURL(e));this.audioQueue.push(t),!this.isPlaying&&!this.isMuted&&!this.isCleared&&this.playNext()}playNext(){if(this.audioQueue.length===0||this.isMuted||this.isCleared){this.isPlaying&&this.isStreamComplete&&this.autoPlayCallbacks.onEnd&&!this.isCleared&&(this.autoPlayCallbacks.onEnd(),this.autoPlayCallbacks={}),this.isPlaying=!1,this.currentAudio=null,this.autoPlayMessageId=null;return}const e=!this.isPlaying;this.isPlaying=!0,e&&this.autoPlayCallbacks.onStart&&this.autoPlayCallbacks.onStart(),this.currentAudio=this.audioQueue.shift(),this.currentAudio.onended=()=>{this.currentAudio&&URL.revokeObjectURL(this.currentAudio.src),this.playNext()},this.currentAudio.onerror=t=>{this.currentAudio&&URL.revokeObjectURL(this.currentAudio.src),this.playNext()},this.currentAudio.play().catch(t=>{this.currentAudio&&URL.revokeObjectURL(this.currentAudio.src),this.playNext()})}setMuted(e){this.isMuted=e,e&&(this.currentAudio&&(this.currentAudio.pause(),this.currentAudio.currentTime=0,URL.revokeObjectURL(this.currentAudio.src),this.currentAudio=null),this.audioQueue.length,this.audioQueue.forEach(t=>{URL.revokeObjectURL(t.src)}),this.audioQueue=[],this.isPlaying=!1)}clear(){console.log("[TTS] clear() called - stopping all TTS operations"),this.isCleared=!0,this.currentAbortController&&(console.log("[TTS] Aborting ongoing SSE request"),this.currentAbortController.abort(),this.currentAbortController=null),this.currentAudio&&(console.log("[TTS] Stopping current audio playback"),this.currentAudio.pause(),this.currentAudio.currentTime=0,URL.revokeObjectURL(this.currentAudio.src),this.currentAudio=null,this.autoPlayCallbacks.onEnd&&this.autoPlayCallbacks.onEnd());const e=this.audioQueue.length;e>0&&(console.log(`[TTS] Clearing ${e} audio(s) from queue`),this.audioQueue.forEach(t=>{URL.revokeObjectURL(t.src)})),this.audioQueue=[],this.isPlaying=!1,this.autoPlayMessageId=null,this.autoPlayCallbacks={},this.isStreamComplete=!0,this.manualPlayAudio&&(console.log("[TTS] Stopping manual playback"),this.manualPlayAudio.pause(),this.manualPlayAudio.currentTime=0,URL.revokeObjectURL(this.manualPlayAudio.src),this.manualPlayAudio=null),this.manualPlayMessageId=null,console.log("[TTS] clear() completed - all TTS operations stopped")}destroy(){this.clear(),this.isMuted=!1}playManual(e,t,i,Q,p){if(console.log("[TTS] playManual called for message:",t,"requestId:",i),i&&i!==this.manualPlayRequestId){console.log("[TTS] Manual play request cancelled (requestId mismatch):",i,"vs",this.manualPlayRequestId),p==null||p();return}this.manualPlayAudio&&(this.manualPlayAudio.pause(),URL.revokeObjectURL(this.manualPlayAudio.src),this.manualPlayAudio=null),this.currentAudio&&this.isPlaying&&this.currentAudio.pause(),t&&(this.manualPlayMessageId=t),this.manualPlayAudio=new Audio(URL.createObjectURL(e)),console.log("[TTS] Manual audio created, calling onStart"),Q==null||Q(),this.manualPlayAudio.onended=()=>{console.log("[TTS] Manual audio ended"),this.manualPlayAudio&&URL.revokeObjectURL(this.manualPlayAudio.src),this.manualPlayAudio=null,this.manualPlayMessageId=null,this.manualPlayRequestId=null,p==null||p(),this.currentAudio&&this.isPlaying&&!this.isMuted&&this.currentAudio.play().catch(T=>{this.playNext()})},this.manualPlayAudio.onerror=T=>{console.error("[TTS] Manual audio error:",T),this.manualPlayAudio&&URL.revokeObjectURL(this.manualPlayAudio.src),this.manualPlayAudio=null,this.manualPlayMessageId=null,this.manualPlayRequestId=null,p==null||p()},console.log("[TTS] Starting manual audio playback"),this.manualPlayAudio.play().then(()=>{console.log("[TTS] Manual audio playing successfully")}).catch(T=>{console.error("[TTS] Failed to play manual audio:",T),this.manualPlayRequestId=null,p==null||p()})}cancelManualPlayRequest(e){console.log("[TTS] cancelManualPlayRequest called for:",e),this.manualPlayAbortController&&(console.log("[TTS] Aborting manual play request"),this.manualPlayAbortController.abort(),this.manualPlayAbortController=null),this.manualPlayRequestId=null,this.manualPlayAudio&&(!e||this.manualPlayMessageId===e)&&(this.manualPlayAudio.pause(),URL.revokeObjectURL(this.manualPlayAudio.src),this.manualPlayAudio=null,this.manualPlayMessageId=null)}setManualPlayRequestId(e){this.manualPlayRequestId=e}setManualPlayAbortController(e){this.manualPlayAbortController=e}stopManual(e){e&&this.manualPlayMessageId!==e||this.manualPlayAudio&&(this.manualPlayAudio.pause(),URL.revokeObjectURL(this.manualPlayAudio.src),this.manualPlayAudio=null,this.manualPlayMessageId=null,this.currentAudio&&this.isPlaying&&!this.isMuted&&this.currentAudio.play().catch(t=>{this.playNext()}))}isManualPlaying(e){return this.manualPlayMessageId===e&&this.manualPlayAudio!==null}setAbortController(e){this.currentAbortController=e}}const rt=new wj,Ld=async(r,e,t,i,Q)=>{const T=_3().questionInfo,d=d0();return new Promise((c,n)=>{let a=null,s=!1,o=!1,u=!1;const l=Q||new AbortController;i&&rt.setAbortController(l),l.signal.addEventListener("abort",()=>{u||(o=!0,console.log("[TTS fetchTTSAudio] Request aborted"))});let m=0,f=0;const h=new Map,E=()=>{if(i&&(o&&!u||rt.isCleared)){h.clear();return}for(;h.has(f);){const _=h.get(f);h.delete(f),i?i(_):a||(a=_,s||(s=!0,console.log("[TTS fetchTTSAudio] Resolving with first audio blob for manual play"),c(a),l.abort(),rt.setAbortController(null))),f++}};Ad(`${T0[T.envNumber||0]}/v1/sg/tts`,{method:"POST",signal:l.signal,headers:{"Content-Type":"application/json",...d},body:JSON.stringify({session_id:r,session_detail_id:e,text:t}),onopen:async _=>{_.ok||n(new Error(`TTS request failed: ${_.status} ${_.statusText}`))},onmessage:async _=>{try{const g=JSON.parse(_.data||"{}");if(g.event==="audio-url"&&g.data){const y=g.data,v=m++;fetch(y).then(async S=>{if(i&&rt.isCleared){console.log(`[TTS] Audio chunk #${v} downloaded but player is cleared (auto-play), discarding`);return}if(S.ok){const b=await S.blob();if(console.log(`[TTS] Audio chunk #${v} downloaded, size: ${b.size}`),i&&rt.isCleared){console.log(`[TTS] Audio chunk #${v} blob ready but player is cleared (auto-play), discarding`);return}h.set(v,b),E()}}).catch(S=>{console.error(`[TTS] Failed to fetch audio chunk #${v}:`,S)})}else g.event==="finish"&&(u=!0)}catch(g){console.warn("[TTS] Failed to parse SSE message:",_.data,g)}},onerror:_=>{l.abort(),i&&rt.setAbortController(null),n(_)},onclose:()=>{i&&rt.setAbortController(null),!s&&(i?c():a?c(a):n(new Error("No audio received from TTS service")))},openWhenHidden:!0}).catch(n)})},Cd=async(r,e,t,i,Q,p,T,d)=>{if(!(i||!t.trim()&&!Q)){rt.isCleared=!1,p&&(rt.autoPlayMessageId=p),(T||d)&&(rt.autoPlayCallbacks={onStart:T,onEnd:d}),Q&&(rt.isStreamComplete=!1);try{await Ld(r,e,t,c=>{rt.addAudio(c)}),Q&&(rt.isStreamComplete=!0,rt.audioQueue.length===0&&(rt.isPlaying?rt.playNext():rt.autoPlayCallbacks.onEnd&&!rt.isCleared&&(rt.autoPlayCallbacks.onEnd(),rt.autoPlayCallbacks={},rt.autoPlayMessageId=null)))}catch{Q&&(rt.isStreamComplete=!0),d&&d()}}},Ij=async(r,e,t,i,Q)=>{const p=`${e}_${Date.now()}`;if(console.log("[TTS] playMessageTTS called:",{sessionId:r,messageId:e,textLength:t==null?void 0:t.length,requestId:p}),!(t!=null&&t.trim())){console.log("[TTS] No text to play, calling onEnd"),Q==null||Q();return}rt.setManualPlayRequestId(p);try{console.log("[TTS] Fetching TTS audio...");const T=new AbortController;rt.setManualPlayAbortController(T);const d=await Ld(r,e,t,void 0,T);if(console.log("[TTS] Audio blob received, size:",d.size,"requestId:",p),rt.setManualPlayAbortController(null),rt.manualPlayRequestId!==p){console.log("[TTS] Request was cancelled during fetch, not playing"),Q==null||Q();return}if(!d||d.size===0){console.error("[TTS] Invalid audio blob"),Q==null||Q();return}rt.playManual(d,e,p,i,Q)}catch(T){console.error("[TTS] playMessageTTS error:",T),rt.setManualPlayAbortController(null),(T==null?void 0:T.name)==="AbortError"?console.log("[TTS] Request aborted by user"):Q==null||Q()}},Hj=r=>{rt.cancelManualPlayRequest(r),rt.stopManual(r)};function Fj(){const r=V.ref([]),e=V.ref(),t=c=>r.value.find(n=>n.id===c),i=c=>{r.value.push(c),V.nextTick(()=>d())},Q=(c,n)=>{i({id:`ai_${Date.now()}`,type:"ai",content:c,options:n,timestamp:Date.now()})},p=(c,n)=>{if(!c){console.error("Missing content for user message");return}const a=`user_${Date.now()}`;return i({id:a,type:"user",content:c,options:n,timestamp:Date.now(),sendStatus:"pending"}),a},T=()=>{r.value=[]},d=()=>{e.value&&(e.value.scrollTop=e.value.scrollHeight)};return{messages:r,messagesContainer:e,findMessage:t,addMessage:i,addAIMessage:Q,addUserMessage:p,clearMessages:T,scrollToBottom:d}}const f0=new AbortController,kj=f0.signal,Pj=(r,e,t,i,Q)=>{const p=e.hash;return{startSSE:async()=>{await Ad(r,{method:i,signal:kj,headers:{"Content-Type":"application/json",...t},body:JSON.stringify(e),onopen:async d=>{var c,n;d.ok?(n=Q.onopen)==null||n.call(Q):(c=Q.onerror)==null||c.call(Q,d.statusText)},onmessage:d=>{var c,n,a,s;try{if(d.event==="finish")(c=Q.onmessage)==null||c.call(Q,{type:d.event}),(n=Q.onclose)==null||n.call(Q);else{const o=JSON.parse(d.data||"{}");(a=Q.onmessage)==null||a.call(Q,e.hash?{...o,hash:p,type:d.event}:{...o,type:d.event})}}catch(o){(s=Q.onerror)==null||s.call(Q,o)}},onerror:d=>{var c;throw f0.abort(),(c=Q.onerror)==null||c.call(Q,d),new Error(`error->e: ${d}`)},openWhenHidden:!0,onclose:()=>{var d;(d=Q.onclose)==null||d.call(Q)}})},abortCtrl:f0}},Bj=(r,e,t,i)=>{const p=_3().questionInfo,T=d0(),{startSSE:d,abortCtrl:c}=Pj(`${T0[p.envNumber||0]}/v1/sg/explain-question`,{session_id:r.session_id,content:r.content,recommend_questions:r.recommend_questions||!1},T,"POST",{onmessage:n=>{e(n)},onerror(n){t(n)},onclose(){i()}});return{startSSE:d,abort:()=>c.abort()}};function Vj(r,e,t,i){const Q=V.ref(null),p=V.ref(!0),T=V.ref(""),d=V.ref(null),c=()=>{if(!T.value)return;Q.value&&(Q.value(),Q.value=null);const s=i.value.findIndex(u=>u.id===T.value);s!==-1&&i.value.splice(s,1),rt.clear();const o={id:`error_${Date.now()}`,type:"ai",content:"",isNetworkError:!0,showRetryButton:!0,timestamp:Date.now()};e(o),T.value="",p.value=!1},n=()=>{if(!d.value)return;const s=i.value.findIndex(u=>u.isNetworkError);s!==-1&&i.value.splice(s,1);const o=d.value;a(o.content,o.sessionId,o.isSoundOn,o.currentSessionId,o.isFollowUp,o.userMessageId)};V.onMounted(()=>{window.addEventListener("offline",c)}),V.onBeforeUnmount(()=>{window.removeEventListener("offline",c)});const a=(s,o,u,l,m=!1,f,h)=>{if(!o){if(console.error("Missing session_id for streaming"),f){const C=r(f);C&&(C.sendStatus="failed")}return}if(!s)return;if(!navigator.onLine){if(console.error("[SSE] 无网络连接"),f){const C=r(f);C&&(C.sendStatus="failed")}return}d.value={content:s,sessionId:o,isSoundOn:u,currentSessionId:l,isFollowUp:m,userMessageId:f,isFollowUpQuestion:h},p.value=!0;const E=`ai_${Date.now()}`;T.value=E;let _=!1;const g={id:E,type:"ai",content:"",showFeedbackAndContinue:!1,isStreaming:!0,timestamp:Date.now()};e(g),V.nextTick(()=>t());const y=()=>{const C=r(E);if(!C||T.value!==E)return;C.isStreaming=!1;const D=i.value.findIndex(O=>O.id===E);D!==-1&&i.value.splice(D,1),rt.clear();const x={id:`error_${Date.now()}`,type:"ai",content:"",isNetworkError:!0,showRetryButton:!0,timestamp:Date.now()};e(x),T.value="",Q.value=null,p.value=!1,V.nextTick(()=>t())},v=C=>{const D=r(E);if(D){if(C.event==="finish")D.isStreaming=!1,h?(D.showFeedbackOnly=!0,D.showFeedbackAndContinue=!1):(D.showFeedbackAndContinue=!0,D.showFeedbackOnly=!1),Q.value=null,T.value="",p.value=!1;else if(C.event==="recommendQuestion")D.isStreaming=!1,D.showCompletionSection=!0,D.showFeedbackAndContinue=!1,D.showFeedbackOnly=!1,m=!0,C.data&&(D.followUpQuestions=JSON.parse(C.data)),Q.value=null,T.value="",p.value=!1;else if(C.event==="add"){const x=typeof C.data=="string"?C.data:C.data.content||"";if(D.content+=x,x&&u&&!_){_=!0;const O=C.msg_id;Cd(l||o,O,"",!u,!0,E,()=>{const M=r(E);M&&(M.isPlayingTTS=!0)},()=>{const M=r(E);M&&(M.isPlayingTTS=!1)}).catch(M=>console.error("TTS playback error:",M))}}V.nextTick(()=>t())}},S=C=>{console.error("SSE Error:",C),y()},b=()=>{y()},{startSSE:A,abort:L}=Bj({session_id:l||o,content:s,recommend_questions:h},v,S,b);Q.value=L,A()};return{currentStreamAbort:Q,isAIResponding:p,sendStreamMessage:a,retryStreamMessage:n}}function Gj(r,e){const t=V.ref(!1),i=V.ref("insolubility"),Q=V.ref("angry"),p=V.ref(!1),T=V.ref({top:0,left:0,showAbove:!1}),d=V.ref(null),c=V.ref(""),n=V.ref(!1),a=V.ref("");let s=null;const o=()=>r(c.value),u=(_,g)=>{s=setTimeout(()=>m(_,g),500)},l=()=>{s&&(clearTimeout(s),s=null)},m=(_,g)=>{var N;const v=_.target.closest(".message-content");if(!v)return;const S=v.getBoundingClientRect(),b=176,A=60,L=(N=e.value)==null?void 0:N.getBoundingClientRect(),C=(L==null?void 0:L.top)||0,D=(L==null?void 0:L.bottom)||window.innerHeight;let x=S.bottom>window.innerHeight/2,O=x?S.top-A:S.bottom+5;x&&O<C&&(O=C+10),!x&&O+A>D&&(O=D-A-10);const M=S.left+S.width/2-b/2;T.value={top:O,left:Math.max(10,Math.min(M,window.innerWidth-b-10)),showAbove:x},d.value=g,c.value=g.id,p.value=!0};return{isDialogVisible:t,dialogType:i,feedbackType:Q,showMessageFeedback:p,feedbackPosition:T,currentLongPressMessage:d,currentLongPressMessageId:c,isDownVoted:n,subject_id:a,getCurrentMessage:o,handleLongPressStart:u,handleLongPressEnd:l,showFeedbackPopup:m,closeFeedbackPopup:()=>{p.value=!1,t.value||(c.value="")},handleMessageFeedback:async(_,g,y,v)=>{const S=g.id||c.value,b=r(S);if(_==="volume"||_==="volumeing"){if(!b)return;rt.clear(),b.isPlayingTTS?(Hj(S),b.isPlayingTTS=!1):(b.isPlayingTTS=!0,await Ij(v||y,S,b.content,()=>{},()=>{b&&(b.isPlayingTTS=!1)}))}else if(_==="upvote")b&&(b.vote="upvote"),await K2({subject_id:g.detail_id,vote:"upvote"});else if(_==="downvote"){if(g.isDownvote===1){b&&(b.vote="downvote"),await K2({subject_id:g.detail_id,vote:"downvote"});return}t.value=!0,i.value="feedback",Q.value="thumbsDown",c.value=S,a.value=g.detail_id}},handleClose:_=>{if(_){const g=r(_);g&&(g.vote="downvote",g.isDownvote=1),Q.value==="angry"&&(n.value=!0)}t.value=!1}}}function Uj(r,e){const t=V.ref(""),i=V.ref(!1);return{currentSessionId:t,isOverSevenDays:i,loadHistoryMessages:async(p,T,d)=>{var c;if(!(p!=null&&p.session_id))return console.warn("[History] No session_id found"),{messages:[],isQuickReply:!1};try{t.value=p.session_id,i.value=p.isOverSevenDays===1;const n=await cj(p.session_id),a=((c=n==null?void 0:n.data)==null?void 0:c.session_details)||[],s=[];if((p==null?void 0:p.pkgName)==="SGpaisou"){s.push({id:`user_${Date.now()}_1`,type:"user",content:(T==null?void 0:T.couldYouHelp)||"",timestamp:Date.now(),disableLongPress:!0});const o=(p==null?void 0:p.imgUrl)||(p==null?void 0:p.imagePath);o&&s.push({id:`user_${Date.now()}_2`,type:"user",content:"",imageUrl:o,timestamp:Date.now(),disableLongPress:!0}),s.push({id:d,type:"ai",content:(T==null?void 0:T.pleaseConfirm)||"",showButtons:!1,isTyping:!1,timestamp:Date.now(),disableLongPress:!0}),s.push({id:`ai_${Date.now()}_content`,type:"ai",content:(p==null?void 0:p.content)||(p==null?void 0:p.orc_text)||"",showButtons:!(a.length>0),isTyping:!1,timestamp:Date.now(),disableLongPress:!0})}return a.forEach((o,u)=>{const m=u===a.length-1&&o.sender_id==="system",f=o.category,h=o.sender_id==="system";s.push({id:o.id,detail_id:o.detail_id,session_id:o.session_id,type:h?"ai":"user",sender_id:o.sender_id,content:o.content,msg_type:o.msg_type,created_at:o.created_at,updated_at:o.updated_at,audio_urls:o.audio_urls,vote:o.vote,is_vote:o.is_vote,timestamp:new Date(o.created_at).getTime(),disableLongPress:!h,showFeedbackAndContinue:m&&!f&&!i.value,showCompletionSection:m&&f,category:o.category,followUpQuestions:f?JSON.parse(o.content):[]})}),s.forEach(o=>r(o)),V.nextTick(()=>e()),{messages:s,isQuickReply:!0}}catch(n){return console.error("[History] Failed to load history messages:",n),{messages:[],isQuickReply:!1}}}}}class jj{constructor(e){u1(this,"words");u1(this,"currentIndex",0);u1(this,"timer",null);u1(this,"options");this.options={wordDelay:1e3,...e},this.words=this.options.text.split(/(\s+)/)}start(){this.displayNextWord()}displayNextWord(){if(this.currentIndex>=this.words.length){this.options.onComplete();return}const e=this.words.slice(0,this.currentIndex+1).join("");this.options.onUpdate(e),this.currentIndex++,this.timer=window.setTimeout(()=>{this.displayNextWord()},this.options.wordDelay)}stop(){this.timer&&(clearTimeout(this.timer),this.timer=null)}skip(){this.stop();const e=this.words.join("");this.options.onUpdate(e),this.options.onComplete()}}function qj(r,e,t){const i=V.ref(null);return{currentTypewriter:i,typeAIMessage:(p,T,d)=>{if(!p){console.error("Missing content for typing message");return}const c=`ai_${Date.now()}`,n={id:c,type:"ai",content:"",isTyping:!0,timestamp:Date.now(),disableLongPress:d||!1};r(n),V.nextTick(()=>t()),i.value=new jj({text:p,wordDelay:10,onUpdate:a=>{const s=e(c);s&&(s.content=a,V.nextTick(()=>t()))},onComplete:()=>{const a=e(c);a&&(a.isTyping=!1),i.value=null,T==null||T()}}),i.value.start()}}}function Yj(r,e,t,i){const Q=V.ref(""),p=V.ref(!1),T=V.ref(!1);return{questionConfirmMessageId:Q,isQuickReply:p,initNormalQuestionFlow:(n,a,s,o,u,l,m,f)=>{const h=(n==null?void 0:n.question_type)===0||(n==null?void 0:n.question_type)==="0";if(n!=null&&n.historyType){u().then(_=>{_&&(p.value=_.isQuickReply),f==null||f(!1)});return}const E={id:`user_${Date.now()}`,type:"user",content:(a==null?void 0:a.couldYouHelp)||"",timestamp:Date.now()};r(E),V.nextTick(()=>t()),setTimeout(()=>{const _=(n==null?void 0:n.imgUrl)||(n==null?void 0:n.imagePath);if(_){const g={id:`user_${Date.now()}`,type:"user",content:"",imageUrl:_,timestamp:Date.now()};r(g),V.nextTick(()=>t())}if(h){m("insolubility"),l(!0);return}setTimeout(()=>{const g=`ai_confirm_${Date.now()}`;i((a==null?void 0:a.pleaseConfirm)||"",()=>{!(n!=null&&n.historyType)&&!T.value&&s&&(T.value=!0,Cd(o||n.session_id,g,(a==null?void 0:a.pleaseConfirm)||"",!s).catch(y=>console.error("TTS playback error:",y))),setTimeout(()=>{const y=(n==null?void 0:n.content)||(n==null?void 0:n.orc_text)||"Question text here";Q.value=`ai_${Date.now()}`;const v={id:Q.value,type:"ai",content:y,showButtons:!0,isTyping:!1,timestamp:Date.now(),disableLongPress:!0};r(v),V.nextTick(()=>t())},50)},!0)},50)},10)},handleExplainAgain:async(n,a,s,o,u,l,m,f)=>{try{a();const h=await bd({question_id:n.question_id,content:n.content,orc_text:n.orc_text,image_path:n.image_path||n.imgUrl});if(h!=null&&h.data){const E=h.data.session_id||h.data.sessionId;l(E),s(!1),o(!1),u(!0),m({...h.data,session_id:E}),f()}}catch(h){console.error("[ExplainAgain] Failed to restart session:",h)}}}}function zj(){const r=V.ref(!1),e=V.ref(0),t=V.ref(0),i=()=>{if(!window.visualViewport)return;const p=window.visualViewport.height;t.value===0&&(t.value=p);const T=t.value-p;T>50?(r.value=!0,e.value=T):(r.value=!1,e.value=0)};return V.onMounted(()=>{window.visualViewport&&(t.value=window.visualViewport.height,window.visualViewport.addEventListener("resize",i),window.visualViewport.addEventListener("scroll",i)),window.addEventListener("resize",i)}),V.onUnmounted(()=>{window.visualViewport&&(window.visualViewport.removeEventListener("resize",i),window.visualViewport.removeEventListener("scroll",i)),window.removeEventListener("resize",i)}),{isKeyboardVisible:r,keyboardHeight:e}}const Wj={class:"ai-avatar"},Zj=["src","alt"],Kj={class:"ai-info"},Xj=["src","alt"],Jj={key:0,class:"message-wrapper"},$j={key:0,class:"network-error-message"},eq=["src"],tq=["onTouchstart","onMousedown"],rq={class:"message-text-wrapper"},nq=["innerHTML"],aq={key:0,class:"typing-indicator"},iq={key:0,class:"message-buttons"},oq={key:1,class:"feedback-actions-only"},sq=["src","onClick","alt"],lq=["src","onClick","alt"],uq=["src","onClick","alt"],cq={key:2,class:"feedback-and-continue"},Tq={class:"feedback-actions"},Qq=["src","onClick","alt"],dq=["src","onClick","alt"],pq=["src","onClick","alt"],fq=["disabled","onClick"],mq={key:1,class:"message-wrapper user-message-wrapper"},hq=["onClick"],gq=["src"],_q={key:0,class:"message-image"},Eq=["src","onClick"],bq=["innerHTML"],yq={key:1,class:"options"},vq=["innerHTML"],Sq={class:"message-avatar user-avatar"},Aq=["src","alt"],Lq={key:2,class:"completion-section"},Cq={class:"helpful-section"},Dq={class:"helpful-text"},xq=["src","alt"],Oq=["src","alt"],Mq={key:0,class:"follow-up-questions"},Nq=["onClick"],Rq=["src"],wq=["innerHTML"],Iq=["src"],Hq=["src"],Fq={class:"popup-buttons"},kq=["src","alt"],Pq=["src","alt"],Bq=["src","alt"],Vq=["onClick","disabled"],Gq=["src"],Uq={class:"input-container"},jq=["placeholder","disabled"],qq=["title"],Yq=["src","alt"],zq=["src"],Wq={key:1,class:"loading-rotate"},Zq=["src"],Dd=E4(V.defineComponent({__name:"AIChatComponent",props:{config:{default:()=>({})},questionInfo:{default:()=>({})}},emits:["messageSend","feedback","muteToggle","not-my-question","snap-another","session-updated","tracking","question-data-updated"],setup(r,{expose:e,emit:t}){const i=r,Q=t,p=V.ref(!0),T=V.ref(""),d=V.ref(!1),c=V.ref(!1),n=V.ref(""),a=_3(),s=V.ref(),o=V.computed(()=>a.questionInfo&&Object.keys(a.questionInfo).length>0?a.questionInfo:i.questionInfo&&Object.keys(i.questionInfo).length>0?(a.updateQuestionInfo(i.questionInfo),a.questionInfo):a.questionInfo||{}),u=V.computed(()=>_4(i.config)),l=V.computed(()=>jh(i.config)),m=V.computed(()=>qh(_4(i.config))),f=V.computed(()=>Yh(_4(i.config))),h=V.computed(()=>zh(_4(i.config))),E=V.computed(()=>Wh()),_=V.computed(()=>Zh()),g=V.computed(()=>Kh(u.value)),y=V.computed(()=>Xh(u.value)),v=V.computed(()=>Jh(u.value)),S=V.computed(()=>{var te;return d.value?"Generating speech from text...":ke.value?"Feel free to ask Thinkie any questions":((te=u.value.input)==null?void 0:te.placeholder)||Ge.input.placeholder}),b=V.computed(()=>L.value.some(te=>te.showCompletionSection)),A=V.computed(()=>L.value.some(te=>te.showFeedbackOnly||te.followUpQuestions&&te.followUpQuestions.length>0)),{messages:L,messagesContainer:C,findMessage:D,addMessage:x,addAIMessage:O,addUserMessage:M,clearMessages:N,scrollToBottom:R}=Fj(),{typeAIMessage:w}=qj(x,D,R),{currentSessionId:k,isOverSevenDays:B,loadHistoryMessages:j}=Uj(x,R),{isAIResponding:H,sendStreamMessage:F,retryStreamMessage:I}=Vj(D,x,R,L),{isDialogVisible:P,dialogType:U,feedbackType:z,showMessageFeedback:Y,feedbackPosition:Z,currentLongPressMessage:ne,currentLongPressMessageId:Te,isDownVoted:ue,subject_id:fe,getCurrentMessage:Qe,handleLongPressStart:ve,handleLongPressEnd:ge,closeFeedbackPopup:he,handleMessageFeedback:Se,handleClose:Me}=Gj(D,s),{questionConfirmMessageId:xe,isQuickReply:ke,initNormalQuestionFlow:nt}=Yj(x,D,R,w),{isKeyboardVisible:qe,keyboardHeight:Ze}=zj(),Ue=te=>Bh(te),G=()=>{var te,$;p.value=!p.value,rt.setMuted(!p.value),($=(te=u.value.muteButton)==null?void 0:te.onClick)==null||$.call(te,p.value)},q=()=>{var te,$,de;if(!(H.value||B.value&&((te=o.value)!=null&&te.historyType))&&T.value.trim()){rt.clear();const se=L.value.findIndex(He=>He.isNetworkError);se!==-1&&L.value.splice(se,1);for(let He=L.value.length-1;He>=0;He--)if(L.value[He].type==="ai"){L.value[He].showFeedbackAndContinue=!1,L.value[He].showFeedbackOnly=!1,L.value[He].showCompletionSection=!1,L.value[He].category=0;break}const Ne=T.value.trim(),Ae=M(Ne);T.value="",(de=($=u.value.input)==null?void 0:$.onSend)==null||de.call($,Ne),setTimeout(()=>F(Ne,o.value.session_id,p.value,k.value,!1,Ae,b.value||A.value),300)}},W=()=>{var te;H.value||B.value&&((te=o.value)!=null&&te.historyType)||(rt.clear(),Q("messageSend","voice",""),d.value=!0)},X=te=>{var de,se;d.value=!1;const $=te==null?void 0:te.content;$.trim()&&((se=(de=u.value.input)==null?void 0:de.onSend)==null||se.call(de,$),T.value=$)},ie=()=>{d.value=!1},Ee=te=>{if(te.isRotating)return;te.isRotating=!0;const $=L.value.findIndex(de=>de.isNetworkError);$!==-1&&L.value.splice($,1),setTimeout(()=>{te.isRotating=!1,te.sendStatus="pending",setTimeout(()=>F(te.content,o.value.session_id,p.value,k.value,!1,te.id),300)},600)},re=te=>{rt.clear();const $=L.value.findIndex(se=>se.isNetworkError);$!==-1&&L.value.splice($,1);for(let se=L.value.length-1;se>=0;se--)if(L.value[se].type==="ai"){L.value[se].showFeedbackAndContinue=!1,L.value[se].showFeedbackOnly=!1,L.value[se].showCompletionSection=!1,L.value[se].category=0;break}const de=D(te);de&&(de.showFeedbackAndContinue=!1,de.isPlayingTTS=!1,de.showCompletionSection=!1),M("Continue"),setTimeout(()=>F("Continue",o.value.session_id,p.value,k.value),300)},_e=te=>{rt.clear();const $=L.value.findIndex(se=>se.isNetworkError);$!==-1&&L.value.splice($,1);for(let se=L.value.length-1;se>=0;se--)if(L.value[se].type==="ai"){L.value[se].showFeedbackAndContinue=!1,L.value[se].showFeedbackOnly=!1,L.value[se].showCompletionSection=!1,L.value[se].category=0;break}const de=M(te);setTimeout(()=>F(te,o.value.session_id,p.value,k.value,!1,de,b.value||A.value),300)},pe=(te,$)=>{rt.clear();const de=L.value.findIndex(Ae=>Ae.isNetworkError);de!==-1&&L.value.splice(de,1);for(let Ae=L.value.length-1;Ae>=0;Ae--)if(L.value[Ae].type==="ai"){L.value[Ae].showFeedbackAndContinue=!1,L.value[Ae].showFeedbackOnly=!1,L.value[Ae].showCompletionSection=!1,L.value[Ae].category=0;break}const se=D($);se&&(se.showCompletionSection=!1);const Ne=M(te);setTimeout(()=>F(te,o.value.session_id,p.value,k.value,!1,Ne,!0),300)},at=()=>{rt.clear(),Q("snap-another")},Ke=()=>{rt.clear(),N();const te=IQ(),$="session_"+Ed.MD5(te).toString();k.value=$,B.value=!1,ke.value=!1,H.value=!0,Q("session-updated",{session_id:$,sessionId:$});const de=M("Explain Again");setTimeout(()=>{F("Explain Again",$,p.value,k.value,!1,de,!1)},300)},Tt=()=>{const te=L.value.findIndex(se=>se.isNetworkError);te!==-1&&L.value.splice(te,1);const $=D(xe.value);$&&($.showButtons=!1),H.value=!1;const de=y.value.startExplaining;M(de),setTimeout(()=>F(de,o.value.session_id,p.value,k.value),300),ke.value=!0},ze=async()=>{var te;ae({eventName:"SnapThink_Notmyquestion_Click",eventShowName:"题目有误反馈点击",eventType:"click"}),await K2({subject_id:(te=o.value)==null?void 0:te.session_id,question:"Not my question"}),yd()},At=async te=>{var $,de;if(te==="upvote")ae({eventName:"SnapThink_Result_Feedback",eventShowName:"结果页用户反馈",eventType:"click",feedback_source:2,feedback_type:0}),await K2({subject_id:($=o.value)==null?void 0:$.session_id,vote:"upvote"});else if(te==="downvote"){if(ue.value){await K2({subject_id:(de=o.value)==null?void 0:de.session_id,vote:"downvote"});return}P.value=!0,U.value="feedback",z.value="angry"}},Ye=(te,$)=>{te==="upvote"&&ae({eventName:"SnapThink_Result_Feedback",eventShowName:"结果页用户反馈",eventType:"click",feedback_source:1,feedback_type:0}),Se(te,$,o.value.session_id,k.value)},dt=async(te,$)=>{var de,se;if(te){if(te==="upvote")await K2({subject_id:(de=o.value)==null?void 0:de.session_id,vote:"upvote"});else if(te==="downvote"){if($){await K2({subject_id:(se=o.value)==null?void 0:se.session_id,vote:"downvote"});return}P.value=!0,U.value="feedback",z.value="angry"}}},p1=te=>{n.value=te,c.value=!0},o1=()=>{c.value=!1,n.value=""},Le=()=>{setTimeout(()=>R(),100)},Oe=te=>te.pkgName!=="SGpaisou"&&te.snapThinkSource==="correctionNotebook"?5:te.pkgName!=="SGpaisou"&&te.snapThinkSource==="history"?4:te.favorite===1?3:te.isOverSevenDays===0||te.isOverSevenDays?2:1,ae=te=>{var de,se,Ne,Ae,He,pt,Xe;const $={question_id:((de=o.value)==null?void 0:de.question_id)||((se=o.value)==null?void 0:se.questionId)||"",question_url:((Ne=o.value)==null?void 0:Ne.imagePath)||((Ae=o.value)==null?void 0:Ae.image_path)||"",question_text:((He=o.value)==null?void 0:He.ocrText)||((pt=o.value)==null?void 0:pt.content)||"",App_platform:((Xe=o.value)==null?void 0:Xe.pkgName)==="SGpaisou"?"1":"2",...te};Q("messageSend","dataCollection",$)},J=async te=>{var de,se;console.log("[AIChatComponent] Received biz_question_info:",te);const $=te;ZT(),a.setQuestionInfo($);try{Q("question-data-updated",{questionText:$.content||$.orc_text,questionImage:$.imagePath,questionId:$.question_id});const Ne={session_id:$.sessionId,question_id:$.questionId,content:$.content,orc_text:$.ocrText,image_path:$.imagePath},Ae=await bd(Ne);if(Ae!=null&&Ae.data){const He={...$,...Ae.data,envNumber:$.envNumber||((de=a.userInfo)==null?void 0:de.envNumber),imgUrl:$.imagePath,avatar:(se=a.userInfo)==null?void 0:se.avatar};a.updateQuestionInfo(He),N(),K(o.value),V.nextTick(()=>{o.value.question_type!==0&&ae({question_id:o.value.question_id||o.value.questionId||"",eventName:"SnapThink_Result_Show",eventShowName:"结果页曝光",eventType:"exposure",Result_Show_mode:Oe(o.value),Result_Show_type:o.value.question_type===1?1:2})}),Q("messageSend","questionData",{question_type:o.value.question_type,session_id:o.value.session_id})}QG()}catch(Ne){console.error("[AIChatComponent] handleSearchQuestion error:",Ne)}},K=te=>{if(te.question_type===1||te.question_type==="1")return;if(te.pkgName!=="SGpaisou"&&te.question_type!==0&&te.question_type!=="0"){const se=M("Start Explaining");setTimeout(()=>F("Start Explaining",te.session_id,p.value,k.value,!1,se),300),ke.value=!0}else nt(te,y.value,p.value,k.value,()=>j(te,y.value,xe.value),se=>{P.value=se},se=>{U.value=se},se=>{H.value=se})},ce=async()=>{var $,de;const te=await Tj(o.value.session_id);if(te!=null&&te.data){const se={...o.value,...te.data,envNumber:o.value.envNumber||(($=a.userInfo)==null?void 0:$.envNumber),imgUrl:o.value.imagePath,avatar:(de=a.userInfo)==null?void 0:de.avatar};a.updateQuestionInfo(se)}};return V.onMounted(()=>{var te;if((te=o.value)!=null&&te.historyType){ce(),j(o.value,y.value,xe.value),o.value.isOverSevenDays?H.value=!0:H.value=!1;return}if(!i.questionInfo||Object.keys(i.questionInfo).length===0){const $=TG();$?$.pkgName!=="SGpaisou"?J($):(J($),WT(de=>{J(de)})):WT(de=>{J(de)})}}),V.onUnmounted(()=>{rt.destroy(),ZT()}),V.watch(()=>i.questionInfo,te=>{a.questionInfo&&Object.keys(a.questionInfo).length>0||te&&(N(),K(te),V.nextTick(()=>{te.question_type!==0&&ae({question_id:te.question_id||te.questionId||"",eventName:"SnapThink_Result_Show",eventShowName:"结果页曝光",eventType:"exposure",Result_Show_mode:Oe(te),Result_Show_type:te.question_type===1?1:2})}))},{immediate:!0}),V.watch([P,U],([te,$])=>{te&&$==="insolubility"&&ae({eventName:"SnapThink_Cannot_Explain_Popup_Show",eventShowName:"无法讲解弹窗曝光",eventType:"exposure"})}),e({addMessage:x,addAIMessage:O,addUserMessage:M,clearMessages:N,scrollToBottom:R,handleVoiceData:X,cancelVoiceRecord:ie,messages:L.value,isSoundOn:p,handleMuteToggle:G}),(te,$)=>{var de,se,Ne,Ae,He,pt,Xe,Mt,qt,be,O1,We,Re,Ft,_t,s1,l1,St,P1,Yt,me,ye,Fe,ft,Ce,ee,De,Pe,Be,et,je,Ve;return V.openBlock(),V.createElementBlock("div",{class:V.normalizeClass(["ai-chat-container",(de=u.value.customClasses)==null?void 0:de.container,{"keyboard-visible":V.unref(qe)}]),style:V.normalizeStyle(l.value.container)},[((se=o.value)==null?void 0:se.question_type)!==1?(V.openBlock(),V.createElementBlock(V.Fragment,{key:0},[((Ne=o.value)==null?void 0:Ne.pkgName)==="SGpaisou"?(V.openBlock(),V.createElementBlock("div",{key:0,class:V.normalizeClass(["ai-sticky-header",(Ae=u.value.customClasses)==null?void 0:Ae.header]),style:V.normalizeStyle(l.value.header)},[V.createElementVNode("div",Wj,[V.createElementVNode("img",{src:((He=u.value.avatar)==null?void 0:He.src)||V.unref(Ge).avatar.src,alt:((pt=u.value.avatar)==null?void 0:pt.alt)||V.unref(Ge).avatar.alt,style:V.normalizeStyle({width:((Xe=u.value.avatar)==null?void 0:Xe.width)||V.unref(Ge).avatar.width,height:((Mt=u.value.avatar)==null?void 0:Mt.height)||V.unref(Ge).avatar.height,borderRadius:((qt=u.value.avatar)==null?void 0:qt.borderRadius)||V.unref(Ge).avatar.borderRadius})},null,12,Zj)]),V.createElementVNode("div",Kj,[V.createElementVNode("h3",{style:V.normalizeStyle(m.value.name)},V.toDisplayString(((be=u.value.aiInfo)==null?void 0:be.name)||V.unref(Ge).aiInfo.name),5),V.createElementVNode("p",{style:V.normalizeStyle(m.value.title)},V.toDisplayString(((O1=u.value.aiInfo)==null?void 0:O1.title)||V.unref(Ge).aiInfo.title),5)]),V.createElementVNode("div",{class:"mute-button",onClick:G},[V.createElementVNode("img",{src:p.value?((We=u.value.muteButton)==null?void 0:We.soundOnIcon)||V.unref(Ge).muteButton.soundOnIcon:((Re=u.value.muteButton)==null?void 0:Re.soundOffIcon)||V.unref(Ge).muteButton.soundOffIcon,alt:p.value?"声音开启":"声音关闭",style:V.normalizeStyle({width:((Ft=u.value.muteButton)==null?void 0:Ft.width)||V.unref(Ge).muteButton.width,height:((_t=u.value.muteButton)==null?void 0:_t.height)||V.unref(Ge).muteButton.height})},null,12,Xj)])],6)):V.createCommentVNode("",!0),V.createElementVNode("div",{ref_key:"chatContentRef",ref:s,class:V.normalizeClass(["chat-content",(s1=u.value.customClasses)==null?void 0:s1.chatContent]),style:V.normalizeStyle(l.value.chatContent),onClick:$[7]||($[7]=(...le)=>V.unref(he)&&V.unref(he)(...le)),onScroll:$[8]||($[8]=(...le)=>V.unref(he)&&V.unref(he)(...le)),onTouchmove:$[9]||($[9]=(...le)=>V.unref(he)&&V.unref(he)(...le))},[V.createElementVNode("div",{class:"chat-messages",ref_key:"messagesContainer",ref:C},[V.renderSlot(te.$slots,"message-list-header",{},void 0,!0),(V.openBlock(!0),V.createElementBlock(V.Fragment,null,V.renderList(V.unref(L),le=>{var Qt,wt,zt,kt,Pt,It,_1,F1,J1,Ut,B1,g2,_2,Et,E3,E2,X2,V1,G1,b3,b2,J2,Od,Md,Nd,Rd,wd,Id,Hd,Fd,kd,Pd,Bd,Vd,Gd,Ud,jd,qd,Yd,zd,Wd,Zd,Kd,Xd,Jd,$d,ep,tp,rp,np,ap;return V.openBlock(),V.createElementBlock("div",{key:le.id,class:V.normalizeClass(["message",`${le.type}-message`]),style:V.normalizeStyle({marginBottom:(Qt=l.value.messages)==null?void 0:Qt.messageGap})},[le.type==="ai"&&!le.category?(V.openBlock(),V.createElementBlock("div",Jj,[le.isNetworkError?(V.openBlock(),V.createElementBlock("div",$j,[V.createElementVNode("img",{src:V.unref(lt).networkErrorIcon,alt:"error",class:"error-icon"},null,8,eq),$[15]||($[15]=V.createElementVNode("span",{class:"error-text"},"Network error. Please try again later.",-1)),V.createElementVNode("button",{class:"retry-button",onClick:$[0]||($[0]=(...mt)=>V.unref(I)&&V.unref(I)(...mt))}," Retry ")])):(V.openBlock(),V.createElementBlock("div",{key:1,class:"message-content",style:V.normalizeStyle((wt=l.value.messages)==null?void 0:wt.aiMessage),onTouchstart:mt=>!V.unref(H)&&!le.disableLongPress&&V.unref(ve)(mt,le),onTouchend:$[1]||($[1]=(...mt)=>V.unref(ge)&&V.unref(ge)(...mt)),onTouchcancel:$[2]||($[2]=(...mt)=>V.unref(ge)&&V.unref(ge)(...mt)),onMousedown:mt=>!V.unref(H)&&!le.disableLongPress&&V.unref(ve)(mt,le),onMouseup:$[3]||($[3]=(...mt)=>V.unref(ge)&&V.unref(ge)(...mt)),onMouseleave:$[4]||($[4]=(...mt)=>V.unref(ge)&&V.unref(ge)(...mt))},[V.createElementVNode("span",rq,[V.createElementVNode("span",{innerHTML:Ue(le.content)},null,8,nq),le.isTyping||le.isStreaming?(V.openBlock(),V.createElementBlock("span",aq)):V.createCommentVNode("",!0)]),le.showButtons?(V.openBlock(),V.createElementBlock("div",iq,[V.createElementVNode("button",{class:V.normalizeClass((kt=(zt=v.value)==null?void 0:zt.notMyQuestion)==null?void 0:kt.className),style:V.normalizeStyle((It=(Pt=v.value)==null?void 0:Pt.notMyQuestion)==null?void 0:It.style),onClick:ze},V.toDisplayString((F1=(_1=v.value)==null?void 0:_1.notMyQuestion)==null?void 0:F1.text),7),V.createElementVNode("button",{class:V.normalizeClass((Ut=(J1=v.value)==null?void 0:J1.startExplaining)==null?void 0:Ut.className),style:V.normalizeStyle((g2=(B1=v.value)==null?void 0:B1.startExplaining)==null?void 0:g2.style),onClick:Tt},V.toDisplayString((Et=(_2=v.value)==null?void 0:_2.startExplaining)==null?void 0:Et.text),7)])):V.createCommentVNode("",!0),le.showFeedbackOnly?(V.openBlock(),V.createElementBlock("div",oq,[V.createElementVNode("img",{src:le.isPlayingTTS?g.value.volumeing:g.value.volume,onClick:mt=>Ye(le.isPlayingTTS?"volumeing":"volume",le),alt:le.isPlayingTTS?"播放中":"播放"},null,8,sq),V.createElementVNode("img",{src:le.vote==="upvote"?g.value.praiseing:g.value.praise,onClick:mt=>Ye("upvote",le),alt:le.vote==="upvote"?"已点赞":"点赞"},null,8,lq),V.createElementVNode("img",{src:le.vote==="downvote"?g.value.trampleing:g.value.trample,onClick:mt=>Ye("downvote",le),alt:le.vote==="downvote"?"已不喜欢":"不喜欢"},null,8,uq)])):V.createCommentVNode("",!0),le.showFeedbackAndContinue?(V.openBlock(),V.createElementBlock("div",cq,[V.createElementVNode("div",Tq,[V.createElementVNode("img",{src:le.isPlayingTTS?g.value.volumeing:g.value.volume,onClick:mt=>Ye(le.isPlayingTTS?"volumeing":"volume",le),alt:le.isPlayingTTS?"播放中":"播放"},null,8,Qq),V.createElementVNode("img",{src:le.vote==="upvote"?g.value.praiseing:g.value.praise,onClick:mt=>Ye("upvote",le),alt:le.vote==="upvote"?"已点赞":"点赞"},null,8,dq),V.createElementVNode("img",{src:le.vote==="downvote"?g.value.trampleing:g.value.trample,onClick:mt=>Ye("downvote",le),alt:le.vote==="downvote"?"已不喜欢":"不喜欢"},null,8,pq)]),V.createElementVNode("button",{class:V.normalizeClass((E2=(E3=v.value)==null?void 0:E3.continue)==null?void 0:E2.className),style:V.normalizeStyle((V1=(X2=v.value)==null?void 0:X2.continue)==null?void 0:V1.style),disabled:V.unref(B)&&((G1=o.value)==null?void 0:G1.historyType),onClick:mt=>re(le.id)},V.toDisplayString((b2=(b3=v.value)==null?void 0:b3.continue)==null?void 0:b2.text),15,fq)])):V.createCommentVNode("",!0)],44,tq))])):V.createCommentVNode("",!0),le.type==="user"?(V.openBlock(),V.createElementBlock("div",mq,[le.sendStatus==="failed"?(V.openBlock(),V.createElementBlock("div",{key:0,class:V.normalizeClass(["resend-icon",{rotating:le.isRotating}]),onClick:mt=>Ee(le)},[V.createElementVNode("img",{src:V.unref(lt).resendIcon,alt:"重发",title:"点击重新发送"},null,8,gq)],10,hq)):V.createCommentVNode("",!0),V.createElementVNode("div",{class:V.normalizeClass(["message-content",{"background-transparent":le.imageUrl}]),style:V.normalizeStyle((J2=l.value.messages)==null?void 0:J2.userMessage)},[le.imageUrl?(V.openBlock(),V.createElementBlock("div",_q,[(V.openBlock(),V.createElementBlock("img",{key:le.imageUrl,src:le.imageUrl,alt:"Question Image",onLoad:Le,onClick:mt=>p1(le.imageUrl)},null,40,Eq))])):V.createCommentVNode("",!0),V.createElementVNode("div",{innerHTML:Ue(le.content)},null,8,bq),le.options&&le.options.length>0?(V.openBlock(),V.createElementBlock("div",yq,[(V.openBlock(!0),V.createElementBlock(V.Fragment,null,V.renderList(le.options,(mt,m0)=>(V.openBlock(),V.createElementBlock("span",{key:m0,innerHTML:Ue(mt)},null,8,vq))),128))])):V.createCommentVNode("",!0)],6),V.createElementVNode("div",Sq,[V.createElementVNode("img",{src:((Od=o.value)==null?void 0:Od.avatar)||((Md=u.value.userAvatar)==null?void 0:Md.src)||V.unref(Ge).userAvatar.src,alt:((Nd=u.value.userAvatar)==null?void 0:Nd.alt)||V.unref(Ge).userAvatar.alt,style:V.normalizeStyle({width:((Rd=u.value.userAvatar)==null?void 0:Rd.width)||V.unref(Ge).userAvatar.width,height:((wd=u.value.userAvatar)==null?void 0:wd.height)||V.unref(Ge).userAvatar.height,borderRadius:((Id=u.value.userAvatar)==null?void 0:Id.borderRadius)||V.unref(Ge).userAvatar.borderRadius})},null,12,Aq)])])):V.createCommentVNode("",!0),le.showCompletionSection||le.category?(V.openBlock(),V.createElementBlock("div",Lq,[V.createElementVNode("div",Cq,[V.createElementVNode("span",Dq,V.toDisplayString((Hd=y.value)==null?void 0:Hd.wasThisHelpful),1),V.createElementVNode("img",{src:g.value.smiling,onClick:$[5]||($[5]=mt=>At("upvote")),class:V.normalizeClass({voted:le.vote==="upvote"}),alt:le.vote==="upvote"?"已点赞":"赞"},null,10,xq),V.createElementVNode("img",{src:g.value.anger,onClick:$[6]||($[6]=mt=>At("downvote")),class:V.normalizeClass({voted:le.vote==="downvote"}),alt:le.vote==="downvote"?"已踩":"踩"},null,10,Oq)]),le.followUpQuestions&&le.followUpQuestions.length>0?(V.openBlock(),V.createElementBlock("div",Mq,[(V.openBlock(!0),V.createElementBlock(V.Fragment,null,V.renderList(le.followUpQuestions,(mt,m0)=>(V.openBlock(),V.createElementBlock("div",{key:m0,class:"follow-up-item",onClick:IY=>pe(mt,le.id)},[V.createElementVNode("img",{src:g.value.star,alt:"追问"},null,8,Rq),V.createElementVNode("span",{class:"question-text",innerHTML:Ue(mt)},null,8,wq)],8,Nq))),128))])):V.createCommentVNode("",!0),V.unref(B)&&((Fd=o.value)!=null&&Fd.historyType)?(V.openBlock(),V.createElementBlock("button",{key:1,class:V.normalizeClass((Pd=(kd=v.value)==null?void 0:kd.snapAnother)==null?void 0:Pd.className),style:V.normalizeStyle((Vd=(Bd=v.value)==null?void 0:Bd.explainAgain)==null?void 0:Vd.style),onClick:Ke},[(Ud=(Gd=v.value)==null?void 0:Gd.explainAgain)!=null&&Ud.icon?(V.openBlock(),V.createElementBlock("img",{key:0,src:(qd=(jd=v.value)==null?void 0:jd.explainAgain)==null?void 0:qd.icon,alt:""},null,8,Iq)):V.createCommentVNode("",!0),V.createTextVNode(" "+V.toDisplayString((zd=(Yd=v.value)==null?void 0:Yd.explainAgain)==null?void 0:zd.text),1)],6)):V.createCommentVNode("",!0),!V.unref(B)&&((Wd=o.value)==null?void 0:Wd.pkgName)==="SGpaisou"?(V.openBlock(),V.createElementBlock("button",{key:2,class:V.normalizeClass((Kd=(Zd=v.value)==null?void 0:Zd.snapAnother)==null?void 0:Kd.className),style:V.normalizeStyle((Jd=(Xd=v.value)==null?void 0:Xd.snapAnother)==null?void 0:Jd.style),onClick:at},[(ep=($d=v.value)==null?void 0:$d.snapAnother)!=null&&ep.icon?(V.openBlock(),V.createElementBlock("img",{key:0,src:(rp=(tp=v.value)==null?void 0:tp.snapAnother)==null?void 0:rp.icon,alt:"拍照"},null,8,Hq)):V.createCommentVNode("",!0),V.createTextVNode(" "+V.toDisplayString((ap=(np=v.value)==null?void 0:np.snapAnother)==null?void 0:ap.text),1)],6)):V.createCommentVNode("",!0)])):V.createCommentVNode("",!0)],6)}),128))],512)],38),V.unref(Y)?(V.openBlock(),V.createElementBlock("div",{key:1,class:V.normalizeClass(["message-feedback-popup",{"show-above":V.unref(Z).showAbove}]),style:V.normalizeStyle({top:V.unref(Z).top+"px",left:V.unref(Z).left+"px"}),onTouchmove:$[13]||($[13]=V.withModifiers(()=>{},["stop"]))},[$[16]||($[16]=V.createElementVNode("div",{class:"popup-arrow"},null,-1)),V.createElementVNode("div",Fq,[V.createElementVNode("img",{src:(l1=V.unref(Qe)())!=null&&l1.isPlayingTTS?g.value.volumeing:g.value.volume,onClick:$[10]||($[10]=le=>{var Qt;return Ye((Qt=V.unref(Qe)())!=null&&Qt.isPlayingTTS?"volumeing":"volume",V.unref(ne))}),alt:(St=V.unref(Qe)())!=null&&St.isPlayingTTS?"播放中":"播放"},null,8,kq),V.createElementVNode("img",{src:((P1=V.unref(Qe)())==null?void 0:P1.vote)==="upvote"?g.value.praiseing:g.value.praise,onClick:$[11]||($[11]=le=>Ye("upvote",V.unref(ne))),alt:((Yt=V.unref(Qe)())==null?void 0:Yt.vote)==="upvote"?"已点赞":"点赞"},null,8,Pq),V.createElementVNode("img",{src:((me=V.unref(Qe)())==null?void 0:me.vote)==="downvote"?g.value.trampleing:g.value.trample,onClick:$[12]||($[12]=le=>Ye("downvote",V.unref(ne))),alt:((ye=V.unref(Qe)())==null?void 0:ye.vote)==="downvote"?"已不喜欢":"不喜欢"},null,8,Bq)])],38)):V.createCommentVNode("",!0),V.createElementVNode("div",{class:V.normalizeClass(["chat-input-container",(Fe=u.value.customClasses)==null?void 0:Fe.inputContainer]),style:V.normalizeStyle({...l.value.inputContainer,bottom:V.unref(qe)?V.unref(Ze)+24+"px":"auto"})},[((ft=u.value.feedback)==null?void 0:ft.show)!==!1&&f.value.length>0&&V.unref(ke)&&!V.unref(qe)||((Ce=o.value)==null?void 0:Ce.pkgName)!=="SGpaisou"?(V.openBlock(),V.createElementBlock("div",{key:0,class:V.normalizeClass(["feedback-buttons",{disabled:V.unref(H)||d.value}]),style:V.normalizeStyle(((ee=u.value.feedback)==null?void 0:ee.containerStyle)||{})},[(V.openBlock(!0),V.createElementBlock(V.Fragment,null,V.renderList(f.value,le=>(V.openBlock(),V.createElementBlock("button",{key:le.id,class:"feedback-btn",style:V.normalizeStyle(le.style),onClick:Qt=>_e(le.text),disabled:V.unref(H)||d.value},[le.icon?(V.openBlock(),V.createElementBlock("img",{key:0,src:le.icon,alt:"",style:{width:"24px",height:"24px","vertical-align":"middle","margin-right":"8px"}},null,8,Gq)):V.createCommentVNode("",!0),V.createTextVNode(" "+V.toDisplayString(le.text),1)],12,Vq))),128))],6)):V.createCommentVNode("",!0),V.createElementVNode("div",Uq,[V.createElementVNode("div",{class:"input-wrapper",style:V.normalizeStyle(h.value)},[V.withDirectives(V.createElementVNode("input",{ref:"mainInputRef",type:"text","onUpdate:modelValue":$[14]||($[14]=le=>T.value=le),placeholder:S.value,onKeyup:V.withKeys(q,["enter"]),class:"chat-input",style:V.normalizeStyle(E.value),disabled:V.unref(H)||V.unref(B)&&((De=o.value)==null?void 0:De.historyType)||d.value},null,44,jq),[[V.vModelText,T.value]]),!V.unref(qe)&&!T.value.trim()&&!d.value?(V.openBlock(),V.createElementBlock("div",{key:0,class:V.normalizeClass(["send-button",{disabled:V.unref(H)||V.unref(B)&&((Pe=o.value)==null?void 0:Pe.historyType),recording:d.value}]),onClick:W,style:V.normalizeStyle(_.value),title:d.value?"录音中...":"语音输入"},[V.createElementVNode("img",{src:((Be=u.value.input)==null?void 0:Be.sendIcon)||V.unref(Ge).input.sendIcon,alt:d.value?"录音中":"语音输入",style:V.normalizeStyle({width:((et=u.value.input)==null?void 0:et.sendIconWidth)||V.unref(Ge).input.sendIconWidth,height:((je=u.value.input)==null?void 0:je.sendIconHeight)||V.unref(Ge).input.sendIconHeight})},null,12,Yq)],14,qq)):V.createCommentVNode("",!0)],4),T.value.trim()||V.unref(qe)&&!d.value?(V.openBlock(),V.createElementBlock("div",{key:0,class:"send-message",onClick:q},[V.createElementVNode("img",{src:V.unref(lt).sendMessageIcon,alt:""},null,8,zq)])):V.createCommentVNode("",!0),d.value?(V.openBlock(),V.createElementBlock("div",Wq,[V.createElementVNode("img",{src:V.unref(lt).loadingRotateIcon,alt:""},null,8,Zq)])):V.createCommentVNode("",!0)])],6)],64)):((Ve=o.value)==null?void 0:Ve.question_type)===1?(V.openBlock(),V.createBlock(dg,{key:1,onFeedback:dt,isDownVoted:V.unref(ue),questionInfo:o.value},null,8,["isDownVoted","questionInfo"])):V.createCommentVNode("",!0),V.createVNode(Lj,{visible:c.value,"image-url":n.value,onClose:o1},null,8,["visible","image-url"]),V.createVNode(Sj,{dialogType:V.unref(U),visible:V.unref(P),feedbackType:V.unref(z),subject_id:V.unref(fe),currentLongPressMessageId:V.unref(Te),onClose:V.unref(Me),onTracking:ae},null,8,["dialogType","visible","feedbackType","subject_id","currentLongPressMessageId","onClose"])],6)}}}),[["__scopeId","data-v-7fe758c1"]]);function bn(r){const e={...Ge};return r&&Object.keys(r).forEach(t=>{const i=t,Q=r[i],p=e[i];typeof Q=="object"&&Q!==null&&!Array.isArray(Q)&&typeof p=="object"&&p!==null?e[i]={...p,...Q}:Q!==void 0&&(e[i]=Q)}),e}const xd={default:Ge,minimal:bn({feedback:{show:!1},styles:{container:{borderRadius:"8px",boxShadow:"none"}}}),dark:bn({styles:{container:{background:"#1a1a1a",color:"#ffffff"},header:{borderBottom:"1px solid #333333",background:"#1a1a1a"},messages:{aiMessage:{background:"#2d2d2d",color:"#ffffff",border:"1px solid #333333"},userMessage:{background:"#0066cc",color:"#ffffff"}}},aiInfo:{nameStyle:{color:"#ffffff"},titleStyle:{color:"#cccccc"}}}),compact:bn({styles:{header:{padding:"8px 16px"},inputContainer:{padding:"8px 16px 16px"},messages:{messageGap:"8px"}},feedback:{containerStyle:{padding:"0 0 8px 0",gap:"8px"}}})},Kq={AIChatComponent:Dd,createAIChatConfig:bn,PRESET_CONFIGS:xd,DEFAULT_CONFIG:Ge};Ht.AIChatComponent=Dd,Ht.DEFAULT_CONFIG=Ge,Ht.IMAGE_ASSETS=lt,Ht.PRESET_CONFIGS=xd,Ht.createAIChatConfig=bn,Ht.createImageConfig=Uh,Ht.default=Kq,Ht.getImageUrl=Vh,Ht.hasImage=Gh,Object.defineProperties(Ht,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
|
|
3202
|
-
//# sourceMappingURL=ai-chat-sdk.umd.js.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "sg-paisou",
|
|
3
|
-
"version": "0.0.1-beta.
|
|
3
|
+
"version": "0.0.1-beta.3",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "./dist/ai-chat-sdk.umd.js",
|
|
6
6
|
"module": "./dist/ai-chat-sdk.es.js",
|
|
@@ -46,41 +46,38 @@
|
|
|
46
46
|
"prepublishOnly": "npm run build:lib"
|
|
47
47
|
},
|
|
48
48
|
"peerDependencies": {
|
|
49
|
-
"vue": "^3.4.0"
|
|
50
|
-
"pinia": "^2.0.0",
|
|
51
|
-
"sa-sdk-javascript": "^1.27.11"
|
|
49
|
+
"vue": "^3.4.0"
|
|
52
50
|
},
|
|
53
51
|
"peerDependenciesMeta": {
|
|
54
52
|
"vue": {
|
|
55
53
|
"optional": false
|
|
56
|
-
},
|
|
57
|
-
"pinia": {
|
|
58
|
-
"optional": false
|
|
59
|
-
},
|
|
60
|
-
"sa-sdk-javascript": {
|
|
61
|
-
"optional": true
|
|
62
54
|
}
|
|
63
55
|
},
|
|
64
56
|
"dependencies": {
|
|
65
|
-
"axios": "^1.7.7",
|
|
66
57
|
"@microsoft/fetch-event-source": "^2.0.1",
|
|
67
|
-
"
|
|
68
|
-
"
|
|
58
|
+
"axios": "^1.7.7",
|
|
59
|
+
"katex": "^0.16.11",
|
|
60
|
+
"sa-sdk-javascript": "^1.27.11"
|
|
69
61
|
},
|
|
70
62
|
"devDependencies": {
|
|
63
|
+
"@aliyun-sls/web-track-browser": "^0.3.8",
|
|
71
64
|
"@genie/sea.uni.jsbridge": "1.0.1-beta",
|
|
72
65
|
"@types/crypto-js": "^4.2.2",
|
|
73
66
|
"@types/events": "^3.0.3",
|
|
67
|
+
"@types/katex": "^0.16.7",
|
|
74
68
|
"@types/node": "^22.9.0",
|
|
75
69
|
"@vitejs/plugin-vue": "^5.1.2",
|
|
70
|
+
"crypto-js": "^4.2.0",
|
|
76
71
|
"events": "^3.3.0",
|
|
77
72
|
"pinia": "^2.2.2",
|
|
78
73
|
"sass": "^1.78.0",
|
|
74
|
+
"tal-mathgpt-render": "^1.2.7-1",
|
|
79
75
|
"typescript": "^5.5.3",
|
|
80
76
|
"unplugin-auto-import": "^0.18.3",
|
|
81
77
|
"unplugin-element-plus": "^0.8.0",
|
|
82
78
|
"unplugin-vue-components": "^0.27.4",
|
|
83
79
|
"vite": "^5.4.0",
|
|
80
|
+
"vite-plugin-html": "^3.2.2",
|
|
84
81
|
"vite-plugin-singlefile": "^2.0.2",
|
|
85
82
|
"vue": "^3.4.35",
|
|
86
83
|
"vue-router": "^4.6.3",
|