PageSourceSearch

https://mentorspace.ai/build/assets/ConversationChatPage-D7OK5LDO.js

js mentorspace.ai collected 2026-10-05 13:30:52 UTC 12,591 bytes, 1 lines download raw bytes

1import{X as D,o as r,h as n,a as e,F as I,y as E,t as f,c as K,z as Q,a0 as Z,g as x,a1 as ee,a2 as se,f as k,i as M,A as c,p as te,aj as ae,I as oe,au as re,u as ne,P as le,s as ie,Y as de,T as ce,e as _,av as ue,w as ge,U as ve,r as $,l as me,m as he}from"./app-WAKmHpkM.js";import{M as pe}from"./MobileBottomDrawer-BASJQiQY.js";import{r as fe}from"./UsersIcon-YLw6kkBK.js";const ye={class:"bg-white dark:bg-gray-800 rounded-xl border border-gray-200 dark:border-gray-700 p-4"},xe={key:0,class:"text-center py-4"},be={key:1,class:"space-y-3"},_e=["src","onError"],ke={class:"min-w-0"},we={class:"flex items-center gap-2"},Ce={class:"font-medium text-black dark:text-white truncate"},Se={class:"relative group"},$e={class:"absolute bottom-full left-1/2 transform -translate-x-1/2 mb-2 px-2 py-1 text-xs text-white bg-gray-900 dark:bg-gray-700 rounded whitespace-nowrap opacity-0 group-hover:opacity-100 transition-opacity pointer-events-none z-10"},Ie={key:0,class:"text-xs text-gray-500 dark:text-gray-400 line-clamp-2"},Me={key:0,class:"py-4 text-sm text-gray-500 dark:text-gray-400 text-center"},Be={__name:"PersonaChatList",setup(G){const y=D(),w=c(()=>y.personas),C=c(()=>y.loading),i=()=>y.fetchPersonas(),v=p=>`https://ui-avatars.com/api/?name=${encodeURIComponent(p||"P")}&background=CBD5E1&color=334155&size=64&length=2&bold=true`;return(p,o)=>(r(),n("div",ye,[e("div",{class:"flex items-center justify-between mb-4"},[o[0]||(o[0]=e("h3",{class:"text-lg font-bold text-black dark:text-white"},"AI Mentors",-1)),e("button",{class:"text-sm text-gray-500 dark:text-gray-400 hover:text-gray-900 dark:hover:text-white transition-colors cursor-pointer",onClick:i},"Refresh")]),C.value?(r(),n("div",xe,[...o[1]||(o[1]=[e("div",{class:"animate-spin rounded-full h-6 w-6 border-b-2 border-gray-900 dark:border-white mx-auto"},null,-1)])])):(r(),n("ul",be,[(r(!0),n(I,null,E(w.value,l=>(r(),n("li",{key:l.id,class:"flex items-center gap-3 p-2 rounded-lg hover:bg-gray-50 dark:hover:bg-gray-700 transition-colors"},[e("img",{src:l.profile_image_url||v(l.name),onError:B=>B.target.src=v(l.name),alt:"Avatar",class:"h-10 w-10 rounded-full object-cover bg-gray-200 flex-shrink-0"},null,40,_e),e("div",ke,[e("div",we,[e("div",Ce,f(l.name),1),e("div",Se,[(r(),K(Z(l.is_historical_figure?x(ee):x(se)),{class:Q(["w-3 h-3",l.is_historical_figure?"text-amber-600 dark:text-amber-400":"text-blue-600 dark:text-blue-400"])},null,8,["class"])),e("div",$e,[k(f(l.is_historical_figure?"Historical Figure":"Fictional Character")+" ",1),o[2]||(o[2]=e("div",{class:"absolute top-full left-1/2 transform -translate-x-1/2 w-0 h-0 border-l-4 border-r-4 border-t-4 border-transparent border-t-gray-900 dark:border-t-gray-700"},null,-1))])])]),l.description||l.background?(r(),n("div",Ie,f(l.description||l.background),1)):M("",!0)])]))),128)),w.value.length===0?(r(),n("li",Me,"No mentors for this space")):M("",!0)]))]))}},Fe={class:"h-[calc(100dvh-65px)] bg-gray-50 dark:bg-gray-900 flex flex-col overflow-hidden"},ze={class:"border-b border-gray-200 dark:border-gray-800 bg-white dark:bg-gray-900 flex-shrink-0"},Ae={class:"max-w-8xl mx-auto px-4 sm:px-6 lg:px-8 py-3 lg:py-4 flex items-center justify-between"},Pe={class:"flex-1 overflow-hidden max-w-8xl mx-auto w-full px-0 lg:px-8 py-0 lg:py-6 flex flex-col"},Re={class:"grid grid-cols-1 lg:grid-cols-4 gap-0 lg:gap-6 flex-1 overflow-hidden"},Te={class:"lg:col-span-3 flex flex-col h-full min-h-0"},Ve={class:"hidden lg:block bg-white dark:bg-gray-800 rounded-xl border border-gray-200 dark:border-gray-700 p-4 mb-4 flex-shrink-0"},He={class:"flex items-center justify-between"},Ne={class:"text-lg font-bold text-black dark:text-white"},je=["disabled"],De={key:0,xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor",class:"w-4 h-4 sm:mr-2"},Ee={key:1,class:"animate-spin w-4 h-4 sm:mr-2",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24"},Ge={class:"hidden sm:inline"},Ue={key:1,class:"inline-flex items-center px-3 py-2 text-sm text-green-600"},Le={class:"hidden lg:block lg:col-span-1 space-y-4"},Oe={class:"p-4 border-b border-gray-200 dark:border-gray-700 shrink-0"},Ye={class:"flex items-center justify-between"},We={class:"flex-1 overflow-y-auto p-4 min-h-0"},Xe={key:0,class:"text-center py-4"},qe={key:1,class:"space-y-3"},Je=["src","onError"],Ke={class:"min-w-0"},Qe={class:"font-medium text-black dark:text-white truncate"},Ze={key:0,class:"text-xs text-gray-500 dark:text-gray-400 line-clamp-2"},es={key:0,class:"py-4 text-sm text-gray-500 dark:text-gray-400 text-center"},os={__name:"ConversationChatPage",setup(G){const y=te(),w=he(),C=me(),i=ae(),v=oe(),p=D(),o=re(),l=ne(),B=le(),d=c(()=>Number(w.params.id)),U=c(()=>o.getMessages(d.value)),L=c(()=>o.getTypingIndicators(d.value)),O=c(()=>o.getStatusMessages(d.value)),Y=c(()=>o.getConnectionStatus(d.value)),m=$(null),A=c(()=>i.selectedConversation?.goal_id||i.conversations.find(s=>s.id===d.value)?.goal_id),W=c(()=>v.selectedGoal||v.goals.find(s=>s.id===A.value)),P=c(()=>l.user?.id?Number(l.user.id):null),R=c(()=>l.user?.name?String(l.user.name):"You"),T=c(()=>{const s=i.selectedConversation?.personas;return!s||s.length===0?"":s.length===1?`Conversation with ${s[0].name}`:s.length===2?`Conversation with ${s[0].name} & ${s[1].name}`:`Conversation with ${s[0].name} & ${s.length-1} others`}),V=c(()=>{const s=i.selectedConversation?.personas;return s&&s.length>0?s:p.enabledPersonas||[]}),b=$(!1),F=$(!1),S=$(!1),H=s=>
1`https://ui-avatars.com/api/?name=${encodeURIComponent(s||"P")}&background=CBD5E1&color=334155&size=64&length=2&bold=true`,X=async()=>{if(!b.value){b.value=!0;try{const{data:s}=await y.post(`/api/conversations/${d.value}/save-to-feed`);s.success&&(F.value=!0,setTimeout(()=>{F.value=!1},3e3))}catch(s){console.error("Failed to save conversation to feed:",s)}finally{b.value=!1}}},N=async()=>{d.value&&await o.ensureLoaded(d.value)},j=async()=>{const s=d.value;if(!s)return;let t=i.conversations.find(a=>a.id===s)||i.selectedConversation;if(!t||!t.goal_id)try{const{data:a}=await y.get(`/api/conversations/${s}`);t=a}catch(a){console.error("Failed to resolve conversation by id",a)}if(t){i.setSelectedConversation(t);const a=t.goal_id;if(a&&(!v.selectedGoal||v.selectedGoal.id!==a)){try{await v.fetchGoals?.()}catch{}const u=v.goals?.find?.(z=>z.id===a);u&&v.setSelectedGoal(u)}try{await p.fetchPersonas?.()}catch(u){console.error("Failed to fetch personas",u)}}},q=async s=>{const t=i.selectedConversation?.goal_id;if(!t){const h=i.conversations.find(g=>g.id===d.value);h&&i.setSelectedConversation(h)}if(!i.selectedConversation?.id||!t)return;const a=`temp-${Date.now()}`,u=i.selectedConversation.id,z={id:a,user:R.value,speaker_type:"user",message:s.message,profile_image_url:l.user?.headshot_url,speaker_id:P.value,timestamp:new Date().toISOString()};o.append(u,z),m.value?.startReadingIndicator&&m.value.startReadingIndicator(),m.value?.showSeen&&m.value.showSeen(V.value.map(h=>h.name));try{const{data:h}=await y.post("/api/send-message",{goal_id:t,conversation_id:u,message:s.message}),g=h?.data?.message||null;g?o.replaceById(u,a,{id:g.id||Date.now(),user:g.user||R.value,speaker_type:g.speaker_type||"user",message:g.message||s.message,profile_image_url:g.profile_image_url||l.user?.headshot_url,speaker_id:g.speaker_id||P.value,timestamp:g.timestamp||new Date().toISOString()}):o.removeById(u,a)}catch(h){console.error("Failed to send message:",h),o.removeById(u,a),m.value?.stopReadingIndicator&&m.value.stopReadingIndicator(),m.value?.hideSeen&&m.value.hideSeen();const g=h.response?.data?.message||"Failed to send message";B.error(g)}};ie(async()=>{await j(),await N(),o.subscribeToConversation(d.value)}),de(()=>{o.unsubscribeFromConversation(d.value)}),ce(()=>d.value,async(s,t)=>{t&&o.unsubscribeFromConversation(t),await j(),await N(),o.subscribeToConversation(s)});const J=()=>{const s=A.value;s?C.push({name:"goal-detail",params:{id:s}}):C.push({name:"spaces"})};return(s,t)=>(r(),n("div",Fe,[e("div",ze,[e("div",Ae,[e("button",{class:"inline-flex items-center text-sm text-gray-600 dark:text-gray-400 hover:text-gray-900 dark:hover:text-white transition-colors cursor-pointer",onClick:J},[...t[3]||(t[3]=[e("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor",class:"w-4 h-4 mr-1"},[e("path",{"fill-rule":"evenodd",d:"M9.53 4.47a.75.75 0 010 1.06L4.81 10.25H21a.75.75 0 010 1.5H4.81l4.72 4.72a.75.75 0 11-1.06 1.06l-6-6a.75.75 0 010-1.06l6-6a.75.75 0 011.06 0z","clip-rule":"evenodd"})],-1),k(" Back to Space ",-1)])]),e("button",{class:"lg:hidden inline-flex items-center px-3 py-1.5 text-sm font-medium text-gray-700 dark:text-gray-200 bg-gray-100 dark:bg-gray-700 hover:bg-gray-200 dark:hover:bg-gray-600 rounded-full transition-colors cursor-pointer",onClick:t[0]||(t[0]=a=>S.value=!0)},[_(x(fe),{class:"w-4 h-4 mr-1.5"}),t[4]||(t[4]=k(" Mentors ",-1))])])]),e("div",Pe,[e("div",Re,[e("div",Te,[e("div",Ve,[e("div",He,[e("div",null,[e("div",Ne,[T.value?(r(),n(I,{key:0},[k(f(T.value),1)],64)):(r(),n(I,{key:1},[k("Conversation #"+f(d.value),1)],64))])]),F.value?(r(),n("div",Ue,[...t[7]||(t[7]=[e("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor",class:"w-4 h-4 mr-2"},[e("path",{"fill-rule":"evenodd",d:"M2.25 12c0-5.385 4.365-9.75 9.75-9.75s9.75 4.365 9.75 9.75-4.365 9.75-9.75 9.75S2.25 17.385 2.25 12zm13.36-1.814a.75.75 0 10-1.22-.872l-3.236 4.53L9.53 12.22a.75.75 0 00-1.06 1.06l2.25 2.25a.75.75 0 001.14-.094l3.75-5.25z","clip-rule":"evenodd"})],-1),e("span",{class:"hidden sm:inline"},"Saved to Feed",-1)])])):(r(),n("button",{key:0,onClick:X,disabled:b.value,class:"inline-flex items-center px-3 sm:px-4 py-2 text-sm font-medium rounded-full text-white dark:text-gray-900 bg-gray-900 dark:bg-white hover:bg-gray-800 dark:hover:bg-gray-200 transition-colors disabled:opacity-50 disabled:cursor-not-allowed cursor-pointer"},[b.value?(r(),n("svg",Ee,[...t[6]||(t[6]=[e("circle",{class:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor","stroke-width":"4"},null,-1),e("path",{class:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"},null,-1)])])):(r(),n("svg",De,[...t[5]||(t[5]=[e("path",{"fill-rule":"evenodd",d:"M5.625 1.5c-1.036 0-1.875.84-1.875 1.875v17.25c0 1.035.84 1.875 1.875 1.875h12.75c1.035 0 1.875-.84 1.875-1.875V12.75A3.75 3.75 0 0016.5 9h-1.875a1.875 1.875 0 01-1.875-1.875V5.25A3.75 3.75 0 009 
11.5H5.625zM7.5 15a.75.75 0 01.75-.75h7.5a.75.75 0 010 1.5h-7.5A.75.75 0 017.5 15zm.75 2.25a.75.75 0 000 1.5H12a.75.75 0 000-1.5H8.25z","clip-rule":"evenodd"},null,-1),e("path",{d:"M12.971 1.816A5.23 5.23 0 0114.25 5.25v1.875c0 .207.168.375.375.375H16.5a5.23 5.23 0 013.434 1.279 9.768 9.768 0 00-6.963-6.963z"},null,-1)])])),e("span",Ge,f(b.value?"Saving...":"Save to Feed"),1)],8,je))])]),_(ue,{ref_key:"chatRef",ref:m,class:"flex-1 min-h-0",messages:U.value,"typing-indicators":L.value,"status-messages":O.value,"is-connected":Y.value,personas:V.value,"debug-mode":W.value?.debug_mode||!1,"mobile-fixed-input":!0,onSendMessage:q},null,8,["messages","typing-indicators","status-messages","is-connected","personas","debug-mode"])]),e("div",Le,[_(Be)])])]),_(pe,{modelValue:S.value,"onUpdate:modelValue":t[2]||(t[2]=a=>S.value=a),"aria-label":"AI Mentors","panel-class":"max-h-[70vh] overflow-hidden"},{default:ge(()=>[e("div",Oe,[t[9]||(t[9]=e("div",{class:"w-12 h-1 bg-gray-300 dark:bg-gray-600 rounded-full mx-auto mb-3"},null,-1)),e("div",Ye,[t[8]||(t[8]=e("h3",{class:"text-lg font-bold text-black dark:text-white"},"AI Mentors",-1)),e("button",{type:"button",class:"text-gray-400 hover:text-gray-600 dark:hover:text-gray-200 cursor-pointer",onClick:t[1]||(t[1]=a=>S.value=!1)},[_(x(ve),{class:"w-5 h-5"})])])]),e("div",We,[x(p).loading?(r(),n("div",Xe,[...t[10]||(t[10]=[e("div",{class:"animate-spin rounded-full h-6 w-6 border-b-2 border-gray-900 dark:border-white mx-auto"},null,-1)])])):(r(),n("ul",qe,[(r(!0),n(I,null,E(x(p).personas,a=>(r(),n("li",{key:a.id,class:"flex items-center gap-3 p-2 rounded-lg hover:bg-gray-50 dark:hover:bg-gray-700 transition-colors"},[e("img",{src:a.profile_image_url||H(a.name),onError:u=>u.target.src=H(a.name),alt:"Avatar",class:"h-10 w-10 rounded-full object-cover bg-gray-200 flex-shrink-0"},null,40,Je),e("div",Ke,[e("div",Qe,f(a.name),1),a.description||a.background?(r(),n("div",Ze,f(a.description||a.background),1)):M("",!0)])]))),128)),x(p).personas.length===0?(r(),n("li",es,"No mentors for this space")):M("",!0)]))])]),_:1},8,["modelValue"])]))}};export{os as default};

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.