bea288e414
== 已部署上线 (9项) == - 代办事项真实数据源集成 (企微审批API 8bug修复链) - H5/坐席端 Logo样式统一+绿色背景 - 视频引导页修复 (localStorage key v2) - 坐席端 v9 Vue版本修复 (ElMessage._context) - 截图按钮 v10 修复 (getDisplayMedia user gesture) - 扫码样式恢复+H5扫码登录跳转修复 - H5截图快捷键提示 == 代码完成待部署 (3项) == - 知识迭代3Bug修复 (#8 POST端点/#7 MERGE幂等/#6 过期检查) - 会议室预定-小鱼易联终端 (40文件, 40/40测试通过) - IT资产升级审批推送 (asset_service.py) == 需求文档 (2项) == - 坐席端AI辅助消息框-PRD (4项新功能确认) - 坐席端布局优化建议 v2.0 (7天计划) == 新增文档 == - 日报-2026-07-11.md - 知识迭代Bug修复报告-20260711.md - 会议室预定-部署指南.md - CHANGELOG.md 更新 == 测试 == - test_todo_integration.py: 40/40 - test_meetingroom.py: 40/40 - test_bugfix_ki_suggestions.py: 21/21
2 lines
11 KiB
JavaScript
2 lines
11 KiB
JavaScript
import{v as Me,r as c,x as u}from"./index-B1u3nieA.js";import{a as l}from"./index-ChNUjLLo.js";const x=new Date("2026-06-06T10:30:00+08:00"),s=n=>new Date(x.getTime()-n*6e4).toISOString(),g=n=>new Date(x.getTime()-n*36e5).toISOString();s(2).toString(),g(1).toString(),s(2).toString(),s(8).toString(),g(2).toString(),s(8).toString(),s(15).toString(),s(15).toString(),s(15).toString(),s(5).toString(),g(3).toString(),s(5).toString(),s(3).toString(),g(24).toString(),s(3).toString(),s(10).toString(),s(20).toString(),s(20).toString(),s(20).toString(),s(30).toString(),s(30).toString(),s(30).toString(),s(25).toString(),s(25).toString(),s(25).toString(),s(10).toString(),s(10).toString(),s(10).toString(),s(8).toString(),g(2).toString(),g(3).toString(),g(2).toString();const d=(n,a)=>({id:n,conversation_id:"conv-001",created_at:a});({...d("msg-01",s(55))},{...d("msg-02",s(54))}),{...d("msg-03",s(50))},{...d("msg-04",s(48))},{...d("msg-05",s(45))},{...d("msg-06",s(42))},{...d("msg-07",s(40))},{...d("msg-08",s(38))},{...d("msg-09",s(35))},{...d("msg-10",s(30))},{...d("msg-11",s(25))},{...d("msg-12",s(20))};const V={id:"agent-1",user_id:"songxian",name:"宋献",status:"online",current_load:3,max_load:5,created_at:g(720).toString(),updated_at:s(5).toString()},$e=[V,{id:"agent-2",user_id:"liuming",name:"刘明",status:"busy",current_load:5,max_load:5,created_at:g(700).toString(),updated_at:s(5).toString()},{id:"agent-3",user_id:"chenjing",name:"陈静",status:"online",current_load:2,max_load:5,created_at:g(680).toString(),updated_at:s(5).toString()},{id:"agent-4",user_id:"zhaolei",name:"赵磊",status:"online",current_load:1,max_load:5,created_at:g(600).toString(),updated_at:s(5).toString()},{id:"agent-5",user_id:"wangfang",name:"王芳",status:"offline",current_load:0,max_load:5,created_at:g(500).toString(),updated_at:g(1).toString()}];({...V});function et(){const n=$e;return{onlineAgents:n.filter(a=>a.status==="online").length,busyAgents:n.filter(a=>a.status==="busy").length,offlineAgents:n.filter(a=>a.status==="offline").length}}new Date(x.getTime()+12*6e4).toISOString(),s(5).toString(),s(5).toString(),new Date(x.getTime()+180*6e4).toISOString(),s(12).toString(),s(12).toString(),s(28).toString(),s(28).toString(),g(2).toString(),s(45).toString(),s(30).toString(),s(35).toString(),s(35).toString();async function Ee(n){return await l.get("/conversations",{params:n})}async function ze(n,a){return await l.post(`/conversations/${n}/assign`,{agent_id:a})}async function qe(n){return await l.post(`/conversations/${n}/resolve`)}async function Ie(n){return await l.post(`/conversations/${n}/pin`)}async function Oe(n){return await l.post(`/conversations/${n}/todo`)}async function je(n,a){return await l.post(`/conversations/${n}/transfer`,{agent_id:a})}async function Be(n){return await l.post(`/conversations/${n}/grab`)}async function Re(n,a){return await l.post(`/conversations/${n}/invite`,{agent_id:a})}async function Ne(n){return await l.post(`/conversations/${n}/leave`)}async function Ve(n,a){return await l.post(`/conversations/${n}/invite-participant`,a)}async function Ke(n,a){return await l.delete(`/conversations/${n}/participants/${a}`)}async function Le(n,a){return await l.post(`/conversations/${n}/leave-participant`,{employee_id:a})}async function tt(n){return await l.post(`/conversations/${n}/send-evaluation-invite`)}async function Ue(n,a){return await l.get(`/conversations/${n}/messages`,{params:a})}async function We(n,a,i="text",p){console.log("[sendMessage] 发送消息:",{conversationId:n,content:a,msgType:i,options:p});const y=p?Object.fromEntries(Object.entries(p).filter(([h,C])=>C!==void 0)):{},f={content:a||"",msg_type:i||"text",...y};return console.log("[sendMessage] 请求体:",f),await l.post(`/conversations/${n}/messages`,f,{timeout:3e4})}async function Xe(n,a){const i={};return a&&(i.after_message_id=a),await l.get(`/conversations/${n}/messages/poll`,{params:i})}async function He(n){return await l.post(`/conversations/${n}/wingman/draft`)}async function Fe(n){return await l.post(`/conversations/${n}/wingman/summary`)}async function Ge(n){return await l.post(`/conversations/${n}/wingman/tags`)}async function nt(n,a){return await l.post(`/conversations/${n}/tags`,{tags:a})}const Ye={queued:1,serving:2,ai_handling:3,resolved:4};function N(n){var i,p,y,f;let a=0;return n.is_pinned&&(a-=1e4),n.is_todo&&(a-=5e3),(i=n.tags)!=null&&i.hand_raise&&(a-=2e3),(p=n.tags)!=null&&p.need_intervene&&(a-=1500),(((y=n.tags)==null?void 0:y.emotion)==="angry"||((f=n.tags)==null?void 0:f.emotion)==="urgent")&&(a-=1e3),n.is_vip&&(a-=800),a-=(n.urgency_score||1)*100,a+=(Ye[n.status]||3)*1e4,a}const at=Me("conversation",()=>{const n=c([]),a=c(null),i=c([]),p=c(!1),y=c(!1),f=c(""),z=c("chat"),h=c(new Map),C=c(new Set),v=c(new Map),P=c(null),T=c([]),k=c(""),A=c("medium"),D=c(!1),M=c(!1),$=c(!1);let w=null,S=null;const m=u(()=>[...n.value].sort((e,t)=>{const o=N(e),_=N(t);if(o!==_)return o-_;const E=e.last_message_at?new Date(e.last_message_at).getTime():0;return(t.last_message_at?new Date(t.last_message_at).getTime():0)-E})),K=u(()=>m.value.filter(e=>e.status==="queued")),L=u(()=>m.value.filter(e=>e.status==="serving"&&e.is_mine)),U=u(()=>m.value.filter(e=>e.status==="serving"&&!e.is_mine)),W=u(()=>m.value.filter(e=>e.status==="serving")),X=u(()=>m.value.filter(e=>e.status==="ai_handling")),H=u(()=>m.value.filter(e=>e.status==="resolved")),F=u(()=>m.value.filter(e=>e.is_collaborator&&e.status==="serving")),G=u(()=>m.value.filter(e=>!!(e.status==="queued"||e.status==="serving"&&e.is_mine||e.is_collaborator&&e.status==="serving"))),Y=u(()=>m.value.filter(e=>e.status==="serving"&&!e.is_mine&&!e.is_collaborator||e.status==="ai_handling")),Q=u(()=>m.value.filter(e=>e.status==="resolved")),J=u(()=>a.value&&n.value.find(e=>e.id===a.value)||null);async function r(){try{p.value=!0;const e=await Ee({page:1,page_size:100});for(const t of e.items)!t.employee_name&&t.employee_id&&(t.employee_name=t.employee_id);n.value=e.items}catch(e){console.error("获取会话列表失败:",e)}finally{p.value=!1}}async function Z(e){a.value=e,R(),await q(e)}async function q(e){try{y.value=!0;const t=await Ue(e,{limit:50});i.value=t.items}catch(t){console.error("获取消息列表失败:",t)}finally{y.value=!1}}async function ee(e,t){if(a.value)try{const o={};t&&(o.reply_to_id=t);const _=await We(a.value,e,"text",o);i.value.push(_),await r()}catch(o){console.error("发送消息失败:",o)}}async function te(e,t){try{await ze(e,t),await r()}catch(o){console.error("接单失败:",o)}}async function ne(e){try{await qe(e),await r(),a.value===e&&(a.value=null,i.value=[])}catch(t){console.error("结单失败:",t)}}async function ae(e){try{await Ie(e),await r()}catch(t){console.error("切换置顶失败:",t)}}async function se(e){try{await Oe(e),await r()}catch(t){console.error("切换代办失败:",t)}}async function oe(e,t){try{await je(e,t),await r()}catch(o){console.error("转接失败:",o)}}async function ie(e){try{await Be(e),await r()}catch(t){throw console.error("接手失败:",t),t}}async function re(e,t){try{await Re(e,t),await r()}catch(o){throw console.error("邀请协作失败:",o),o}}async function le(e){try{await Ne(e),await r(),a.value===e&&(a.value=null,i.value=[])}catch(t){throw console.error("退出协作失败:",t),t}}async function _e(e,t){try{await Ve(e,t),await r()}catch(o){throw console.error("邀请参与者失败:",o),o}}async function ce(e,t){try{await Ke(e,t),await r()}catch(o){throw console.error("移除参与者失败:",o),o}}async function ge(e,t){try{await Le(e,t),await r()}catch(o){throw console.error("参与者退出失败:",o),o}}function ue(){r()}function de(){r()}function I(){r(),w&&clearInterval(w),w=setInterval(()=>{r()},3e3)}function O(){w&&(clearInterval(w),w=null)}function j(){S&&clearInterval(S),S=setInterval(async()=>{if(a.value)try{const e=i.value.length>0?i.value[i.value.length-1].id:void 0,t=await Xe(a.value,e);t.items&&t.items.length>0&&i.value.push(...t.items)}catch(e){console.error("轮询消息失败:",e)}},3e3)}function B(){S&&(clearInterval(S),S=null)}function pe(){I(),j()}function me(){O(),B()}async function fe(e,t){const o=v.value.get(e);if(!(o!=null&&o.has(t)))try{D.value=!0;const _=await He(e);v.value.has(e)||v.value.set(e,new Map),v.value.get(e).set(t,_)}catch(_){console.error("获取 AI 草稿失败:",_)}finally{D.value=!1}}async function ve(e){try{M.value=!0;const t=await Fe(e);P.value=t}catch(t){console.error("获取会话摘要失败:",t)}finally{M.value=!1}}async function ye(e){try{$.value=!0;const t=await Ge(e);T.value=t.suggested_tags,k.value=t.category,A.value=t.priority}catch(t){console.error("获取标签建议失败:",t)}finally{$.value=!1}}function he(e,t){const o=v.value.get(e);if(!o)return;const _=o.get(t);_&&(f.value=_.content)}function we(e,t){const o=v.value.get(e);if(!o)return;const _=o.get(t);_&&(f.value=_.content)}function Se(e,t){const o=v.value.get(e);o&&o.delete(t)}function be(e,t){const o=v.value.get(e);return o&&o.get(t)||null}function R(){P.value=null,T.value=[],k.value="",A.value=""}function Ce(e){const t=C.value;if(t.delete(e),t.add(e),t.size>500){const o=t.values().next().value;t.delete(o)}}function xe(e){if(C.value.has(e.message_id)){console.log(`[WS去重] 跳过重复消息: ${e.message_id}`);return}Ce(e.message_id),a.value===e.conversation_id&&(i.value.some(o=>o.id===e.message_id)||i.value.push({id:e.message_id,conversation_id:e.conversation_id,sender_type:e.sender_type,sender_id:e.sender_id,sender_name:"",content:e.content,msg_type:"text",ai_suggestion:!1,is_read:!1,created_at:new Date().toISOString()})),r()}function Pe(e){r()}function Te(e){r()}function ke(){r()}let b=null;function Ae(e){e.conversation_id&&(h.value.set(e.conversation_id,{sender_id:e.sender_id,sender_name:e.sender_name,timestamp:Date.now()}),b||(b=setInterval(()=>{const t=Date.now(),o=[];h.value.forEach((_,E)=>{t-_.timestamp>5e3&&o.push(E)}),o.forEach(_=>h.value.delete(_)),h.value.size===0&&b&&(clearInterval(b),b=null)},1e3)))}function De(e){const t=h.value.get(e);return t?Date.now()-t.timestamp>5e3?(h.value.delete(e),""):`${t.sender_name}正在输入...`:""}return{conversations:n,currentConversationId:a,messages:i,loadingConversations:p,loadingMessages:y,pendingReplyText:f,workspaceView:z,aiDrafts:v,currentSummary:P,suggestedTags:T,suggestedCategory:k,suggestedPriority:A,loadingDraft:D,loadingSummary:M,loadingTags:$,sortedConversations:m,handRaiseConversations:K,myServingConversations:L,otherAgentConversations:U,servingConversations:W,aiHandlingConversations:X,resolvedConversations:H,collaboratingConversations:F,currentConversation:J,myConversations:G,colleagueConversations:Y,historyConversations:Q,fetchConversations:r,selectConversation:Z,fetchMessages:q,sendReply:ee,assignConv:te,resolveConv:ne,togglePinConv:ae,toggleTodoConv:se,transferConv:oe,grabConv:ie,inviteToConversation:re,leaveConvCollaboration:le,inviteParticipants:_e,removeParticipantFromConv:ce,leaveAsParticipantConv:ge,fetchDraftForMessage:fe,fetchSummary:ve,fetchSuggestedTags:ye,acceptDraft:he,editDraft:we,ignoreDraft:Se,getDraft:be,clearWingmanData:R,startConversationPoll:I,stopConversationPoll:O,startMessagePoll:j,stopMessagePoll:B,startAllPolling:pe,stopAllPolling:me,handleNewMessage:xe,handleConversationUpdated:Pe,handleCollaboratorInvited:Te,handleCollaboratorChanged:ke,handleParticipantInvited:ue,handleParticipantChanged:de,handleTypingEvent:Ae,getTypingText:De,typingUsers:h}});export{tt as a,He as b,Fe as c,Ge as d,nt as e,et as g,Ve as i,We as s,at as u};
|