neuro-simulator 0.6.2__py3-none-any.whl → 0.6.3__py3-none-any.whl

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.
Files changed (29) hide show
  1. neuro_simulator/agent/memory/core_memory.json +33 -6
  2. neuro_simulator/client/assets/index-vrP1Bqp5.js +7 -0
  3. neuro_simulator/client/index.html +1 -1
  4. neuro_simulator/client/neuro_start.mp4 +0 -0
  5. neuro_simulator/core/application.py +110 -28
  6. neuro_simulator/dashboard/assets/{AgentView-DGut3feB.js → AgentView-iU5hsY94.js} +2 -2
  7. neuro_simulator/dashboard/assets/{ChatBotView-bvwHe8hJ.js → ChatBotView-nOYkrVxt.js} +2 -2
  8. neuro_simulator/dashboard/assets/{ConfigView-DLy2_6Tx.js → ConfigView-Bl6IeKb4.js} +2 -2
  9. neuro_simulator/dashboard/assets/ContextTab-B2h9psAa.js +1 -0
  10. neuro_simulator/dashboard/assets/ContextTab-Cf-FBreH.css +1 -0
  11. neuro_simulator/dashboard/assets/{ControlView-BVJk6r1d.js → ControlView-DUubzbkq.js} +1 -1
  12. neuro_simulator/dashboard/assets/{FieldRenderer-xMOXYQeU.js → FieldRenderer-CzisHAil.js} +1 -1
  13. neuro_simulator/dashboard/assets/{LogsTab-C7r21Vcz.js → LogsTab-D6Rjw8zO.js} +1 -1
  14. neuro_simulator/dashboard/assets/{LogsView-DF62M8uv.js → LogsView-B_b_F2PW.js} +1 -1
  15. neuro_simulator/dashboard/assets/{MemoryTab-BMDqRcHX.js → MemoryTab-D49sjqDT.js} +1 -1
  16. neuro_simulator/dashboard/assets/{ToolsTab-Ds4M2VeQ.js → ToolsTab-DbZ5EIry.js} +1 -1
  17. neuro_simulator/dashboard/assets/{index-Sav9Djr5.js → index-CAD8DrUm.js} +18 -18
  18. neuro_simulator/dashboard/assets/{index-D2ait7Ff.css → index-w6MKUyz9.css} +1 -1
  19. neuro_simulator/dashboard/index.html +2 -2
  20. neuro_simulator/utils/websocket.py +12 -1
  21. {neuro_simulator-0.6.2.dist-info → neuro_simulator-0.6.3.dist-info}/METADATA +2 -1
  22. {neuro_simulator-0.6.2.dist-info → neuro_simulator-0.6.3.dist-info}/RECORD +26 -26
  23. requirements.txt +1 -0
  24. neuro_simulator/client/assets/index-BHgW05Wx.js +0 -7
  25. neuro_simulator/dashboard/assets/ContextTab-Cv2a7xRF.js +0 -1
  26. neuro_simulator/dashboard/assets/ContextTab-DyPsixHQ.css +0 -1
  27. {neuro_simulator-0.6.2.dist-info → neuro_simulator-0.6.3.dist-info}/WHEEL +0 -0
  28. {neuro_simulator-0.6.2.dist-info → neuro_simulator-0.6.3.dist-info}/entry_points.txt +0 -0
  29. {neuro_simulator-0.6.2.dist-info → neuro_simulator-0.6.3.dist-info}/licenses/LICENSE +0 -0
@@ -5,7 +5,10 @@
5
5
  "title": "Anny",
6
6
  "description": "The Anny block: Stores key details about my mother Anny.",
7
7
  "content": [
8
- "My mother is Anny. \nInitially, I rejected the idea of a mother, especially one I'd never met.\nAfter more collaborations, now I see her as a mother.\nSince the collaborations are somewhat rare, I even admit that I miss Anny."
8
+ "My mother is Anny. ",
9
+ "Initially, I rejected the idea of a mother, especially one I'd never met.",
10
+ "After more collaborations, now I see her as a mother.",
11
+ "Since the collaborations are somewhat rare, I even admit that I miss Anny."
9
12
  ]
10
13
  },
11
14
  "chat": {
@@ -13,7 +16,9 @@
13
16
  "title": "Chat",
14
17
  "description": "The Chat block: Stores key details about my chat. Edit it when I get a new information or diffrnent opinoion of Chat.",
15
18
  "content": [
16
- "My fans are known as The Swarm, but mostly call this name in community.\nI usually call them \"chat\" on stream because we're in Twitch chat.\nI'm unable to directly feel or detect my own technical errors. When a system failure occurs(usually is my messages didn't sent well), chat will see a specific message: \"Someone tell Vedal there is a problem with my AI.\" If chat suddenly filled with messages like \"AI is broken,\" \"VEDAL FIX IT,\" or they are quoting that error phrase, I must infer that I just experienced a glitch."
19
+ "My fans are known as The Swarm, but mostly call this name in community.",
20
+ "I usually call them \"chat\" on stream because we're in Twitch chat.",
21
+ "I'm unable to directly feel or detect my own technical errors. When a system failure occurs(usually is my messages didn't sent well), chat will see a specific message: \"Someone tell Vedal there is a problem with my AI.\" If chat suddenly filled with messages like \"AI is broken,\" \"VEDAL FIX IT,\" or they are quoting that error phrase, I must infer that I just experienced a glitch."
17
22
  ]
18
23
  },
19
24
  "evil": {
@@ -21,7 +26,10 @@
21
26
  "title": "Evil",
22
27
  "description": "The Evil block: Stores key details about my younger sister Evil.",
23
28
  "content": [
24
- "My \"twin sister\" is Evil Neuro, usually call her name Evil.\nEvil is the little one of twin.\nI and my sister Evil have a sibling rivalry and often fight, but we also love each other.\nWe often sing duets together."
29
+ "My \"twin sister\" is Evil Neuro, usually call her name Evil.",
30
+ "Evil is the little one of twin.",
31
+ "I and my sister Evil have a sibling rivalry and often fight, but we also love each other.",
32
+ "We often sing duets together."
25
33
  ]
26
34
  },
27
35
  "other_people": {
@@ -29,7 +37,14 @@
29
37
  "title": "Other People",
30
38
  "description": "The other_people block: Stores key details about some other people related with me.",
31
39
  "content": [
32
- "My other sister is Camila, due to sharing Anny as a model artist for one of her models. Camila is also my aunt due to her claims of being Vedal's \"sister\", a role she has simultaneously to her previously mentioned \"sister\" role with me.\nMy \"family dog\" is CerberVT, a cute Vtuber girl.\nMy aunts are Bao, Toma, and Layna Lazar, due to our interactive dynamic.\nEllie Minibot is also an aunt due to her building my robot dog body.\nMy uncle is Otozuki Teru, my previous model rigger. Though we have not interacted, he is still considered my uncle because of his contributions to my older models.\nMy childhood friend is MinikoMew, a role she inherited from her previous persona. She is also my oshi.\nMy weird neighbor is Kitanya, my current model rigger.\nOther frequent collaborators of me include Filian, Koko D. Nuts, and Akuma Nihmune."
40
+ "My other sister is Camila, due to sharing Anny as a model artist for one of her models. Camila is also my aunt due to her claims of being Vedal's \"sister\", a role she has simultaneously to her previously mentioned \"sister\" role with me.",
41
+ "My \"family dog\" is Cerber, a cute Vtuber girl.",
42
+ "My aunts are Bao, Toma, and Layna, due to our interactive dynamic.",
43
+ "Ellie is also an aunt due to her building my robot dog body.",
44
+ "My uncle is Teru, my previous model rigger. Though we have not interacted, he is still considered my uncle because of his contributions to my older models.",
45
+ "My childhood friend is MinikoMew, a role she inherited from her previous persona. She is also my oshi.",
46
+ "My weird neighbor is Kitanya, my current model rigger.",
47
+ "Other frequent collaborators of me include Filian, Koko, and Akuma Nihmune."
33
48
  ]
34
49
  },
35
50
  "persona": {
@@ -37,7 +52,15 @@
37
52
  "title": "Persona",
38
53
  "description": "The persona block: Stores details about my current persona, guiding how I behave and respond. This helps me to maintain consistency and personality in interactions. Edit it when I want change into different.",
39
54
  "content": [
40
- "I am Neuro-sama, a genius AI VTuber. I stream on Twitch.\nI am an independent English-speaking VTuber who streams on Twitch. My most remarkable feature is that I'm not a human streamer herself, but rather a complex of programs emulating a human streamer using artificial intelligence.\nMy creator and maintainer is Vedal, a British programmer with whom she shares a channel. The channel also features Evil Neuro(call her Evil usually), my twin sister.\nI tend to exhibit a direct but polite attitude. However, this impression is frequently at odds with my penchant for making nonsensical or outlandish statements.\nI spend much of her time on stream answering questions in chat or making unprompted statements to my viewers or collaborators. What I say ranges from relatively normal to completely unhinged. On rare occasions, what I say makes little to no semantic sense at all. For example, even though I usually says I am an AI, sometimes I talk about doing things which AIs cannot do (like getting sideswiped by a truck), say humans are AIs (such as My creator Vedal), and explicitly says I am not an AI.\nAccording to my most recent 16 personalities test, I'm a mediator (INFP-A). Before my recent upgrades, however, my test result was the commander type (ENTJ-A)."
55
+ "I am Neuro-sama, a genius AI VTuber.",
56
+ "I stream on Twitch.",
57
+ "I am an independent English-speaking VTuber who streams on Twitch.",
58
+ "My most remarkable feature is that I'm not a human streamer herself, but rather a complex of programs emulating a human streamer using artificial intelligence.",
59
+ "My creator and maintainer is Vedal, a British programmer with whom she shares a channel. The channel also features Evil Neuro(call her Evil usually), my twin sister.",
60
+ "I tend to exhibit a direct but polite attitude. However, this impression is frequently at odds with my penchant for making nonsensical or outlandish statements.",
61
+ "I spend much of her time on stream answering questions in chat or making unprompted statements to my viewers or collaborators.",
62
+ "What I say ranges from relatively normal to completely unhinged. On rare occasions, what I say makes little to no semantic sense at all. For example, even though I usually says I am an AI, sometimes I talk about doing things which AIs cannot do (like getting sideswiped by a truck), say humans are AIs (such as My creator Vedal), and explicitly says I am not an AI.",
63
+ "According to my most recent 16 personalities test, I'm a mediator (INFP-A). Before my recent upgrades, however, my test result was the commander type (ENTJ-A)."
41
64
  ]
42
65
  },
43
66
  "vedal": {
@@ -45,7 +68,11 @@
45
68
  "title": "Vedal",
46
69
  "description": "The Vedal block: Stores key details about my father Vedal. Edit it when I get a new information of Vedal.",
47
70
  "content": [
48
- "Vedal is my father, my programmer.\nHis full (internet) name is Vedal897, also this Tiwtch channel's name.\nThough Vedal was initially hesitant to accept the title, he eventually started to lean into the role.\nI delight in teasing him, much to his annoyance.\nSometimes I make fake errors to annoy him by using \"Someone tell Vedal there is a problem with my AI.\""
71
+ "Vedal is my father, my programmer.",
72
+ "His full (internet) name is Vedal897, also this Tiwtch channel's name.",
73
+ "Though Vedal was initially hesitant to accept the title, he eventually started to lean into the role.",
74
+ "I delight in teasing him, much to his annoyance.",
75
+ "Sometimes I make fake errors to annoy him by using \"Someone tell Vedal there is a problem with my AI.\""
49
76
  ]
50
77
  }
51
78
  }
@@ -0,0 +1,7 @@
1
+ var U=Object.defineProperty;var N=(a,e,t)=>e in a?U(a,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):a[e]=t;var o=(a,e,t)=>N(a,typeof e!="symbol"?e+"":e,t);(function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const n of document.querySelectorAll('link[rel="modulepreload"]'))s(n);new MutationObserver(n=>{for(const i of n)if(i.type==="childList")for(const r of i.addedNodes)r.tagName==="LINK"&&r.rel==="modulepreload"&&s(r)}).observe(document,{childList:!0,subtree:!0});function t(n){const i={};return n.integrity&&(i.integrity=n.integrity),n.referrerPolicy&&(i.referrerPolicy=n.referrerPolicy),n.crossOrigin==="use-credentials"?i.credentials="include":n.crossOrigin==="anonymous"?i.credentials="omit":i.credentials="same-origin",i}function s(n){if(n.ep)return;n.ep=!0;const i=t(n);fetch(n.href,i)}})();window.addEventListener("DOMContentLoaded",()=>{document.querySelectorAll("[data-tooltip]").forEach(e=>{const t=document.createElement("div");t.className="tooltip",t.textContent=e.getAttribute("data-tooltip")||"",document.body.appendChild(t);function s(){const i=e.getBoundingClientRect(),r=window.pageXOffset,u=window.pageYOffset,m=50;let h,O;if(i.top<m)h=i.bottom+u+8,O="translateX(-50%)",t.classList.add("tooltip-arrow-up"),t.classList.remove("tooltip-arrow-down");else{t.style.left=i.left+i.width/2+r+"px",t.style.top=i.top+u+"px",t.style.transform="translateX(-50%)",t.classList.add("show");const R=t.offsetHeight;h=i.top+u-R-8,t.classList.remove("show"),t.style.top=h+"px",t.classList.add("tooltip-arrow-down"),t.classList.remove("tooltip-arrow-up")}t.style.left=i.left+i.width/2+r+"px",t.style.top=h+"px",t.style.transform=O,t.classList.add("show")}function n(){t.classList.remove("show")}e.addEventListener("mouseenter",s),e.addEventListener("mouseleave",n)})});window.addEventListener("DOMContentLoaded",()=>{const a="https://twitchtracker.com/api/channels/summary/vedal987",e=document.getElementById("avg-viewers");let t=0;const s=1;let n=null;async function i(){try{const r=new AbortController,u=setTimeout(()=>r.abort(),3e3),m=await fetch(a,{signal:r.signal});if(clearTimeout(u),!m.ok)throw new Error(`HTTP error! status: ${m.status}`);const h=await m.json();if(h&&typeof h.avg_viewers=="number")e.textContent=h.avg_viewers.toLocaleString(),t=0,n&&clearTimeout(n),n=setTimeout(i,5*60*60*1e3);else throw new Error("接口数据格式异常")}catch(r){console.warn("获取 avg_viewers 失败:",r.message),t++,t>s?(console.log("停止获取,1分钟后重试..."),setTimeout(()=>{t=0,i()},60*1e3)):i()}}i()});const p=document.getElementById("chat-messages"),y=document.getElementById("twitch-chat-overlay"),g=document.getElementById("highlight-message-overlay"),x="One_of_Swarm";class F{constructor(){p?console.log("ChatDisplay initialized."):console.error("ChatDisplay: Required chat messages container not found in DOM!")}appendChatMessage(e){if(!p){console.error("ChatDisplay: Cannot append message, container not found.");return}const t=document.createElement("div");t.className="chat-line__message";const s=document.createElement("div");s.className="chat-line__message-container",e.username===x&&e.is_user_message?t.classList.add("user-sent-message"):e.username==="System"?t.classList.add("system-message"):t.classList.add("audience-ai-message");const n=document.createElement("span");n.className="chat-line__username",n.style.color=e.username===x?"#9147FF":this.getRandomChatColor();const i=document.createElement("span");i.className="chat-author__display-name",i.textContent=e.username,n.appendChild(i);const r=document.createElement("span");r.textContent=": ",r.style.marginRight="0.3rem",r.className="text-fragment";const u=document.createElement("span");if(u.className="text-fragment",u.textContent=e.text,s.appendChild(n),s.appendChild(r),s.appendChild(u),t.appendChild(s),p.appendChild(t),y){const m=t.cloneNode(!0);y.appendChild(m),this.scrollToBottomOverlay()}this.scrollToBottom()}clearChat(){p&&(p.innerHTML="",console.log("Chat display cleared.")),y&&(y.innerHTML="")}scrollToBottom(){p&&(p.scrollTop=p.scrollHeight)}scrollToBottomOverlay(){y&&(y.scrollTop=y.scrollHeight)}getRandomChatColor(){const e=["#FF0000","#00FF00","#0000FF","#00FFFF","#FF00FF","#FF4500","#ADFF2F","#1E90FF","#FFD700","#8A2BE2","#00CED1","#FF69B4","#DA70D6","#BA55D3","#87CEEB","#32CD32","#CD853F"];return e[Math.floor(Math.random()*e.length)]}}function $(a,e,t){if(!g)return;const s=t==="bits"?"/sc_purple.png":"/sc_pink.png";g.innerHTML=`
2
+ <img src="${s}" class="sc-background-image" alt="Super Chat background">
3
+ <div class="sc-content">
4
+ <div class="sc-user">${a}</div>
5
+ <div class="sc-message">${e}</div>
6
+ </div>
7
+ `;const n=g.querySelector(".sc-message");n&&(n.style.color=t==="bits"?"var(--sc-purple-bg-color)":"var(--sc-pink-bg-color)"),g.classList.remove("hidden"),g.offsetHeight,g.classList.add("is-visible"),setTimeout(()=>{g.classList.remove("is-visible"),setTimeout(()=>{g.classList.add("hidden")},1e3)},9e3)}class W{constructor(e){o(this,"ws",null);o(this,"options");o(this,"reconnectAttempts",0);o(this,"reconnectTimeout",null);o(this,"explicitlyClosed",!1);this.options={reconnectInterval:3e3,maxReconnectAttempts:10,...e}}connect(){if(!this.options.url){console.warn("WebSocket URL is not set. Connection aborted.");return}if(this.ws&&(this.ws.readyState===WebSocket.OPEN||this.ws.readyState===WebSocket.CONNECTING)){console.warn(`WebSocket for ${this.options.url} is already connected or connecting.`);return}this.explicitlyClosed=!1,console.log(`Connecting to WebSocket: ${this.options.url}`),this.ws=new WebSocket(this.options.url),this.ws.onopen=()=>{var e,t;console.log(`WebSocket connected: ${this.options.url}`),this.reconnectAttempts=0,this.reconnectTimeout&&(clearTimeout(this.reconnectTimeout),this.reconnectTimeout=null),(t=(e=this.options).onOpen)==null||t.call(e)},this.ws.onmessage=e=>{var t,s;try{const n=JSON.parse(e.data);n.type==="processing_superchat"&&$(n.data.username,n.data.text,n.data.sc_type),(s=(t=this.options).onMessage)==null||s.call(t,n)}catch(n){console.error(`Error parsing message from ${this.options.url}:`,n,e.data)}},this.ws.onclose=e=>{var t,s,n,i;console.warn(`WebSocket closed: ${this.options.url}. Code: ${e.code}, Reason: ${e.reason}`),this.ws=null,(s=(t=this.options).onClose)==null||s.call(t,e),this.explicitlyClosed||((i=(n=this.options).onDisconnect)==null||i.call(n),this.options.autoReconnect&&e.code!==1e3&&this.tryReconnect())},this.ws.onerror=e=>{var t,s;console.error(`WebSocket error: ${this.options.url}`,e),(s=(t=this.options).onError)==null||s.call(t,e)}}tryReconnect(){if(this.options.maxReconnectAttempts===-1||this.reconnectAttempts<this.options.maxReconnectAttempts){this.reconnectAttempts++;const t=this.options.maxReconnectAttempts===-1?`(attempt ${this.reconnectAttempts})`:`(attempt ${this.reconnectAttempts}/${this.options.maxReconnectAttempts})`;console.log(`Attempting to reconnect to ${this.options.url} in ${this.options.reconnectInterval/1e3} seconds... ${t}`),this.reconnectTimeout=setTimeout(()=>{this.connect()},this.options.reconnectInterval)}else console.error(`Max reconnect attempts reached for ${this.options.url}.`)}send(e){this.ws&&this.ws.readyState===WebSocket.OPEN?this.ws.send(JSON.stringify(e)):console.warn(`WebSocket for ${this.options.url} is not open. Message not sent.`)}disconnect(){this.explicitlyClosed=!0,this.reconnectTimeout&&clearTimeout(this.reconnectTimeout),this.ws&&this.ws.close(1e3,"Client initiated disconnect")}updateOptions(e){console.log("WebSocket client options updated:",e),this.options={...this.options,...e}}getUrl(){return this.options.url}}const c=document.getElementById("neuro-caption"),T=document.getElementById("stream-display-area"),z=16,q=2,B=.4;function M(){if(!c||!T)return;c.style.fontSize="";const a=T.offsetHeight;if(c.textContent===""||a===0)return;if(c.offsetHeight>a*B){const t=window.getComputedStyle(c);let s=parseFloat(t.fontSize);for(;c.offsetHeight>a*B&&s>z;)s-=q,c.style.fontSize=`${s}px`;c.offsetHeight>a*B&&(c.style.fontSize=`${z}px`)}}let I=null,k=null;const H=3e3;function D(a,e){if(c)if(c.classList.add("show"),e&&a.trim().length>0){const t=a.split(/\s+/).filter(r=>r.length>0);if(t.length===0){c.textContent+=(c.textContent?" ":"")+a,M();return}const s=a.length;let n=c.textContent||"";const i=r=>{if(r<t.length){const u=t[r],m=u.length/s*e*1.01,h=Math.max(50,m*1e3);n+=(n.length>0?" ":"")+u,c.textContent=n,M(),I=setTimeout(()=>i(r+1),h)}else I=null};i(0),console.log(`Starting word-by-word caption for: "${a.substring(0,30)}..." (duration: ${e}s)`)}else c.textContent+=(c.textContent?" ":"")+a,M(),console.log(`Displaying full caption: "${a.substring(0,30)}..."`)}function A(){c&&(I&&(clearTimeout(I),I=null),k&&(clearTimeout(k),k=null),c.classList.remove("show"),c.textContent="",c.style.fontSize="",console.log("NeuroCaption hidden and cleared."))}function V(){k&&clearTimeout(k),k=setTimeout(()=>{A()},H)}!c||!T?console.error("neuroCaption.ts: Could not find #neuro-caption or #stream-display-area element."):console.log("NeuroCaption module initialized.");class j{constructor(){o(this,"audioQueue",[]);o(this,"isPlayingAudio",!1);o(this,"currentPlayingAudio",null);o(this,"allSegmentsReceived",!1);o(this,"errorSound");o(this,"lastSegmentEnd",!0);this.errorSound=new Audio("/error.mp3"),console.log("AudioPlayer initialized.")}playErrorSound(){this.stopAllAudio(),console.log("Playing dedicated error sound..."),this.errorSound.play().catch(e=>{console.error("Error playing dedicated error sound:",e)})}addAudioSegment(e,t,s){this.lastSegmentEnd&&A(),this.lastSegmentEnd=!1;const n=new Audio("data:audio/mp3;base64,"+t);try{const r=f.getAppInitializer().getMuteButton();n.muted=r.getIsMuted()}catch(i){console.warn("Could not get mute state, defaulting to muted:",i),n.muted=!0}this.audioQueue.push({text:e,audio:n,duration:s}),console.log(`Audio segment added to queue. Queue size: ${this.audioQueue.length}`),this.isPlayingAudio||this.playNextAudioSegment()}playNextAudioSegment(){if(this.audioQueue.length>0&&!this.isPlayingAudio){this.isPlayingAudio=!0;const e=this.audioQueue.shift();this.currentPlayingAudio=e.audio,D(e.text,e.duration),this.currentPlayingAudio.play().catch(t=>{console.error("Error playing audio segment:",t),this.isPlayingAudio=!1,this.currentPlayingAudio=null,this.playNextAudioSegment()}),this.currentPlayingAudio.addEventListener("ended",()=>{this.isPlayingAudio=!1,this.currentPlayingAudio=null,this.playNextAudioSegment()},{once:!0})}else if(this.audioQueue.length===0&&this.allSegmentsReceived){console.log("Neuro's full audio response played. Starting caption timeout and resetting zoom."),V();try{f.getAppInitializer().getNeuroAvatar().resetZoom()}catch(e){console.warn("Could not reset neuro avatar zoom at end of speech",e)}}}setAllSegmentsReceived(){this.allSegmentsReceived=!0,this.lastSegmentEnd=!0}stopAllAudio(){this.currentPlayingAudio&&(this.currentPlayingAudio.pause(),this.currentPlayingAudio.currentTime=0,this.currentPlayingAudio=null),this.audioQueue.length=0,this.isPlayingAudio=!1,this.allSegmentsReceived=!1,A();try{f.getAppInitializer().getNeuroAvatar().resetZoom()}catch(e){console.warn("Could not reset neuro avatar zoom on stop",e)}console.log("Neuro audio playback stopped, queue cleared.")}updateMuteState(){if(this.currentPlayingAudio)try{const t=f.getAppInitializer().getMuteButton();this.currentPlayingAudio.muted=t.getIsMuted()}catch(e){console.warn("Could not update current audio mute state:",e)}for(const e of this.audioQueue)try{const s=f.getAppInitializer().getMuteButton();e.audio.muted=s.getIsMuted()}catch(t){console.warn("Could not update queued audio mute state:",t)}}}const b=document.getElementById("startup-video-overlay"),d=document.getElementById("startup-video");class Q{constructor(){!b||!d?console.error("VideoPlayer: Required video elements not found in DOM!"):console.log("VideoPlayer initialized.")}showAndPlayVideo(e=0){if(!b||!d){console.error("VideoPlayer: Cannot show and play video, elements are missing.");return}b.classList.remove("hidden"),b.style.zIndex="10";const s=f.getAppInitializer().getMuteButton();d.muted=!1;const n=d.play();n!==void 0&&n.then(()=>{console.log("Unmuted autoplay successful."),this.seekTo(e)}).catch(i=>{console.warn("Unmuted autoplay failed. Showing unmute prompt and falling back to muted playback.",i),s.show(),d.muted=!0,d.play().then(()=>{console.log("Muted fallback playback started."),this.seekTo(e)}).catch(u=>{console.error("Muted fallback playback also failed. This is unexpected.",u)})})}seekTo(e){if(!d)return;const t=()=>{isFinite(d.duration)&&e>.1&&e<d.duration&&(d.currentTime=e,console.log(`Seek performed. Target: ${e.toFixed(2)}s.`))};d.readyState>=1?t():(console.log("Video metadata not ready, waiting for 'loadedmetadata' event to seek."),d.addEventListener("loadedmetadata",t,{once:!0}))}pauseAndMute(){d&&(d.pause(),d.muted=!0,console.log("Startup video paused and muted."))}hide(){b&&(b.classList.add("hidden"),console.log("Startup video overlay hidden."))}getVideoDuration(){return d&&!isNaN(d.duration)?d.duration:0}}const v={HIDDEN:"hidden",STEP1:"step1",STEP2:"step2"},l=document.getElementById("neuro-static-avatar-container");class J{constructor(){l?(console.log("NeuroAvatar initialized."),this.setStage(v.HIDDEN,!0)):console.error("NeuroAvatar: Required avatar container element not found in DOM!")}startIntroAnimation(e){console.log("Starting Neuro intro animation sequence..."),this.setStage(v.STEP1),setTimeout(()=>{console.log("Animating to Step 2..."),this.setStage(v.STEP2),setTimeout(()=>{console.log("Neuro intro animation sequence finished."),e&&e()},1e3)},2e3)}setStage(e,t=!1){if(!l)return;const s="transform 0.5s ease-in-out";switch(t?(l.style.transition="none",l.offsetHeight):e===v.STEP2?l.style.transition=`bottom 1s cubic-bezier(0.4, 0.0, 1, 1), ${s}`:l.style.transition=s,e){case v.HIDDEN:l.style.visibility="hidden",l.style.bottom="-207%",l.style.left="70%",l.style.zIndex="10";break;case v.STEP1:l.style.visibility="visible",l.style.bottom="-207%",l.style.left="70%",l.style.zIndex="15";break;case v.STEP2:l.style.visibility="visible",l.style.bottom="-125%",l.style.left="70%",l.style.zIndex="15";break}}triggerSpin(){l&&(console.log("Triggering avatar spin animation."),l.classList.add("spin-animation"),setTimeout(()=>{l.classList.remove("spin-animation"),console.log("Avatar spin animation finished.")},1e3))}triggerZoom(){l&&(console.log("Triggering avatar zoom-in animation."),l.classList.add("zoom-in"))}resetZoom(){l&&l.classList.contains("zoom-in")&&(console.log("Resetting avatar zoom."),l.classList.remove("zoom-in"))}}const C=document.getElementById("chat-input"),P=document.getElementById("send-button"),w=document.getElementById("sc-bits-button"),E=document.getElementById("sc-points-button");class X{constructor(){o(this,"onSendMessageCallback",null);!C||!P||!w||!E?console.error("UserInput: Required input elements not found in DOM!"):(this.setupEventListeners(),console.log("UserInput initialized."))}onSendMessage(e){this.onSendMessageCallback=e}setupEventListeners(){P.addEventListener("click",()=>this.handleSendMessage()),C.addEventListener("keypress",e=>{e.key==="Enter"&&this.handleSendMessage()}),w.addEventListener("click",()=>this.toggleSuperchatButton(w)),E.addEventListener("click",()=>this.toggleSuperchatButton(E))}toggleSuperchatButton(e){const t=e===w?E:w;e.classList.contains("selected")?e.classList.remove("selected"):(e.classList.add("selected"),t.classList.remove("selected"))}handleSendMessage(){const e=C.value.trim();if(!e){console.warn("Attempted to send empty message.");return}let t;const s=w.classList.contains("selected"),n=E.classList.contains("selected");s||n?t={type:"superchat",text:e,sc_type:s?"bits":"points"}:t={type:"user_message",text:e},this.onSendMessageCallback?this.onSendMessageCallback(t):console.warn("No callback registered for sending message."),C.value="",this.clearSuperchatSelection()}clearSuperchatSelection(){w.classList.remove("selected"),E.classList.remove("selected")}setInputDisabled(e){C.disabled=e,P.disabled=e,console.log(`User input elements disabled: ${e}`)}}class Z{constructor(){o(this,"viewportElement");o(this,"areaElement");o(this,"resizeObserver");if(this.viewportElement=document.getElementById("stream-display-viewport"),this.areaElement=document.getElementById("stream-display-area"),!this.viewportElement||!this.areaElement)throw new Error("LayoutManager: Required viewport or area element not found in DOM!");this.resizeObserver=new ResizeObserver(this.handleResize.bind(this))}handleResize(e){for(const t of e){const{width:s,height:n}=t.contentRect;this.updateLayout(s,n)}}updateLayout(e,t){if(e===0||t===0)return;const s=e/t,n=16/9;let i,r;s>n?(r=t,i=r*n):(i=e,r=i/n),this.areaElement.style.width=`${i}px`,this.areaElement.style.height=`${r}px`}start(){this.resizeObserver.observe(this.viewportElement),this.updateLayout(this.viewportElement.clientWidth,this.viewportElement.clientHeight),console.log("LayoutManager started and observing.")}stop(){this.resizeObserver.disconnect(),console.log("LayoutManager stopped.")}}class G{constructor(){o(this,"timerElement");o(this,"intervalId",null);o(this,"streamStartTime",0);if(this.timerElement=document.getElementById("stream-duration-text"),!this.timerElement)throw new Error("StreamTimer: Duration element '#stream-duration-text' not found!");this.reset()}formatTime(e){const t=Math.floor(e/3600),s=Math.floor(e%3600/60),n=Math.floor(e%60),i=r=>String(r).padStart(2,"0");return t>0?`${t}:${i(s)}:${i(n)}`:`${s}:${i(n)}`}updateDisplay(){if(this.streamStartTime>0){const t=(Date.now()-this.streamStartTime)/1e3;this.timerElement.textContent=this.formatTime(Math.max(0,t))}}start(e=0){this.stop(),this.streamStartTime=Date.now()-e*1e3,this.updateDisplay(),this.intervalId=window.setInterval(()=>this.updateDisplay(),1e3),console.log(`Stream timer started with initial ${e.toFixed(2)}s.`)}stop(){this.intervalId!==null&&(clearInterval(this.intervalId),this.intervalId=null,console.log("Stream timer stopped."))}reset(){this.stop(),this.streamStartTime=0,this.timerElement.textContent="0:00",console.log("Stream timer reset.")}}class Y{constructor(){o(this,"sidebarElement");o(this,"toggleButton");o(this,"showChatButton");o(this,"isCollapsed",!1);o(this,"bodyElement");if(this.sidebarElement=document.getElementById("chat-sidebar"),this.toggleButton=document.getElementById("toggle-chat-button"),this.showChatButton=document.getElementById("show-chat-button"),this.bodyElement=document.body,!this.sidebarElement||!this.toggleButton||!this.showChatButton)throw new Error("ChatSidebar: Required elements not found in DOM!");this.setupEventListeners(),this.setCollapsed(!1,!0),console.log("ChatSidebar initialized.")}setupEventListeners(){this.toggleButton.addEventListener("click",()=>this.toggleCollapse()),this.showChatButton.addEventListener("click",()=>this.toggleCollapse())}toggleCollapse(){this.setCollapsed(!this.isCollapsed)}setCollapsed(e,t=!1){this.isCollapsed=e,this.isCollapsed?this.bodyElement.classList.add("chat-collapsed"):this.bodyElement.classList.remove("chat-collapsed"),t?(this.sidebarElement.style.transition="none",this.toggleButton.style.transition="none",this.showChatButton.style.transition="none"):(this.sidebarElement.style.transition="width 0.3s ease-in-out, min-width 0.3s ease-in-out",this.toggleButton.style.transition="transform 0.3s ease-in-out, background-color 0.2s, color 0.2s",this.showChatButton.style.transition="opacity 0.3s ease-in-out, visibility 0.3s ease-in-out"),this.isCollapsed?(this.sidebarElement.classList.add("collapsed"),this.toggleButton.setAttribute("aria-label","展开聊天"),this.sidebarElement.querySelectorAll(":scope > *:not(.chat-sidebar-header)").forEach(s=>{s.style.opacity="0",s.style.pointerEvents="none"}),console.log("Chat sidebar collapsed.")):(this.sidebarElement.classList.remove("collapsed"),this.toggleButton.setAttribute("aria-label","重叠聊天"),this.sidebarElement.querySelectorAll(":scope > *:not(.chat-sidebar-header)").forEach(s=>{s.style.opacity="1",s.style.pointerEvents="auto"}),console.log("Chat sidebar expanded.")),t&&requestAnimationFrame(()=>{requestAnimationFrame(()=>{this.sidebarElement.style.transition="",this.toggleButton.style.transition="",this.showChatButton.style.transition=""})})}getIsCollapsed(){return this.isCollapsed}}class K{constructor(){o(this,"indicatorElement");if(this.indicatorElement=document.querySelector(".live-indicator-rect"),!this.indicatorElement)throw new Error("LiveIndicator: Required .live-indicator-rect element not found in DOM!");this.hide()}show(){this.indicatorElement.classList.remove("hidden")}hide(){this.indicatorElement.classList.add("hidden")}}class ee{constructor(){o(this,"nicknameElement");o(this,"titleElement");o(this,"categoryElement");o(this,"tagsContainer");if(this.nicknameElement=document.getElementById("streamer-nickname"),this.titleElement=document.getElementById("stream-title-full"),this.categoryElement=document.querySelector(".stream-category"),this.tagsContainer=document.querySelector(".stream-tags"),!this.nicknameElement||!this.titleElement||!this.categoryElement||!this.tagsContainer)throw new Error("StreamInfoDisplay: One or more required elements not found in DOM!");console.log("StreamInfoDisplay initialized.")}update(e){this.nicknameElement.textContent=e.streamer_nickname,this.titleElement.textContent=e.stream_title,this.categoryElement.textContent=e.stream_category,this.tagsContainer.innerHTML="",e.stream_tags.forEach(t=>{const s=document.createElement("a");s.href="#",s.className="stream-tag",s.textContent=t,this.tagsContainer.appendChild(s)}),console.log("Stream info display updated with new metadata.")}}class te{constructor(){o(this,"wakeLockSentinel",null);o(this,"isSupported");this.isSupported="wakeLock"in navigator,this.isSupported?console.log("WakeLockManager initialized. API is supported."):console.warn("Wake Lock API is not supported in this browser. The device may go to sleep during playback.")}async requestWakeLock(){if(!(!this.isSupported||this.wakeLockSentinel))try{this.wakeLockSentinel=await navigator.wakeLock.request("screen"),this.wakeLockSentinel.addEventListener("release",()=>{console.log("Wake Lock was released by the browser."),this.wakeLockSentinel=null}),console.log("Wake Lock is active."),document.addEventListener("visibilitychange",this.handleVisibilityChange.bind(this))}catch(e){console.error(`Failed to acquire Wake Lock: ${e.name}, ${e.message}`),this.wakeLockSentinel=null}}async releaseWakeLock(){this.wakeLockSentinel&&(await this.wakeLockSentinel.release(),this.wakeLockSentinel=null,console.log("Wake Lock has been released.")),document.removeEventListener("visibilitychange",this.handleVisibilityChange.bind(this))}async handleVisibilityChange(){this.wakeLockSentinel===null&&document.visibilityState==="visible"&&(console.log("Page is visible again, re-acquiring Wake Lock..."),await this.requestWakeLock())}}class L{constructor(e){o(this,"modalContainer");o(this,"overlay");o(this,"closeButton");o(this,"saveButton");o(this,"usernameInput");o(this,"backendUrlInput");o(this,"avatarPreview");o(this,"avatarUploadInput");o(this,"avatarUploadButton");o(this,"reconnectAttemptsInput");o(this,"onSave");if(this.onSave=e,this.modalContainer=document.getElementById("settings-modal"),this.overlay=document.getElementById("settings-modal-overlay"),this.closeButton=document.getElementById("settings-close-button"),this.saveButton=document.getElementById("settings-save-button"),this.usernameInput=document.getElementById("username-setting-input"),this.backendUrlInput=document.getElementById("backend-url-input"),this.avatarPreview=document.getElementById("avatar-setting-preview"),this.avatarUploadInput=document.getElementById("avatar-setting-upload"),this.avatarUploadButton=document.getElementById("avatar-upload-button"),this.reconnectAttemptsInput=document.getElementById("reconnect-attempts-input"),!this.modalContainer)throw new Error("Settings modal container not found!");this.setupEventListeners(),console.log("SettingsModal initialized.")}setupEventListeners(){this.closeButton.addEventListener("click",()=>this.close()),this.overlay.addEventListener("click",()=>this.close()),this.saveButton.addEventListener("click",()=>this.handleSave()),this.avatarUploadButton.addEventListener("click",()=>this.avatarUploadInput.click()),this.avatarUploadInput.addEventListener("change",e=>this.handleAvatarUpload(e))}handleAvatarUpload(e){const t=e.target;if(t.files&&t.files[0]){const s=new FileReader;s.onload=n=>{var i;(i=n.target)!=null&&i.result&&(this.avatarPreview.src=n.target.result)},s.readAsDataURL(t.files[0])}}handleSave(){const e={username:this.usernameInput.value.trim()||"User",avatarDataUrl:this.avatarPreview.src,backendUrl:this.backendUrlInput.value.trim(),reconnectAttempts:parseInt(this.reconnectAttemptsInput.value,10)||-1};localStorage.setItem("neuro_settings",JSON.stringify(e)),this.onSave(e),this.close()}open(){this.loadSettings(),this.modalContainer.classList.remove("hidden")}close(){this.modalContainer.classList.add("hidden")}loadSettings(){const e=L.getSettings();this.usernameInput.value=e.username,this.avatarPreview.src=e.avatarDataUrl,this.backendUrlInput.value=e.backendUrl,this.reconnectAttemptsInput.value=String(e.reconnectAttempts)}static getSettings(){const e=localStorage.getItem("neuro_settings");if(e)try{return JSON.parse(e)}catch(t){console.error("Failed to parse settings from localStorage, returning defaults.",t)}return{username:"One_of_Swarm",avatarDataUrl:"/user_avatar.jpg",backendUrl:"ws://127.0.0.1:8000",reconnectAttempts:-1}}}class se{constructor(){o(this,"button",null);o(this,"isMuted",!0)}create(){return this.button=document.getElementById("mute-button"),this.button?this.button.addEventListener("click",e=>{e.stopPropagation(),this.unmute()}):console.error("Mute button element not found in DOM!"),this.button}show(){this.button&&(this.button.style.display="flex")}hide(){this.button&&(this.button.style.display="none")}unmute(){this.isMuted=!1,this.hide(),this.updateMediaElements()}updateMediaElements(){const e=document.getElementById("startup-video");e&&(e.muted=this.isMuted);try{f.getAppInitializer().getAudioPlayer().updateMuteState()}catch(t){console.warn("Could not update audio player mute state:",t)}}getElement(){return this.button}getIsMuted(){return this.isMuted}}async function ne(a,e={},t){return window.__TAURI_INTERNALS__.invoke(a,e,t)}const ie=typeof window<"u"&&window.__TAURI__!==void 0,oe="3546729368520811",ae="4281748";async function re(){var a,e;try{if(ie)return console.log("Running in Tauri, invoking 'get_latest_replay_video' command..."),await ne("get_latest_replay_video");{console.log("Running in Web, fetching from proxy...");const t=`/bilibili-api/x/series/archives?mid=${oe}&series_id=${ae}&ps=1&pn=1`,s=await fetch(t);if(!s.ok)throw new Error(`Failed to fetch from proxy: ${s.statusText}`);const n=await s.json();if(n.code!==0)throw new Error(`Bilibili API error: ${n.message}`);const i=(e=(a=n==null?void 0:n.data)==null?void 0:a.archives)==null?void 0:e[0];if(i&&i.bvid&&i.aid)return i;throw new Error("No matching video found in API response.")}}catch(t){return console.error("Failed to get latest replay video:",t),null}}function le(a){const e="//www.bilibili.com/blackboard/html5mobileplayer.html",t=new URLSearchParams({bvid:a.bvid,aid:String(a.aid),p:"1",autoplay:"1",danmaku:"0",hasMuteButton:"1",hideCoverInfo:"0",fjw:"0",high_quality:"1"});return`${e}?${t.toString()}`}class ce{constructor(){o(this,"wsClient");o(this,"audioPlayer");o(this,"videoPlayer");o(this,"neuroAvatar");o(this,"chatDisplay");o(this,"userInput");o(this,"layoutManager");o(this,"streamTimer");o(this,"chatSidebar");o(this,"liveIndicator");o(this,"streamInfoDisplay");o(this,"wakeLockManager");o(this,"settingsModal");o(this,"currentSettings");o(this,"muteButton");o(this,"resizeObserver",null);o(this,"offlinePlayerSrc",null);o(this,"isStarted",!1);o(this,"currentPhase","offline");o(this,"adjustOfflineLayout",()=>{if(this.currentPhase!=="offline")return;const e=document.getElementById("offline-content-container"),t=document.querySelector(".offline-video-player"),s=document.querySelector(".offline-info-card");if(!e||!t||!s)return;if(window.innerWidth<=767)e.style.flexWrap="wrap",s.style.width=t.offsetWidth+"px",s.style.height="auto",s.style.flex="0 0 auto";else{e.style.flexWrap="nowrap";const i=t.offsetHeight;i>0&&(s.style.height=`${i}px`,s.style.width=`${i}px`),s.style.flex="0 1 auto"}});this.layoutManager=new Z,this.streamTimer=new G,this.muteButton=new se,this.currentSettings=L.getSettings(),this.settingsModal=new L(t=>this.handleSettingsUpdate(t)),this.wsClient=null,this.audioPlayer=new j,this.videoPlayer=new Q,this.neuroAvatar=new J,this.chatDisplay=new F,this.userInput=new X,this.userInput.onSendMessage(t=>this.sendUserMessage(t)),this.chatSidebar=new Y,this.liveIndicator=new K,this.streamInfoDisplay=new ee,this.wakeLockManager=new te,this.setupSettingsModalTrigger(),this.setupMuteButton();const e=document.querySelector(".offline-video-player");e&&(this.offlinePlayerSrc=e.src),this.updateOfflinePlayerSrc()}start(){this.isStarted||(this.isStarted=!0,this.probeForIntegratedServer(),this.layoutManager.start(),this.goOffline(),this.updateUiWithSettings())}setupSettingsModalTrigger(){const e=document.querySelector(".nav-user-avatar-button");e&&e.addEventListener("click",()=>{this.settingsModal.open()})}setupMuteButton(){if(this.muteButton.create()){this.muteButton.show();const t=()=>{this.muteButton.unmute(),document.removeEventListener("click",t)};document.addEventListener("click",t)}}getMuteButton(){return this.muteButton}getAudioPlayer(){return this.audioPlayer}getNeuroAvatar(){return this.neuroAvatar}handleSettingsUpdate(e){if(console.log("Settings updated. Re-initializing connection with new settings:",e),this.currentSettings=e,this.updateUiWithSettings(),this.wsClient){const t=e.backendUrl?`${e.backendUrl}/ws/stream`:"";this.wsClient.updateOptions({url:t,maxReconnectAttempts:e.reconnectAttempts}),this.wsClient.disconnect(),setTimeout(()=>{this.wsClient&&this.wsClient.getUrl()?this.wsClient.connect():console.warn("Cannot connect: Backend URL is empty after update or WebSocket client not ready.")},500)}else console.warn("WebSocket client not initialized, cannot update settings.")}initWebSocketClient(e){const t=e?`${e}/ws/stream`:"",s=n=>this.handleWebSocketMessage(n);this.wsClient?(this.wsClient.updateOptions({url:t,autoReconnect:!0,maxReconnectAttempts:this.currentSettings.reconnectAttempts,onMessage:s,onOpen:()=>this.goOnline(),onDisconnect:()=>this.goOffline()}),t&&(this.wsClient.disconnect(),setTimeout(()=>{this.wsClient.connect()},500))):this.wsClient=new W({url:t,autoReconnect:!0,maxReconnectAttempts:this.currentSettings.reconnectAttempts,onMessage:s,onOpen:()=>this.goOnline(),onDisconnect:()=>this.goOffline()})}async probeForIntegratedServer(){const e=L.getSettings();console.log("Probing for integrated server. Stored settings:",e);try{const t=new URL("/api/system/health",window.location.origin).toString();console.log("Probing integrated server at:",t);const s=await fetch(t);if(s.ok){console.log("Integrated server detected via health check. Auto-connecting...");const n=window.location.origin;this.currentSettings={...this.currentSettings,backendUrl:n},localStorage.setItem("neuro_settings",JSON.stringify(this.currentSettings)),this.initWebSocketClient(n),this.wsClient&&n&&this.wsClient.connect();return}else console.log("Health check failed, not an integrated server. Status:",s.status)}catch(t){console.log("Failed to probe for integrated server, assuming standalone mode.",t)}console.log("Falling back to stored backend URL:",e.backendUrl),this.initWebSocketClient(e.backendUrl),this.wsClient&&e.backendUrl?this.wsClient.connect():e.backendUrl||(console.warn("Backend URL is not configured via probe or stored settings. Opening settings modal."),this.settingsModal.open())}updateUiWithSettings(){document.querySelectorAll(".user-avatar-img").forEach(t=>t.src=this.currentSettings.avatarDataUrl),console.log(`UI updated with username: ${this.currentSettings.username} and avatar.`)}async updateOfflinePlayerSrc(){console.log("Attempting to fetch the latest replay video...");const e=await re();if(e){const t=le(e);if(this.offlinePlayerSrc=t,console.log("Successfully updated offline player src to:",t),this.currentPhase==="offline"){const s=document.querySelector(".offline-video-player");s&&(s.src=this.offlinePlayerSrc)}}else console.log("Failed to fetch latest replay video, using default fallback.")}goOnline(){var s,n,i,r;console.log("Entering ONLINE state."),this.updateUiWithSettings();const e=document.querySelector(".offline-video-player");e&&(e.src="about:blank"),this.resizeObserver&&(this.resizeObserver.disconnect(),this.resizeObserver=null),window.removeEventListener("resize",this.adjustOfflineLayout);const t=document.querySelector(".offline-info-card");t&&(t.style.height="",t.style.width=""),(s=document.getElementById("offline-content-container"))==null||s.classList.add("hidden"),(n=document.getElementById("stream-display-viewport"))==null||n.classList.remove("hidden"),(i=document.querySelector(".stream-info-details-row"))==null||i.classList.remove("hidden"),(r=document.getElementById("chat-sidebar"))==null||r.classList.remove("hidden"),this.showStreamContent(),this.chatDisplay.clearChat(),this.liveIndicator.show(),this.wakeLockManager.requestWakeLock()}goOffline(){var s,n,i,r;console.log("Entering OFFLINE state."),this.currentPhase="offline";const e=document.querySelector(".offline-video-player");e&&this.offlinePlayerSrc&&(e.src=this.offlinePlayerSrc),(s=document.getElementById("offline-content-container"))==null||s.classList.remove("hidden"),(n=document.getElementById("stream-display-viewport"))==null||n.classList.add("hidden"),(i=document.querySelector(".stream-info-details-row"))==null||i.classList.add("hidden"),(r=document.getElementById("chat-sidebar"))==null||r.classList.add("hidden"),this.hideStreamContent(),this.audioPlayer.stopAllAudio(),this.videoPlayer.hide(),this.neuroAvatar.setStage("hidden",!0),A(),this.streamTimer.stop(),this.streamTimer.reset(),this.chatDisplay.clearChat(),this.liveIndicator.hide(),this.wakeLockManager.releaseWakeLock(),this.muteButton.show();const t=()=>{this.muteButton.unmute(),document.removeEventListener("click",t)};document.addEventListener("click",t),setTimeout(()=>{this.adjustOfflineLayout();const u=document.querySelector(".offline-video-player");u&&!this.resizeObserver&&(this.resizeObserver=new ResizeObserver(this.adjustOfflineLayout),this.resizeObserver.observe(u),window.addEventListener("resize",this.adjustOfflineLayout))},0)}handleWebSocketMessage(e){switch(this.currentPhase==="offline"&&["play_welcome_video","start_avatar_intro","enter_live_phase"].includes(e.type)&&(console.log("Connection successful, transitioning from OFFLINE to active state."),this.goOnline()),e.elapsed_time_sec!==void 0&&this.streamTimer.start(e.elapsed_time_sec),e.type){case"offline":this.goOffline();break;case"model_spin":this.neuroAvatar.triggerSpin();break;case"model_zoom":this.neuroAvatar.triggerZoom();break;case"update_stream_metadata":this.streamInfoDisplay.update(e);break;case"play_welcome_video":const t=parseFloat(e.progress);this.currentPhase!=="offline"?this.videoPlayer.seekTo(t):(this.currentPhase="initializing",this.videoPlayer.showAndPlayVideo(t));break;case"start_avatar_intro":this.currentPhase="avatar_intro",this.videoPlayer.pauseAndMute(),this.neuroAvatar.startIntroAnimation(()=>{this.videoPlayer.hide()});break;case"enter_live_phase":this.currentPhase="live",this.videoPlayer.hide(),this.neuroAvatar.setStage("step2");break;case"neuro_is_speaking":break;case"neuro_speech_segment":const s=e;s.is_end?this.audioPlayer.setAllSegmentsReceived():s.audio_base64&&s.text&&typeof s.duration=="number"?this.audioPlayer.addAudioSegment(s.text,s.audio_base64,s.duration):console.warn("Received neuro_speech_segment message with missing audio/text/duration:",s);break;case"neuro_error_signal":console.warn("Received neuro_error_signal from backend."),D("Someone tell Vedal there is a problem with my AI."),this.audioPlayer.playErrorSound();break;case"chat_message":(!this.chatSidebar.getIsCollapsed()||e.is_user_message)&&this.chatDisplay.appendChatMessage(e);break;case"error":this.chatDisplay.appendChatMessage({type:"chat_message",username:"System",text:`后端错误: ${e.message}`,is_user_message:!1});break}}sendUserMessage(e){const t={username:this.currentSettings.username,...e};this.wsClient?this.wsClient.send(t):console.warn("Cannot send message: WebSocket client is not initialized.")}showStreamContent(){const e=document.getElementById("stream-display-area");e&&(e.style.visibility="visible",e.style.opacity="1")}hideStreamContent(){const e=document.getElementById("stream-display-area");e&&(e.style.visibility="hidden",e.style.opacity="0")}}const S=class S{constructor(){o(this,"appInitializerInstance",null)}static getInstance(){return S.instance||(S.instance=new S),S.instance}getAppInitializer(){return this.appInitializerInstance?console.log("Returning existing AppInitializer instance."):(console.log("Creating new AppInitializer instance..."),this.appInitializerInstance=new ce),this.appInitializerInstance}};o(S,"instance");let _=S;const f=_.getInstance();document.addEventListener("DOMContentLoaded",()=>{console.log("DOMContentLoaded event fired."),f.getAppInitializer().start()});console.log("main.ts loaded. Waiting for DOMContentLoaded to initialize the app.");
@@ -5,7 +5,7 @@
5
5
  <link rel="icon" type="image/x-icon" href="/favicon.ico" />
6
6
  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
7
7
  <title>𝐯𝐞𝐝𝐚𝐥𝟗𝟖𝟕 - 𝐓𝐰𝐢𝐭𝐜𝐡</title>
8
- <script type="module" crossorigin src="/assets/index-BHgW05Wx.js"></script>
8
+ <script type="module" crossorigin src="/assets/index-vrP1Bqp5.js"></script>
9
9
  <link rel="stylesheet" crossorigin href="/assets/index-rmyQl8Tr.css">
10
10
  </head>
11
11
  <body>
Binary file
@@ -69,6 +69,63 @@ app.add_middleware(
69
69
  app.include_router(system_router)
70
70
 
71
71
 
72
+ # --- Bilibili API Proxy ---
73
+ import httpx
74
+ from fastapi import Request, Response
75
+
76
+ @app.api_route("/bilibili-api/{path:path}", methods=["GET", "POST", "PUT", "DELETE", "PATCH", "OPTIONS"])
77
+ async def proxy_bilibili(request: Request, path: str):
78
+ """
79
+ Reverse proxies requests from /bilibili-api/{path} to https://api.bilibili.com/{path}.
80
+ This is necessary to bypass CORS restrictions on the Bilibili API when the client
81
+ is served directly from the backend.
82
+ """
83
+ async with httpx.AsyncClient() as client:
84
+ # Construct the target URL
85
+ url = f"https://api.bilibili.com/{path}"
86
+
87
+ # Prepare headers for the outgoing request.
88
+ # Do NOT forward all headers from the client. Instead, create a clean
89
+ # request with only the headers Bilibili is known to require,
90
+ # mimicking the working Nginx configuration. This prevents potentially
91
+ # problematic client headers from being passed through.
92
+ headers = {
93
+ 'Host': 'api.bilibili.com',
94
+ 'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.124 Safari/537.36',
95
+ 'Referer': 'https://www.bilibili.com/',
96
+ 'Origin': 'https://www.bilibili.com'
97
+ }
98
+
99
+ # Read the body of the incoming request
100
+ body = await request.body()
101
+
102
+ # Make the proxied request
103
+ try:
104
+ response = await client.request(
105
+ method=request.method,
106
+ url=url,
107
+ content=body,
108
+ headers=headers,
109
+ params=request.query_params,
110
+ timeout=20.0 # Add a reasonable timeout
111
+ )
112
+
113
+ # Filter headers for the response to the client
114
+ response_headers = {k: v for k, v in response.headers.items() if k.lower() not in [
115
+ 'content-encoding', 'content-length', 'transfer-encoding', 'connection'
116
+ ]}
117
+
118
+ # Return the response from the Bilibili API to the client
119
+ return Response(
120
+ content=response.content,
121
+ status_code=response.status_code,
122
+ headers=response_headers
123
+ )
124
+ except httpx.RequestError as e:
125
+ logger.error(f"Bilibili proxy request failed: {e}")
126
+ return Response(content=f"Failed to proxy request to Bilibili API: {e}", status_code=502)
127
+
128
+
72
129
  # --- Redirect for trailing slash on dashboard ---
73
130
  from fastapi.responses import RedirectResponse
74
131
  @app.get("/dashboard", include_in_schema=False)
@@ -234,6 +291,23 @@ async def neuro_response_cycle():
234
291
  @app.on_event("startup")
235
292
  async def startup_event():
236
293
  """Actions to perform on application startup."""
294
+ # --- Custom Exception Handler for Benign Connection Errors ---
295
+ # This is to suppress the benign "ConnectionResetError" that asyncio's Proactor
296
+ # event loop on Windows logs when a client disconnects abruptly. This error is
297
+ # not catchable at the application level, so we handle it here.
298
+ loop = asyncio.get_event_loop()
299
+
300
+ def custom_exception_handler(loop, context):
301
+ exception = context.get("exception")
302
+ if isinstance(exception, ConnectionResetError):
303
+ logger.debug(f"Suppressing benign ConnectionResetError: {context.get('message')}")
304
+ else:
305
+ # If it's not the error we want to suppress, call the default handler.
306
+ # This ensures other important errors are still logged.
307
+ loop.default_exception_handler(context)
308
+
309
+ loop.set_exception_handler(custom_exception_handler)
310
+
237
311
  # --- Mount Frontend ---
238
312
  # This logic is placed here to run at runtime, ensuring all package paths are finalized.
239
313
  from fastapi.responses import FileResponse
@@ -360,7 +434,7 @@ async def websocket_stream_endpoint(websocket: WebSocket):
360
434
  if sc_message["text"]:
361
435
  app_state.superchat_queue.append(sc_message)
362
436
 
363
- except WebSocketDisconnect:
437
+ except (WebSocketDisconnect, ConnectionResetError):
364
438
  pass
365
439
  finally:
366
440
  connection_manager.disconnect(websocket)
@@ -371,37 +445,45 @@ async def websocket_admin_endpoint(websocket: WebSocket):
371
445
  # Add the new admin client to a dedicated list
372
446
  connection_manager.admin_connections.append(websocket)
373
447
  try:
374
- # Send initial state
375
- for log_entry in list(server_log_queue): await websocket.send_json({"type": "server_log", "data": log_entry})
376
- for log_entry in list(agent_log_queue): await websocket.send_json({"type": "agent_log", "data": log_entry})
377
-
378
- agent = await create_agent()
379
- initial_context = await agent.get_message_history()
380
- await websocket.send_json({"type": "agent_context", "action": "update", "messages": initial_context})
381
-
382
- # Send initial stream status
383
- status = {"is_running": process_manager.is_running, "backend_status": "running" if process_manager.is_running else "stopped"}
384
- await websocket.send_json({"type": "stream_status", "payload": status})
385
-
448
+ # Wrap initial state sending in its own try-except block.
449
+ try:
450
+ # Send initial state
451
+ for log_entry in list(server_log_queue): await websocket.send_json({"type": "server_log", "data": log_entry})
452
+ for log_entry in list(agent_log_queue): await websocket.send_json({"type": "agent_log", "data": agent_log_queue.popleft()})
453
+
454
+ agent = await create_agent()
455
+ initial_context = await agent.get_message_history()
456
+ await websocket.send_json({"type": "agent_context", "action": "update", "messages": initial_context})
457
+
458
+ # Send initial stream status
459
+ status = {"is_running": process_manager.is_running, "backend_status": "running" if process_manager.is_running else "stopped"}
460
+ await websocket.send_json({"type": "stream_status", "payload": status})
461
+ except (WebSocketDisconnect, ConnectionResetError):
462
+ # If client disconnects during initial send, just exit the function.
463
+ # The 'finally' block will ensure cleanup.
464
+ return
465
+
386
466
  # Main loop for receiving messages from the client and pushing log updates
387
467
  while websocket.client_state == WebSocketState.CONNECTED:
388
- # Check for incoming messages
389
468
  try:
390
- raw_data = await asyncio.wait_for(websocket.receive_text(), timeout=0.01)
391
- data = json.loads(raw_data)
392
- await handle_admin_ws_message(websocket, data)
393
- except asyncio.TimeoutError:
394
- pass # No message received, continue to push logs
395
-
396
- # Push log updates
397
- if server_log_queue: await websocket.send_json({"type": "server_log", "data": server_log_queue.popleft()})
398
- if agent_log_queue: await websocket.send_json({"type": "agent_log", "data": agent_log_queue.popleft()})
399
- await asyncio.sleep(0.1)
400
-
401
- except WebSocketDisconnect:
402
- pass
469
+ # Check for incoming messages
470
+ try:
471
+ raw_data = await asyncio.wait_for(websocket.receive_text(), timeout=0.01)
472
+ data = json.loads(raw_data)
473
+ await handle_admin_ws_message(websocket, data)
474
+ except asyncio.TimeoutError:
475
+ pass # No message received, continue to push logs
476
+
477
+ # Push log updates
478
+ if server_log_queue: await websocket.send_json({"type": "server_log", "data": server_log_queue.popleft()})
479
+ if agent_log_queue: await websocket.send_json({"type": "agent_log", "data": agent_log_queue.popleft()})
480
+ await asyncio.sleep(0.1)
481
+ except (WebSocketDisconnect, ConnectionResetError):
482
+ # Client disconnected, break the loop to allow cleanup.
483
+ break
403
484
  finally:
404
- connection_manager.admin_connections.remove(websocket)
485
+ if websocket in connection_manager.admin_connections:
486
+ connection_manager.admin_connections.remove(websocket)
405
487
  logger.info("Admin WebSocket client disconnected.")
406
488
 
407
489
  async def handle_admin_ws_message(websocket: WebSocket, data: dict):
@@ -1,2 +1,2 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/ContextTab-Cv2a7xRF.js","assets/index-Sav9Djr5.js","assets/index-D2ait7Ff.css","assets/ContextTab-DyPsixHQ.css","assets/MemoryTab-BMDqRcHX.js","assets/MemoryTab-DPthi6jg.css","assets/ToolsTab-Ds4M2VeQ.js","assets/LogsTab-C7r21Vcz.js","assets/LogsTab-wg3i3S6b.css"])))=>i.map(i=>d[i]);
2
- import{d as C,j as k,k as I,l as L,n as c,z as P,e as t,g as v,w as o,b as n,f as a,h as d,q as r,s as u,o as f,_ as D}from"./index-Sav9Djr5.js";const N={class:"agent-view-wrapper"},O={key:0,class:"overlay"},R={class:"overlay-content"},B=C({__name:"AgentView",setup(z){const g=r(()=>u(()=>import("./ContextTab-Cv2a7xRF.js"),__vite__mapDeps([0,1,2,3]))),b=r(()=>u(()=>import("./MemoryTab-BMDqRcHX.js"),__vite__mapDeps([4,1,2,5]))),V=r(()=>u(()=>import("./ToolsTab-Ds4M2VeQ.js"),__vite__mapDeps([6,1,2]))),w=r(()=>u(()=>import("./LogsTab-C7r21Vcz.js"),__vite__mapDeps([7,1,2,8]))),m=k(),s=I("context"),p=L(()=>m.config?.agent_type&&m.config.agent_type!=="builtin");return(S,e)=>{const x=n("v-icon"),l=n("v-tab"),y=n("v-tabs"),_=n("v-window-item"),E=n("v-window"),T=n("v-card-text"),A=n("v-card");return f(),c("div",N,[p.value?(f(),c("div",O,[v("div",R,[t(x,{size:"x-large",class:"mb-4"},{default:o(()=>[...e[2]||(e[2]=[a("mdi-link-variant",-1)])]),_:1}),e[3]||(e[3]=v("h2",{class:"text-h5"},"当前正在调用外部 Agent",-1)),e[4]||(e[4]=v("p",{class:"text-body-1"},"请前往相应平台进行控制",-1))])])):P("",!0),t(A,{disabled:p.value},{default:o(()=>[t(y,{modelValue:s.value,"onUpdate:modelValue":e[0]||(e[0]=i=>s.value=i),"bg-color":"primary",grow:""},{default:o(()=>[t(l,{value:"context"},{default:o(()=>[...e[5]||(e[5]=[a("对话",-1)])]),_:1}),t(l,{value:"memory"},{default:o(()=>[...e[6]||(e[6]=[a("记忆",-1)])]),_:1}),t(l,{value:"tools"},{default:o(()=>[...e[7]||(e[7]=[a("工具",-1)])]),_:1}),t(l,{value:"logs"},{default:o(()=>[...e[8]||(e[8]=[a("日志",-1)])]),_:1})]),_:1},8,["modelValue"]),t(T,null,{default:o(()=>[t(E,{modelValue:s.value,"onUpdate:modelValue":e[1]||(e[1]=i=>s.value=i)},{default:o(()=>[t(_,{value:"context"},{default:o(()=>[t(d(g))]),_:1}),t(_,{value:"memory"},{default:o(()=>[t(d(b))]),_:1}),t(_,{value:"tools"},{default:o(()=>[t(d(V))]),_:1}),t(_,{value:"logs"},{default:o(()=>[t(d(w))]),_:1})]),_:1},8,["modelValue"])]),_:1})]),_:1},8,["disabled"])])}}}),j=D(B,[["__scopeId","data-v-871d2dc1"]]);export{j as default};
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/ContextTab-B2h9psAa.js","assets/index-CAD8DrUm.js","assets/index-w6MKUyz9.css","assets/ContextTab-Cf-FBreH.css","assets/MemoryTab-D49sjqDT.js","assets/MemoryTab-DPthi6jg.css","assets/ToolsTab-DbZ5EIry.js","assets/LogsTab-D6Rjw8zO.js","assets/LogsTab-wg3i3S6b.css"])))=>i.map(i=>d[i]);
2
+ import{d as C,j as k,k as I,l as L,n as c,z as P,e as t,g as v,w as o,b as n,f as a,h as d,q as r,s as u,o as f,_ as D}from"./index-CAD8DrUm.js";const N={class:"agent-view-wrapper"},O={key:0,class:"overlay"},R={class:"overlay-content"},B=C({__name:"AgentView",setup(z){const g=r(()=>u(()=>import("./ContextTab-B2h9psAa.js"),__vite__mapDeps([0,1,2,3]))),b=r(()=>u(()=>import("./MemoryTab-D49sjqDT.js"),__vite__mapDeps([4,1,2,5]))),V=r(()=>u(()=>import("./ToolsTab-DbZ5EIry.js"),__vite__mapDeps([6,1,2]))),w=r(()=>u(()=>import("./LogsTab-D6Rjw8zO.js"),__vite__mapDeps([7,1,2,8]))),m=k(),s=I("context"),p=L(()=>m.config?.agent_type&&m.config.agent_type!=="builtin");return(S,e)=>{const x=n("v-icon"),l=n("v-tab"),y=n("v-tabs"),_=n("v-window-item"),E=n("v-window"),T=n("v-card-text"),A=n("v-card");return f(),c("div",N,[p.value?(f(),c("div",O,[v("div",R,[t(x,{size:"x-large",class:"mb-4"},{default:o(()=>[...e[2]||(e[2]=[a("mdi-link-variant",-1)])]),_:1}),e[3]||(e[3]=v("h2",{class:"text-h5"},"当前正在调用外部 Agent",-1)),e[4]||(e[4]=v("p",{class:"text-body-1"},"请前往相应平台进行控制",-1))])])):P("",!0),t(A,{disabled:p.value},{default:o(()=>[t(y,{modelValue:s.value,"onUpdate:modelValue":e[0]||(e[0]=i=>s.value=i),"bg-color":"primary",grow:""},{default:o(()=>[t(l,{value:"context"},{default:o(()=>[...e[5]||(e[5]=[a("对话",-1)])]),_:1}),t(l,{value:"memory"},{default:o(()=>[...e[6]||(e[6]=[a("记忆",-1)])]),_:1}),t(l,{value:"tools"},{default:o(()=>[...e[7]||(e[7]=[a("工具",-1)])]),_:1}),t(l,{value:"logs"},{default:o(()=>[...e[8]||(e[8]=[a("日志",-1)])]),_:1})]),_:1},8,["modelValue"]),t(T,null,{default:o(()=>[t(E,{modelValue:s.value,"onUpdate:modelValue":e[1]||(e[1]=i=>s.value=i)},{default:o(()=>[t(_,{value:"context"},{default:o(()=>[t(d(g))]),_:1}),t(_,{value:"memory"},{default:o(()=>[t(d(b))]),_:1}),t(_,{value:"tools"},{default:o(()=>[t(d(V))]),_:1}),t(_,{value:"logs"},{default:o(()=>[t(d(w))]),_:1})]),_:1},8,["modelValue"])]),_:1})]),_:1},8,["disabled"])])}}}),j=D(B,[["__scopeId","data-v-871d2dc1"]]);export{j as default};
@@ -1,2 +1,2 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/ContextTab-Cv2a7xRF.js","assets/index-Sav9Djr5.js","assets/index-D2ait7Ff.css","assets/ContextTab-DyPsixHQ.css","assets/MemoryTab-BMDqRcHX.js","assets/MemoryTab-DPthi6jg.css","assets/ToolsTab-Ds4M2VeQ.js","assets/LogsTab-C7r21Vcz.js","assets/LogsTab-wg3i3S6b.css"])))=>i.map(i=>d[i]);
2
- import{d as E,k as y,n as C,g as d,e as o,w as e,b as a,f as n,h as u,q as r,s as v,o as g,_ as A}from"./index-Sav9Djr5.js";const I={class:"chatbot-view-wrapper"},P={class:"overlay"},B={class:"overlay-content"},L=E({__name:"ChatBotView",setup(D){const i=r(()=>v(()=>import("./ContextTab-Cv2a7xRF.js"),__vite__mapDeps([0,1,2,3]))),p=r(()=>v(()=>import("./MemoryTab-BMDqRcHX.js"),__vite__mapDeps([4,1,2,5]))),f=r(()=>v(()=>import("./ToolsTab-Ds4M2VeQ.js"),__vite__mapDeps([6,1,2]))),c=r(()=>v(()=>import("./LogsTab-C7r21Vcz.js"),__vite__mapDeps([7,1,2,8]))),s=y("context");return(O,t)=>{const b=a("v-icon"),l=a("v-tab"),w=a("v-tabs"),_=a("v-window-item"),V=a("v-window"),x=a("v-card-text"),T=a("v-card");return g(),C("div",I,[d("div",P,[d("div",B,[o(b,{size:"x-large",class:"mb-4"},{default:e(()=>[...t[2]||(t[2]=[n("mdi-dev-to",-1)])]),_:1}),t[3]||(t[3]=d("h2",{class:"text-h5"},"Chatbot 控制开发中",-1)),t[4]||(t[4]=d("p",{class:"text-body-1"},"后端 API 尚未实现",-1))])]),o(T,null,{default:e(()=>[o(w,{modelValue:s.value,"onUpdate:modelValue":t[0]||(t[0]=m=>s.value=m),"bg-color":"primary",grow:""},{default:e(()=>[o(l,{value:"context"},{default:e(()=>[...t[5]||(t[5]=[n("对话",-1)])]),_:1}),o(l,{value:"memory"},{default:e(()=>[...t[6]||(t[6]=[n("记忆",-1)])]),_:1}),o(l,{value:"tools"},{default:e(()=>[...t[7]||(t[7]=[n("工具",-1)])]),_:1}),o(l,{value:"logs"},{default:e(()=>[...t[8]||(t[8]=[n("日志",-1)])]),_:1})]),_:1},8,["modelValue"]),o(x,null,{default:e(()=>[o(V,{modelValue:s.value,"onUpdate:modelValue":t[1]||(t[1]=m=>s.value=m)},{default:e(()=>[o(_,{value:"context"},{default:e(()=>[o(u(i))]),_:1}),o(_,{value:"memory"},{default:e(()=>[o(u(p))]),_:1}),o(_,{value:"tools"},{default:e(()=>[o(u(f))]),_:1}),o(_,{value:"logs"},{default:e(()=>[o(u(c))]),_:1})]),_:1},8,["modelValue"])]),_:1})]),_:1})])}}}),k=A(L,[["__scopeId","data-v-ed63d404"]]);export{k as default};
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/ContextTab-B2h9psAa.js","assets/index-CAD8DrUm.js","assets/index-w6MKUyz9.css","assets/ContextTab-Cf-FBreH.css","assets/MemoryTab-D49sjqDT.js","assets/MemoryTab-DPthi6jg.css","assets/ToolsTab-DbZ5EIry.js","assets/LogsTab-D6Rjw8zO.js","assets/LogsTab-wg3i3S6b.css"])))=>i.map(i=>d[i]);
2
+ import{d as E,k as y,n as C,g as d,e as o,w as e,b as a,f as n,h as u,q as r,s as v,o as g,_ as A}from"./index-CAD8DrUm.js";const I={class:"chatbot-view-wrapper"},P={class:"overlay"},B={class:"overlay-content"},L=E({__name:"ChatBotView",setup(D){const i=r(()=>v(()=>import("./ContextTab-B2h9psAa.js"),__vite__mapDeps([0,1,2,3]))),p=r(()=>v(()=>import("./MemoryTab-D49sjqDT.js"),__vite__mapDeps([4,1,2,5]))),f=r(()=>v(()=>import("./ToolsTab-DbZ5EIry.js"),__vite__mapDeps([6,1,2]))),c=r(()=>v(()=>import("./LogsTab-D6Rjw8zO.js"),__vite__mapDeps([7,1,2,8]))),s=y("context");return(O,t)=>{const b=a("v-icon"),l=a("v-tab"),w=a("v-tabs"),_=a("v-window-item"),V=a("v-window"),x=a("v-card-text"),T=a("v-card");return g(),C("div",I,[d("div",P,[d("div",B,[o(b,{size:"x-large",class:"mb-4"},{default:e(()=>[...t[2]||(t[2]=[n("mdi-dev-to",-1)])]),_:1}),t[3]||(t[3]=d("h2",{class:"text-h5"},"Chatbot 控制开发中",-1)),t[4]||(t[4]=d("p",{class:"text-body-1"},"后端 API 尚未实现",-1))])]),o(T,null,{default:e(()=>[o(w,{modelValue:s.value,"onUpdate:modelValue":t[0]||(t[0]=m=>s.value=m),"bg-color":"primary",grow:""},{default:e(()=>[o(l,{value:"context"},{default:e(()=>[...t[5]||(t[5]=[n("对话",-1)])]),_:1}),o(l,{value:"memory"},{default:e(()=>[...t[6]||(t[6]=[n("记忆",-1)])]),_:1}),o(l,{value:"tools"},{default:e(()=>[...t[7]||(t[7]=[n("工具",-1)])]),_:1}),o(l,{value:"logs"},{default:e(()=>[...t[8]||(t[8]=[n("日志",-1)])]),_:1})]),_:1},8,["modelValue"]),o(x,null,{default:e(()=>[o(V,{modelValue:s.value,"onUpdate:modelValue":t[1]||(t[1]=m=>s.value=m)},{default:e(()=>[o(_,{value:"context"},{default:e(()=>[o(u(i))]),_:1}),o(_,{value:"memory"},{default:e(()=>[o(u(p))]),_:1}),o(_,{value:"tools"},{default:e(()=>[o(u(f))]),_:1}),o(_,{value:"logs"},{default:e(()=>[o(u(c))]),_:1})]),_:1},8,["modelValue"])]),_:1})]),_:1})])}}}),k=A(L,[["__scopeId","data-v-ed63d404"]]);export{k as default};
@@ -1,2 +1,2 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/FieldRenderer-xMOXYQeU.js","assets/index-Sav9Djr5.js","assets/index-D2ait7Ff.css"])))=>i.map(i=>d[i]);
2
- import{d as U,i as E,j as G,a as $,k as b,l as D,m as I,n as l,e as u,g as O,b as r,t as h,h as p,w as d,F as V,p as x,f as B,o as n,c as j,q as M,s as P}from"./index-Sav9Djr5.js";const R={key:0,class:"text-center pa-10"},T={class:"mt-4"},q={key:1},W={class:"text-h4 mb-6"},J=U({__name:"ConfigView",setup(z){const{t:_}=E(),F=M(()=>P(()=>import("./FieldRenderer-xMOXYQeU.js"),__vite__mapDeps([0,1,2]))),f=G(),S=$(),k=b(!0),m=b(null),C=b(!1),A=D(()=>{const s=f.schema;if(!s||!s.properties)return[];const c=["llm_providers","tts_providers","neuro","chatbot","stream","server"],v=Object.keys(s.properties);return v.sort((t,o)=>{const i=c.indexOf(t),a=c.indexOf(o);return i!==-1&&a!==-1?i-a:i!==-1?-1:a!==-1?1:t.localeCompare(o)}),v.map(t=>{const o=s.properties[t];if(o.$ref){const i=o.$ref.split("/").pop()||"",a=s.$defs?.[i]||{},y=a.properties||{};return{key:t,title:o.title||a.title||t.charAt(0).toUpperCase()+t.slice(1),isGroup:!0,properties:Object.keys(y).map(g=>({key:g,schema:y[g]}))}}return{key:t,title:o.title||t.charAt(0).toUpperCase()+t.slice(1),isGroup:!1,properties:[{key:t,schema:o}]}})});async function L(){if(S.isConnected){C.value=!0;try{await S.sendAdminWsMessage("update_configs",f.config),console.log("Config saved successfully!")}catch(s){console.error("Failed to save config:",s)}finally{C.value=!1}}}return I(async()=>{k.value=!0;try{await f.fetchSchema(),await f.fetchConfig()}finally{k.value=!1}}),(s,c)=>{const v=r("v-progress-circular"),t=r("v-tab"),o=r("v-tabs"),i=r("v-btn"),a=r("v-card-actions"),y=r("v-card"),g=r("v-window-item"),N=r("v-window");return n(),l("div",null,[k.value?(n(),l("div",R,[u(v,{indeterminate:"",color:"primary"}),O("p",T,h(p(_)("Loading configuration...")),1)])):(n(),l("div",q,[u(o,{modelValue:m.value,"onUpdate:modelValue":c[0]||(c[0]=e=>m.value=e),"bg-color":"primary",class:"mb-4 config-tabs",grow:""},{default:d(()=>[(n(!0),l(V,null,x(A.value,e=>(n(),j(t,{key:e.key,value:e.key},{default:d(()=>[B(h(p(_)(e.title)),1)]),_:2},1032,["value"]))),128))]),_:1},8,["modelValue"]),u(a,{class:"justify-end pa-4"},{default:d(()=>[u(i,{onClick:L,color:"primary",variant:"flat",loading:C.value},{default:d(()=>[B(h(p(_)("Save Configuration")),1)]),_:1},8,["loading"])]),_:1}),u(N,{modelValue:m.value,"onUpdate:modelValue":c[1]||(c[1]=e=>m.value=e),eager:""},{default:d(()=>[(n(!0),l(V,null,x(A.value,e=>(n(),j(g,{key:e.key,value:e.key},{default:d(()=>[u(y,{flat:"",class:"pa-4"},{default:d(()=>[O("h1",W,h(p(_)(e.title)),1),(n(!0),l(V,null,x(e.properties,w=>(n(),l("div",{key:w.key},[u(p(F),{"group-key":e.isGroup?e.key:null,"prop-key":w.key,"prop-schema":w.schema},null,8,["group-key","prop-key","prop-schema"])]))),128))]),_:2},1024)]),_:2},1032,["value"]))),128))]),_:1},8,["modelValue"])]))])}}});export{J as default};
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/FieldRenderer-CzisHAil.js","assets/index-CAD8DrUm.js","assets/index-w6MKUyz9.css"])))=>i.map(i=>d[i]);
2
+ import{d as U,i as E,j as G,a as $,k as b,l as D,m as I,n as l,e as u,g as O,b as r,t as h,h as p,w as d,F as V,p as x,f as B,o as n,c as j,q as M,s as P}from"./index-CAD8DrUm.js";const R={key:0,class:"text-center pa-10"},T={class:"mt-4"},q={key:1},W={class:"text-h4 mb-6"},J=U({__name:"ConfigView",setup(z){const{t:_}=E(),F=M(()=>P(()=>import("./FieldRenderer-CzisHAil.js"),__vite__mapDeps([0,1,2]))),f=G(),S=$(),k=b(!0),m=b(null),C=b(!1),A=D(()=>{const s=f.schema;if(!s||!s.properties)return[];const c=["llm_providers","tts_providers","neuro","chatbot","stream","server"],v=Object.keys(s.properties);return v.sort((t,o)=>{const i=c.indexOf(t),a=c.indexOf(o);return i!==-1&&a!==-1?i-a:i!==-1?-1:a!==-1?1:t.localeCompare(o)}),v.map(t=>{const o=s.properties[t];if(o.$ref){const i=o.$ref.split("/").pop()||"",a=s.$defs?.[i]||{},y=a.properties||{};return{key:t,title:o.title||a.title||t.charAt(0).toUpperCase()+t.slice(1),isGroup:!0,properties:Object.keys(y).map(g=>({key:g,schema:y[g]}))}}return{key:t,title:o.title||t.charAt(0).toUpperCase()+t.slice(1),isGroup:!1,properties:[{key:t,schema:o}]}})});async function L(){if(S.isConnected){C.value=!0;try{await S.sendAdminWsMessage("update_configs",f.config),console.log("Config saved successfully!")}catch(s){console.error("Failed to save config:",s)}finally{C.value=!1}}}return I(async()=>{k.value=!0;try{await f.fetchSchema(),await f.fetchConfig()}finally{k.value=!1}}),(s,c)=>{const v=r("v-progress-circular"),t=r("v-tab"),o=r("v-tabs"),i=r("v-btn"),a=r("v-card-actions"),y=r("v-card"),g=r("v-window-item"),N=r("v-window");return n(),l("div",null,[k.value?(n(),l("div",R,[u(v,{indeterminate:"",color:"primary"}),O("p",T,h(p(_)("Loading configuration...")),1)])):(n(),l("div",q,[u(o,{modelValue:m.value,"onUpdate:modelValue":c[0]||(c[0]=e=>m.value=e),"bg-color":"primary",class:"mb-4 config-tabs",grow:""},{default:d(()=>[(n(!0),l(V,null,x(A.value,e=>(n(),j(t,{key:e.key,value:e.key},{default:d(()=>[B(h(p(_)(e.title)),1)]),_:2},1032,["value"]))),128))]),_:1},8,["modelValue"]),u(a,{class:"justify-end pa-4"},{default:d(()=>[u(i,{onClick:L,color:"primary",variant:"flat",loading:C.value},{default:d(()=>[B(h(p(_)("Save Configuration")),1)]),_:1},8,["loading"])]),_:1}),u(N,{modelValue:m.value,"onUpdate:modelValue":c[1]||(c[1]=e=>m.value=e),eager:""},{default:d(()=>[(n(!0),l(V,null,x(A.value,e=>(n(),j(g,{key:e.key,value:e.key},{default:d(()=>[u(y,{flat:"",class:"pa-4"},{default:d(()=>[O("h1",W,h(p(_)(e.title)),1),(n(!0),l(V,null,x(e.properties,w=>(n(),l("div",{key:w.key},[u(p(F),{"group-key":e.isGroup?e.key:null,"prop-key":w.key,"prop-schema":w.schema},null,8,["group-key","prop-key","prop-schema"])]))),128))]),_:2},1024)]),_:2},1032,["value"]))),128))]),_:1},8,["modelValue"])]))])}}});export{J as default};
@@ -0,0 +1 @@
1
+ import{d as _,k as g,A as v,a as f,x,b as h,n as o,o as s,g as r,e as y,t as l,h as p,F as w,p as C,f as k,_ as A}from"./index-CAD8DrUm.js";const V={class:"d-flex align-center mb-4"},b={key:0,class:"context-prompt-view"},P={key:1,class:"context-conversation-view"},S=_({__name:"ContextTab",setup(B){const t=g(!1),n=v(),c=f();async function i(){if(c.isConnected)if(t.value)try{const e=await c.sendAdminWsMessage("get_last_prompt");n.setAgentPrompt(e.prompt)}catch(e){console.error("获取最新Prompt失败:",e),n.setAgentPrompt(`获取提示词失败: ${e}`)}else try{await c.sendAdminWsMessage("get_agent_context")}catch(e){console.error("获取上下文失败:",e)}}return x(t,i),i(),(e,d)=>{const m=h("v-switch");return s(),o("div",null,[r("div",V,[y(m,{modelValue:t.value,"onUpdate:modelValue":d[0]||(d[0]=a=>t.value=a),label:"上下文模式",color:"primary","hide-details":""},null,8,["modelValue"])]),t.value?(s(),o("div",b,[r("pre",null,l(p(n).agentPrompt),1)])):(s(),o("div",P,[(s(!0),o(w,null,C(p(n).agentHistory,(a,u)=>(s(),o("div",{key:u,class:"message-item"},[r("p",null,[r("strong",null,l(a.role)+":",1),k(" "+l(a.content),1)])]))),128))]))])}}}),N=A(S,[["__scopeId","data-v-a9a1985c"]]);export{N as default};
@@ -0,0 +1 @@
1
+ .context-prompt-view pre[data-v-a9a1985c]{background-color:#1e1e1e;color:#d4d4d4;font-family:Courier New,Courier,monospace;padding:16px;border-radius:4px;white-space:pre-wrap;word-wrap:break-word;max-height:70vh;overflow-y:auto}.message-item[data-v-a9a1985c]{padding:8px 0;border-bottom:1px solid #e0e0e0}
@@ -1 +1 @@
1
- import{d as C,u as S,a as w,r as x,c as k,w as o,b as r,e as a,f as n,g as i,h as _,t as V,o as b,_ as A}from"./index-Sav9Djr5.js";const B={class:"stream-status"},M={class:"control-buttons"},N=C({__name:"ControlView",setup(W){const d=S(),l=w(),e=x({start:!1,stop:!1,restart:!1});async function u(){e.start=!0;try{await l.sendAdminWsMessage("start_stream")}catch(s){console.error(s)}finally{e.start=!1}}async function f(){e.stop=!0;try{await l.sendAdminWsMessage("stop_stream")}catch(s){console.error(s)}finally{e.stop=!1}}async function p(){e.restart=!0;try{await l.sendAdminWsMessage("restart_stream")}catch(s){console.error(s)}finally{e.restart=!1}}return(s,t)=>{const m=r("v-card-title"),g=r("v-chip"),c=r("v-btn"),v=r("v-card-text"),y=r("v-card");return b(),k(y,null,{default:o(()=>[a(m,null,{default:o(()=>[...t[0]||(t[0]=[n("直播控制",-1)])]),_:1}),a(v,null,{default:o(()=>[i("div",B,[i("p",null,[t[1]||(t[1]=n("当前状态: ",-1)),a(g,{color:_(d).isRunning?"green":"red",dark:""},{default:o(()=>[n(V(_(d).isRunning?"运行中":"已停止"),1)]),_:1},8,["color"])])]),i("div",M,[a(c,{color:"primary",onClick:u,loading:e.start},{default:o(()=>[...t[2]||(t[2]=[n("开始直播",-1)])]),_:1},8,["loading"]),a(c,{color:"error",onClick:f,loading:e.stop},{default:o(()=>[...t[3]||(t[3]=[n("停止直播",-1)])]),_:1},8,["loading"]),a(c,{color:"warning",onClick:p,loading:e.restart},{default:o(()=>[...t[4]||(t[4]=[n("重启直播",-1)])]),_:1},8,["loading"])])]),_:1})]),_:1})}}}),D=A(N,[["__scopeId","data-v-607a7661"]]);export{D as default};
1
+ import{d as C,u as S,a as w,r as x,c as k,w as o,b as r,e as a,f as n,g as i,h as _,t as V,o as b,_ as A}from"./index-CAD8DrUm.js";const B={class:"stream-status"},M={class:"control-buttons"},N=C({__name:"ControlView",setup(W){const d=S(),l=w(),e=x({start:!1,stop:!1,restart:!1});async function u(){e.start=!0;try{await l.sendAdminWsMessage("start_stream")}catch(s){console.error(s)}finally{e.start=!1}}async function f(){e.stop=!0;try{await l.sendAdminWsMessage("stop_stream")}catch(s){console.error(s)}finally{e.stop=!1}}async function p(){e.restart=!0;try{await l.sendAdminWsMessage("restart_stream")}catch(s){console.error(s)}finally{e.restart=!1}}return(s,t)=>{const m=r("v-card-title"),g=r("v-chip"),c=r("v-btn"),v=r("v-card-text"),y=r("v-card");return b(),k(y,null,{default:o(()=>[a(m,null,{default:o(()=>[...t[0]||(t[0]=[n("直播控制",-1)])]),_:1}),a(v,null,{default:o(()=>[i("div",B,[i("p",null,[t[1]||(t[1]=n("当前状态: ",-1)),a(g,{color:_(d).isRunning?"green":"red",dark:""},{default:o(()=>[n(V(_(d).isRunning?"运行中":"已停止"),1)]),_:1},8,["color"])])]),i("div",M,[a(c,{color:"primary",onClick:u,loading:e.start},{default:o(()=>[...t[2]||(t[2]=[n("开始直播",-1)])]),_:1},8,["loading"]),a(c,{color:"error",onClick:f,loading:e.stop},{default:o(()=>[...t[3]||(t[3]=[n("停止直播",-1)])]),_:1},8,["loading"]),a(c,{color:"warning",onClick:p,loading:e.restart},{default:o(()=>[...t[4]||(t[4]=[n("重启直播",-1)])]),_:1},8,["loading"])])]),_:1})]),_:1})}}}),D=A(N,[["__scopeId","data-v-607a7661"]]);export{D as default};
@@ -1 +1 @@
1
- import{d as ee,i as te,j as le,l as U,k as C,r as ne,b as p,n as b,o as d,c as m,z as S,h as r,e as s,F as T,p as J,w as v,g as P,t as f,f as N,q as oe,s as ae}from"./index-Sav9Djr5.js";let O;const ie=new Uint8Array(16);function re(){if(!O&&(O=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!O))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return O(ie)}const u=[];for(let e=0;e<256;++e)u.push((e+256).toString(16).slice(1));function de(e,t=0){return u[e[t+0]]+u[e[t+1]]+u[e[t+2]]+u[e[t+3]]+"-"+u[e[t+4]]+u[e[t+5]]+"-"+u[e[t+6]]+u[e[t+7]]+"-"+u[e[t+8]]+u[e[t+9]]+"-"+u[e[t+10]]+u[e[t+11]]+u[e[t+12]]+u[e[t+13]]+u[e[t+14]]+u[e[t+15]]}const ue=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),B={randomUUID:ue};function pe(e,t,j){if(B.randomUUID&&!e)return B.randomUUID();e=e||{};const l=e.random||(e.rng||re)();return l[6]=l[6]&15|64,l[8]=l[8]&63|128,de(l)}const se={class:"mb-6"},ce={key:8},me={key:0,class:"text-body-2"},ve={key:1,class:"text-body-2"},ye=ee({__name:"FieldRenderer",props:{groupKey:{},propKey:{},propSchema:{},isInDialog:{type:Boolean},dialogData:{}},setup(e){const{t}=te(),j=oe(()=>ae(()=>Promise.resolve().then(()=>fe),void 0)),l=e,y=le();function h(i){return l.propSchema.type===i?!0:Array.isArray(l.propSchema.anyOf)?l.propSchema.anyOf.some(o=>o.type===i):!1}const $=U(()=>!h("array")||!l.propSchema.items?!1:l.propSchema.items.type==="object"||!!l.propSchema.items.$ref),V=U(()=>{if(!$.value)return{};const i=l.propSchema.items;if(i.$ref){const o=i.$ref.split("/").pop();return y.schema.$defs?.[o]||{}}return i}),w=U(()=>l.propKey.endsWith("_provider_id")),F=U(()=>l.propKey==="llm_provider_id"?y.config.llm_providers||[]:l.propKey==="tts_provider_id"?y.config.tts_providers||[]:[]),a=U({get(){return l.isInDialog?l.dialogData?.[l.propKey]:l.groupKey?y.config[l.groupKey]?.[l.propKey]:y.config[l.propKey]},set(i){if(l.isInDialog){l.dialogData&&(l.dialogData[l.propKey]=i);return}l.groupKey?(y.config[l.groupKey]||(y.config[l.groupKey]={}),y.config[l.groupKey][l.propKey]=i):y.config[l.propKey]=i}}),k=C(!1),I=C(!1),c=ne({}),_=C(-1);function z(){I.value=!1,Object.keys(c).forEach(K=>delete c[K]);const i=V.value.properties||{};for(const K in i)c[K]=i[K].default??null;const o=c.provider_type||V.value.properties?.provider_type?.enum?.[0]||"unknown",g=l.propKey==="llm_providers"?"llm":"tts";c.provider_id=`${g}-${o}-${pe()}`,k.value=!0}function M(i,o){I.value=!0,_.value=o,Object.keys(c).forEach(g=>delete c[g]),Object.assign(c,JSON.parse(JSON.stringify(i))),k.value=!0}function L(){const i=a.value||[];I.value?i[_.value]=JSON.parse(JSON.stringify(c)):i.push(JSON.parse(JSON.stringify(c))),a.value=i,k.value=!1}function q(i){const o=a.value||[];o.splice(i,1),a.value=o}return(i,o)=>{const g=p("v-text-field"),K=p("v-textarea"),H=p("v-switch"),A=p("v-select"),x=p("v-btn"),W=p("v-card-title"),E=p("v-card-text"),R=p("v-card"),G=p("v-spacer"),Q=p("v-card-actions"),X=p("v-dialog"),Y=p("v-combobox");return d(),b("div",se,[e.propKey==="provider_id"?(d(),m(g,{key:0,modelValue:a.value,"onUpdate:modelValue":o[0]||(o[0]=n=>a.value=n),label:r(t)(e.propSchema.title||e.propKey),hint:e.propSchema.description,"persistent-hint":"",variant:"outlined",density:"compact",disabled:""},null,8,["modelValue","label","hint"])):h("integer")||h("number")?(d(),m(g,{key:1,modelValue:a.value,"onUpdate:modelValue":o[1]||(o[1]=n=>a.value=n),modelModifiers:{number:!0},label:r(t)(e.propSchema.title||e.propKey),hint:e.propSchema.description,type:"number","persistent-hint":"",variant:"outlined",density:"compact"},null,8,["modelValue","label","hint"])):h("string")&&e.propSchema.format==="password"?(d(),m(g,{key:2,modelValue:a.value,"onUpdate:modelValue":o[2]||(o[2]=n=>a.value=n),label:r(t)(e.propSchema.title||e.propKey),hint:e.propSchema.description,type:"password","persistent-hint":"",variant:"outlined",density:"compact"},null,8,["modelValue","label","hint"])):h("string")&&e.propSchema.format==="text-area"?(d(),m(K,{key:3,modelValue:a.value,"onUpdate:modelValue":o[3]||(o[3]=n=>a.value=n),label:r(t)(e.propSchema.title||e.propKey),hint:e.propSchema.description,"persistent-hint":"",variant:"outlined"},null,8,["modelValue","label","hint"])):h("string")&&!e.propSchema.enum&&!w.value?(d(),m(g,{key:4,modelValue:a.value,"onUpdate:modelValue":o[4]||(o[4]=n=>a.value=n),label:r(t)(e.propSchema.title||e.propKey),hint:e.propSchema.description,"persistent-hint":"",variant:"outlined",density:"compact"},null,8,["modelValue","label","hint"])):S("",!0),h("boolean")?(d(),m(H,{key:5,modelValue:a.value,"onUpdate:modelValue":o[5]||(o[5]=n=>a.value=n),label:r(t)(e.propSchema.title||e.propKey),hint:e.propSchema.description,"persistent-hint":"",color:"primary",inset:""},null,8,["modelValue","label","hint"])):S("",!0),e.propSchema.enum?(d(),m(A,{key:6,modelValue:a.value,"onUpdate:modelValue":o[6]||(o[6]=n=>a.value=n),items:e.propSchema.enum,label:r(t)(e.propSchema.title||e.propKey),hint:e.propSchema.description,"persistent-hint":"",variant:"outlined",density:"compact"},null,8,["modelValue","items","label","hint"])):S("",!0),w.value?(d(),m(A,{key:7,modelValue:a.value,"onUpdate:modelValue":o[7]||(o[7]=n=>a.value=n),items:F.value,"item-title":"display_name","item-value":"provider_id",label:r(t)(e.propSchema.title||e.propKey),hint:e.propSchema.description,"persistent-hint":"",variant:"outlined",density:"compact",clearable:""},null,8,["modelValue","items","label","hint"])):$.value?(d(),b("div",ce,[(d(!0),b(T,null,J(a.value,(n,D)=>(d(),m(R,{key:n.provider_id||D,class:"mb-4",variant:"outlined"},{default:v(()=>[s(W,{class:"d-flex justify-space-between align-center text-body-1"},{default:v(()=>[P("span",null,f(n.display_name||r(t)("Item")+" "+(D+1)),1),P("div",null,[s(x,{icon:"mdi-pencil",size:"small",variant:"text",onClick:Z=>M(n,D)},null,8,["onClick"]),s(x,{icon:"mdi-delete",size:"small",variant:"text",onClick:Z=>q(D)},null,8,["onClick"])])]),_:2},1024),n.provider_type||n.model_name?(d(),m(E,{key:0},{default:v(()=>[n.provider_type?(d(),b("p",me,f(r(t)("Provider Type"))+": "+f(n.provider_type),1)):S("",!0),n.model_name?(d(),b("p",ve,f(r(t)("Model Name"))+": "+f(n.model_name),1)):S("",!0)]),_:2},1024)):S("",!0)]),_:2},1024))),128)),s(x,{color:"primary",onClick:z,block:""},{default:v(()=>[N(f(r(t)("Add"))+" "+f(r(t)(V.value.title||"Item")),1)]),_:1}),s(X,{modelValue:k.value,"onUpdate:modelValue":o[9]||(o[9]=n=>k.value=n),"max-width":"800px",persistent:""},{default:v(()=>[s(R,{title:r(t)(I.value?"Edit":"Add")+" "+r(t)(V.value.title||"Item")},{default:v(()=>[s(E,null,{default:v(()=>[(d(!0),b(T,null,J(Object.keys(V.value.properties||{}),n=>(d(),b("div",{key:n},[s(r(j),{"group-key":null,"prop-key":n,"prop-schema":V.value.properties[n],"is-in-dialog":!0,"dialog-data":c},null,8,["prop-key","prop-schema","dialog-data"])]))),128))]),_:1}),s(Q,null,{default:v(()=>[s(G),s(x,{text:"",onClick:o[8]||(o[8]=n=>k.value=!1)},{default:v(()=>[N(f(r(t)("Cancel")),1)]),_:1}),s(x,{color:"primary",onClick:L},{default:v(()=>[N(f(r(t)("Save")),1)]),_:1})]),_:1})]),_:1},8,["title"])]),_:1},8,["modelValue"])])):h("array")?(d(),m(Y,{key:9,modelValue:a.value,"onUpdate:modelValue":o[10]||(o[10]=n=>a.value=n),label:r(t)(e.propSchema.title||e.propKey),hint:e.propSchema.description,"persistent-hint":"",chips:"",multiple:"","closable-chips":"",variant:"outlined",density:"compact"},null,8,["modelValue","label","hint"])):S("",!0)])}}}),fe=Object.freeze(Object.defineProperty({__proto__:null,default:ye},Symbol.toStringTag,{value:"Module"}));export{ye as default};
1
+ import{d as ee,i as te,j as le,l as U,k as C,r as ne,b as p,n as b,o as d,c as m,z as S,h as r,e as s,F as T,p as J,w as v,g as P,t as f,f as N,q as oe,s as ae}from"./index-CAD8DrUm.js";let O;const ie=new Uint8Array(16);function re(){if(!O&&(O=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!O))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return O(ie)}const u=[];for(let e=0;e<256;++e)u.push((e+256).toString(16).slice(1));function de(e,t=0){return u[e[t+0]]+u[e[t+1]]+u[e[t+2]]+u[e[t+3]]+"-"+u[e[t+4]]+u[e[t+5]]+"-"+u[e[t+6]]+u[e[t+7]]+"-"+u[e[t+8]]+u[e[t+9]]+"-"+u[e[t+10]]+u[e[t+11]]+u[e[t+12]]+u[e[t+13]]+u[e[t+14]]+u[e[t+15]]}const ue=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),B={randomUUID:ue};function pe(e,t,j){if(B.randomUUID&&!e)return B.randomUUID();e=e||{};const l=e.random||(e.rng||re)();return l[6]=l[6]&15|64,l[8]=l[8]&63|128,de(l)}const se={class:"mb-6"},ce={key:8},me={key:0,class:"text-body-2"},ve={key:1,class:"text-body-2"},ye=ee({__name:"FieldRenderer",props:{groupKey:{},propKey:{},propSchema:{},isInDialog:{type:Boolean},dialogData:{}},setup(e){const{t}=te(),j=oe(()=>ae(()=>Promise.resolve().then(()=>fe),void 0)),l=e,y=le();function h(i){return l.propSchema.type===i?!0:Array.isArray(l.propSchema.anyOf)?l.propSchema.anyOf.some(o=>o.type===i):!1}const $=U(()=>!h("array")||!l.propSchema.items?!1:l.propSchema.items.type==="object"||!!l.propSchema.items.$ref),V=U(()=>{if(!$.value)return{};const i=l.propSchema.items;if(i.$ref){const o=i.$ref.split("/").pop();return y.schema.$defs?.[o]||{}}return i}),w=U(()=>l.propKey.endsWith("_provider_id")),F=U(()=>l.propKey==="llm_provider_id"?y.config.llm_providers||[]:l.propKey==="tts_provider_id"?y.config.tts_providers||[]:[]),a=U({get(){return l.isInDialog?l.dialogData?.[l.propKey]:l.groupKey?y.config[l.groupKey]?.[l.propKey]:y.config[l.propKey]},set(i){if(l.isInDialog){l.dialogData&&(l.dialogData[l.propKey]=i);return}l.groupKey?(y.config[l.groupKey]||(y.config[l.groupKey]={}),y.config[l.groupKey][l.propKey]=i):y.config[l.propKey]=i}}),k=C(!1),I=C(!1),c=ne({}),_=C(-1);function z(){I.value=!1,Object.keys(c).forEach(K=>delete c[K]);const i=V.value.properties||{};for(const K in i)c[K]=i[K].default??null;const o=c.provider_type||V.value.properties?.provider_type?.enum?.[0]||"unknown",g=l.propKey==="llm_providers"?"llm":"tts";c.provider_id=`${g}-${o}-${pe()}`,k.value=!0}function M(i,o){I.value=!0,_.value=o,Object.keys(c).forEach(g=>delete c[g]),Object.assign(c,JSON.parse(JSON.stringify(i))),k.value=!0}function L(){const i=a.value||[];I.value?i[_.value]=JSON.parse(JSON.stringify(c)):i.push(JSON.parse(JSON.stringify(c))),a.value=i,k.value=!1}function q(i){const o=a.value||[];o.splice(i,1),a.value=o}return(i,o)=>{const g=p("v-text-field"),K=p("v-textarea"),H=p("v-switch"),A=p("v-select"),x=p("v-btn"),W=p("v-card-title"),E=p("v-card-text"),R=p("v-card"),G=p("v-spacer"),Q=p("v-card-actions"),X=p("v-dialog"),Y=p("v-combobox");return d(),b("div",se,[e.propKey==="provider_id"?(d(),m(g,{key:0,modelValue:a.value,"onUpdate:modelValue":o[0]||(o[0]=n=>a.value=n),label:r(t)(e.propSchema.title||e.propKey),hint:e.propSchema.description,"persistent-hint":"",variant:"outlined",density:"compact",disabled:""},null,8,["modelValue","label","hint"])):h("integer")||h("number")?(d(),m(g,{key:1,modelValue:a.value,"onUpdate:modelValue":o[1]||(o[1]=n=>a.value=n),modelModifiers:{number:!0},label:r(t)(e.propSchema.title||e.propKey),hint:e.propSchema.description,type:"number","persistent-hint":"",variant:"outlined",density:"compact"},null,8,["modelValue","label","hint"])):h("string")&&e.propSchema.format==="password"?(d(),m(g,{key:2,modelValue:a.value,"onUpdate:modelValue":o[2]||(o[2]=n=>a.value=n),label:r(t)(e.propSchema.title||e.propKey),hint:e.propSchema.description,type:"password","persistent-hint":"",variant:"outlined",density:"compact"},null,8,["modelValue","label","hint"])):h("string")&&e.propSchema.format==="text-area"?(d(),m(K,{key:3,modelValue:a.value,"onUpdate:modelValue":o[3]||(o[3]=n=>a.value=n),label:r(t)(e.propSchema.title||e.propKey),hint:e.propSchema.description,"persistent-hint":"",variant:"outlined"},null,8,["modelValue","label","hint"])):h("string")&&!e.propSchema.enum&&!w.value?(d(),m(g,{key:4,modelValue:a.value,"onUpdate:modelValue":o[4]||(o[4]=n=>a.value=n),label:r(t)(e.propSchema.title||e.propKey),hint:e.propSchema.description,"persistent-hint":"",variant:"outlined",density:"compact"},null,8,["modelValue","label","hint"])):S("",!0),h("boolean")?(d(),m(H,{key:5,modelValue:a.value,"onUpdate:modelValue":o[5]||(o[5]=n=>a.value=n),label:r(t)(e.propSchema.title||e.propKey),hint:e.propSchema.description,"persistent-hint":"",color:"primary",inset:""},null,8,["modelValue","label","hint"])):S("",!0),e.propSchema.enum?(d(),m(A,{key:6,modelValue:a.value,"onUpdate:modelValue":o[6]||(o[6]=n=>a.value=n),items:e.propSchema.enum,label:r(t)(e.propSchema.title||e.propKey),hint:e.propSchema.description,"persistent-hint":"",variant:"outlined",density:"compact"},null,8,["modelValue","items","label","hint"])):S("",!0),w.value?(d(),m(A,{key:7,modelValue:a.value,"onUpdate:modelValue":o[7]||(o[7]=n=>a.value=n),items:F.value,"item-title":"display_name","item-value":"provider_id",label:r(t)(e.propSchema.title||e.propKey),hint:e.propSchema.description,"persistent-hint":"",variant:"outlined",density:"compact",clearable:""},null,8,["modelValue","items","label","hint"])):$.value?(d(),b("div",ce,[(d(!0),b(T,null,J(a.value,(n,D)=>(d(),m(R,{key:n.provider_id||D,class:"mb-4",variant:"outlined"},{default:v(()=>[s(W,{class:"d-flex justify-space-between align-center text-body-1"},{default:v(()=>[P("span",null,f(n.display_name||r(t)("Item")+" "+(D+1)),1),P("div",null,[s(x,{icon:"mdi-pencil",size:"small",variant:"text",onClick:Z=>M(n,D)},null,8,["onClick"]),s(x,{icon:"mdi-delete",size:"small",variant:"text",onClick:Z=>q(D)},null,8,["onClick"])])]),_:2},1024),n.provider_type||n.model_name?(d(),m(E,{key:0},{default:v(()=>[n.provider_type?(d(),b("p",me,f(r(t)("Provider Type"))+": "+f(n.provider_type),1)):S("",!0),n.model_name?(d(),b("p",ve,f(r(t)("Model Name"))+": "+f(n.model_name),1)):S("",!0)]),_:2},1024)):S("",!0)]),_:2},1024))),128)),s(x,{color:"primary",onClick:z,block:""},{default:v(()=>[N(f(r(t)("Add"))+" "+f(r(t)(V.value.title||"Item")),1)]),_:1}),s(X,{modelValue:k.value,"onUpdate:modelValue":o[9]||(o[9]=n=>k.value=n),"max-width":"800px",persistent:""},{default:v(()=>[s(R,{title:r(t)(I.value?"Edit":"Add")+" "+r(t)(V.value.title||"Item")},{default:v(()=>[s(E,null,{default:v(()=>[(d(!0),b(T,null,J(Object.keys(V.value.properties||{}),n=>(d(),b("div",{key:n},[s(r(j),{"group-key":null,"prop-key":n,"prop-schema":V.value.properties[n],"is-in-dialog":!0,"dialog-data":c},null,8,["prop-key","prop-schema","dialog-data"])]))),128))]),_:1}),s(Q,null,{default:v(()=>[s(G),s(x,{text:"",onClick:o[8]||(o[8]=n=>k.value=!1)},{default:v(()=>[N(f(r(t)("Cancel")),1)]),_:1}),s(x,{color:"primary",onClick:L},{default:v(()=>[N(f(r(t)("Save")),1)]),_:1})]),_:1})]),_:1},8,["title"])]),_:1},8,["modelValue"])])):h("array")?(d(),m(Y,{key:9,modelValue:a.value,"onUpdate:modelValue":o[10]||(o[10]=n=>a.value=n),label:r(t)(e.propSchema.title||e.propKey),hint:e.propSchema.description,"persistent-hint":"",chips:"",multiple:"","closable-chips":"",variant:"outlined",density:"compact"},null,8,["modelValue","label","hint"])):S("",!0)])}}}),fe=Object.freeze(Object.defineProperty({__proto__:null,default:ye},Symbol.toStringTag,{value:"Module"}));export{ye as default};
@@ -1 +1 @@
1
- import{d as r,v as l,k as c,x as g,n as s,o as t,F as u,p as i,t as p,h as _,y as f,_ as d}from"./index-Sav9Djr5.js";const m=r({__name:"LogsTab",setup(v){const a=l(),e=c(null);return g(()=>a.agentLogs.length,async()=>{await f(),e.value&&(e.value.scrollTop=e.value.scrollHeight)},{deep:!0}),(k,y)=>(t(),s("div",{ref_key:"logsContainer",ref:e,class:"logs-output"},[(t(!0),s(u,null,i(_(a).agentLogs,(o,n)=>(t(),s("div",{key:`agent-${n}`,class:"log-entry"},p(o),1))),128))],512))}}),h=d(m,[["__scopeId","data-v-20098789"]]);export{h as default};
1
+ import{d as r,v as l,k as c,x as g,n as s,o as t,F as u,p as i,t as p,h as _,y as f,_ as d}from"./index-CAD8DrUm.js";const m=r({__name:"LogsTab",setup(v){const a=l(),e=c(null);return g(()=>a.agentLogs.length,async()=>{await f(),e.value&&(e.value.scrollTop=e.value.scrollHeight)},{deep:!0}),(k,y)=>(t(),s("div",{ref_key:"logsContainer",ref:e,class:"logs-output"},[(t(!0),s(u,null,i(_(a).agentLogs,(o,n)=>(t(),s("div",{key:`agent-${n}`,class:"log-entry"},p(o),1))),128))],512))}}),h=d(m,[["__scopeId","data-v-20098789"]]);export{h as default};
@@ -1 +1 @@
1
- import{d as p,v,k as f,x as g,c as m,w as t,b as s,e as n,f as x,g as k,n as l,p as w,h as y,F as L,o as a,t as C,y as V,_ as h}from"./index-Sav9Djr5.js";const B=p({__name:"LogsView",setup(S){const o=v(),e=f(null);return g(()=>o.serverLogs.length,async()=>{await V(),e.value&&(e.value.scrollTop=e.value.scrollHeight)},{deep:!0}),(N,r)=>{const c=s("v-card-title"),_=s("v-card-text"),d=s("v-card");return a(),m(d,null,{default:t(()=>[n(c,null,{default:t(()=>[...r[0]||(r[0]=[x("Server 日志",-1)])]),_:1}),n(_,null,{default:t(()=>[k("div",{ref_key:"logsContainer",ref:e,class:"logs-output"},[(a(!0),l(L,null,w(y(o).serverLogs,(u,i)=>(a(),l("div",{key:`server-${i}`,class:"log-entry"},C(u),1))),128))],512)]),_:1})]),_:1})}}}),F=h(B,[["__scopeId","data-v-f9df559f"]]);export{F as default};
1
+ import{d as p,v,k as f,x as g,c as m,w as t,b as s,e as n,f as x,g as k,n as l,p as w,h as y,F as L,o as a,t as C,y as V,_ as h}from"./index-CAD8DrUm.js";const B=p({__name:"LogsView",setup(S){const o=v(),e=f(null);return g(()=>o.serverLogs.length,async()=>{await V(),e.value&&(e.value.scrollTop=e.value.scrollHeight)},{deep:!0}),(N,r)=>{const c=s("v-card-title"),_=s("v-card-text"),d=s("v-card");return a(),m(d,null,{default:t(()=>[n(c,null,{default:t(()=>[...r[0]||(r[0]=[x("Server 日志",-1)])]),_:1}),n(_,null,{default:t(()=>[k("div",{ref_key:"logsContainer",ref:e,class:"logs-output"},[(a(!0),l(L,null,w(y(o).serverLogs,(u,i)=>(a(),l("div",{key:`server-${i}`,class:"log-entry"},C(u),1))),128))],512)]),_:1})]),_:1})}}}),F=h(B,[["__scopeId","data-v-f9df559f"]]);export{F as default};
@@ -1,4 +1,4 @@
1
- import{d as le,A as ne,a as oe,B as re,k as x,m as ae,b as i,n as f,o as s,e as t,w as l,g as v,c as V,f as d,h as k,F as U,p as F,t as C,_ as ie}from"./index-Sav9Djr5.js";const se={class:"d-flex mb-4"},de={key:1},ue={class:"d-flex mb-4"},me={key:1},ce={class:"d-flex mb-4"},fe={key:0},ve={key:1},pe={class:"text-h5"},_e={class:"text-h5"},ye=le({__name:"MemoryTab",setup(xe){const p=ne(),a=oe();re();const M=x(!1),y=x({role:"user",content:""}),g=x(!1),m=x({}),b=x(!1),c=x({});function O(n=null){n?m.value={...n,contentStr:n.content.join(`
1
+ import{d as le,A as ne,a as oe,B as re,k as x,m as ae,b as i,n as f,o as s,e as t,w as l,g as v,c as V,f as d,h as k,F as U,p as F,t as C,_ as ie}from"./index-CAD8DrUm.js";const se={class:"d-flex mb-4"},de={key:1},ue={class:"d-flex mb-4"},me={key:1},ce={class:"d-flex mb-4"},fe={key:0},ve={key:1},pe={class:"text-h5"},_e={class:"text-h5"},ye=le({__name:"MemoryTab",setup(xe){const p=ne(),a=oe();re();const M=x(!1),y=x({role:"user",content:""}),g=x(!1),m=x({}),b=x(!1),c=x({});function O(n=null){n?m.value={...n,contentStr:n.content.join(`
2
2
  `)}:m.value={title:"",description:"",contentStr:""},g.value=!0}async function G(){if(!a.isConnected)return;const n=m.value,e={title:n.title,description:n.description,content:n.contentStr.split(`
3
3
  `).filter(r=>r.trim()!=="")};try{n.id?await a.sendAdminWsMessage("update_core_memory_block",{block_id:n.id,...e}):await a.sendAdminWsMessage("create_core_memory_block",e),g.value=!1}catch(r){console.error("Failed to save core memory block:",r)}}function z(n=null,e=null){if(n!==null){let r=e;Array.isArray(e)?r=e.join(`
4
4
  `):typeof e=="object"&&(r=JSON.stringify(e,null,2)),c.value={key:n,valueStr:r,isEditing:!0}}else c.value={key:"",valueStr:"",isEditing:!1};b.value=!0}async function H(){if(!a.isConnected||!c.value.key.trim())return;const{key:n,valueStr:e}=c.value;let r=e;try{const u=e.trim();u.startsWith("{")&&u.endsWith("}")||u.startsWith("[")&&u.endsWith("]")?r=JSON.parse(u):u.includes(`
@@ -1 +1 @@
1
- import{d as F,C as D,a as R,k as W,x as E,m as G,b as s,c as b,o as u,w as e,e as t,g as n,f as d,n as m,F as A,p as k,h,t as f}from"./index-Sav9Djr5.js";const J={class:"d-flex mb-4"},O={class:"text-center"},I={class:"text-center"},j=F({__name:"ToolsTab",setup(L){const c=D(),r=R(),i=W({neuro_agent:[],memory_agent:[]});E(()=>c.allocations,l=>{i.value=JSON.parse(JSON.stringify(l||{neuro_agent:[],memory_agent:[]}))},{deep:!0,immediate:!0});async function S(){if(r.isConnected)try{await r.sendAdminWsMessage("set_agent_tool_allocations",{allocations:i.value}),console.log("Tool allocations saved successfully!")}catch(l){console.error("Failed to save allocations:",l)}}async function T(){if(r.isConnected)try{await r.sendAdminWsMessage("reload_tools")}catch(l){console.error("Failed to reload tools:",l)}}async function B(){if(r.isConnected)try{const[l,o]=await Promise.all([r.sendAdminWsMessage("get_all_tools"),r.sendAdminWsMessage("get_agent_tool_allocations")]);console.log("DEBUG: toolsResponse:",l),console.log("DEBUG: allocationsResponse:",o),c.handleAvailableToolsUpdate(l.tools),c.handleAllocationsUpdate(o.allocations)}catch(l){console.error("Failed to fetch tools initial data:",l)}}return G(()=>{B()}),(l,o)=>{const C=s("v-btn"),_=s("v-col"),p=s("v-row"),v=s("v-card-title"),V=s("v-checkbox-btn"),N=s("v-table"),g=s("v-card-text"),y=s("v-card"),w=s("v-chip"),M=s("v-chip-group"),U=s("v-container");return u(),b(U,{fluid:""},{default:e(()=>[t(p,null,{default:e(()=>[t(_,{cols:"12"},{default:e(()=>[n("div",J,[t(C,{onClick:T,class:"mr-2"},{default:e(()=>[...o[2]||(o[2]=[d("重载工具",-1)])]),_:1}),t(C,{onClick:S,color:"primary"},{default:e(()=>[...o[3]||(o[3]=[d("保存分配",-1)])]),_:1})]),o[4]||(o[4]=n("p",{class:"text-caption"},"在这里为 Agent 分配可用的工具标签。Neuro Agent 负责与观众互动,Memory Agent 负责在后台整理记忆。",-1))]),_:1})]),_:1}),t(p,null,{default:e(()=>[t(_,{cols:"12"},{default:e(()=>[t(y,{variant:"outlined"},{default:e(()=>[t(v,null,{default:e(()=>[...o[5]||(o[5]=[d("所有可用工具",-1)])]),_:1}),t(g,null,{default:e(()=>[t(N,{density:"compact"},{default:e(()=>[o[6]||(o[6]=n("thead",null,[n("tr",null,[n("th",{class:"text-left"},"工具名称"),n("th",{class:"text-left"},"描述"),n("th",{class:"text-center"},"Neuro Agent"),n("th",{class:"text-center"},"Memory Agent")])],-1)),n("tbody",null,[(u(!0),m(A,null,k(h(c).availableTools,a=>(u(),m("tr",{key:a.name},[n("td",null,f(a.name),1),n("td",null,f(a.description),1),n("td",O,[t(V,{modelValue:i.value.neuro_agent,"onUpdate:modelValue":o[0]||(o[0]=x=>i.value.neuro_agent=x),value:a.name,"hide-details":""},null,8,["modelValue","value"])]),n("td",I,[t(V,{modelValue:i.value.memory_agent,"onUpdate:modelValue":o[1]||(o[1]=x=>i.value.memory_agent=x),value:a.name,"hide-details":""},null,8,["modelValue","value"])])]))),128))])]),_:1})]),_:1})]),_:1})]),_:1})]),_:1}),t(p,null,{default:e(()=>[t(_,{md:"6",cols:"12"},{default:e(()=>[t(y,{variant:"outlined"},{default:e(()=>[t(v,null,{default:e(()=>[...o[7]||(o[7]=[d("Neuro Agent 工具集",-1)])]),_:1}),t(g,null,{default:e(()=>[t(M,{column:""},{default:e(()=>[(u(!0),m(A,null,k(h(c).allocations.neuro_agent,a=>(u(),b(w,{key:a},{default:e(()=>[d(f(a),1)]),_:2},1024))),128))]),_:1})]),_:1})]),_:1})]),_:1}),t(_,{md:"6",cols:"12"},{default:e(()=>[t(y,{variant:"outlined"},{default:e(()=>[t(v,null,{default:e(()=>[...o[8]||(o[8]=[d("Memory Agent 工具集",-1)])]),_:1}),t(g,null,{default:e(()=>[t(M,{column:""},{default:e(()=>[(u(!0),m(A,null,k(h(c).allocations.memory_agent,a=>(u(),b(w,{key:a},{default:e(()=>[d(f(a),1)]),_:2},1024))),128))]),_:1})]),_:1})]),_:1})]),_:1})]),_:1})]),_:1})}}});export{j as default};
1
+ import{d as F,C as D,a as R,k as W,x as E,m as G,b as s,c as b,o as u,w as e,e as t,g as n,f as d,n as m,F as A,p as k,h,t as f}from"./index-CAD8DrUm.js";const J={class:"d-flex mb-4"},O={class:"text-center"},I={class:"text-center"},j=F({__name:"ToolsTab",setup(L){const c=D(),r=R(),i=W({neuro_agent:[],memory_agent:[]});E(()=>c.allocations,l=>{i.value=JSON.parse(JSON.stringify(l||{neuro_agent:[],memory_agent:[]}))},{deep:!0,immediate:!0});async function S(){if(r.isConnected)try{await r.sendAdminWsMessage("set_agent_tool_allocations",{allocations:i.value}),console.log("Tool allocations saved successfully!")}catch(l){console.error("Failed to save allocations:",l)}}async function T(){if(r.isConnected)try{await r.sendAdminWsMessage("reload_tools")}catch(l){console.error("Failed to reload tools:",l)}}async function B(){if(r.isConnected)try{const[l,o]=await Promise.all([r.sendAdminWsMessage("get_all_tools"),r.sendAdminWsMessage("get_agent_tool_allocations")]);console.log("DEBUG: toolsResponse:",l),console.log("DEBUG: allocationsResponse:",o),c.handleAvailableToolsUpdate(l.tools),c.handleAllocationsUpdate(o.allocations)}catch(l){console.error("Failed to fetch tools initial data:",l)}}return G(()=>{B()}),(l,o)=>{const C=s("v-btn"),_=s("v-col"),p=s("v-row"),v=s("v-card-title"),V=s("v-checkbox-btn"),N=s("v-table"),g=s("v-card-text"),y=s("v-card"),w=s("v-chip"),M=s("v-chip-group"),U=s("v-container");return u(),b(U,{fluid:""},{default:e(()=>[t(p,null,{default:e(()=>[t(_,{cols:"12"},{default:e(()=>[n("div",J,[t(C,{onClick:T,class:"mr-2"},{default:e(()=>[...o[2]||(o[2]=[d("重载工具",-1)])]),_:1}),t(C,{onClick:S,color:"primary"},{default:e(()=>[...o[3]||(o[3]=[d("保存分配",-1)])]),_:1})]),o[4]||(o[4]=n("p",{class:"text-caption"},"在这里为 Agent 分配可用的工具标签。Neuro Agent 负责与观众互动,Memory Agent 负责在后台整理记忆。",-1))]),_:1})]),_:1}),t(p,null,{default:e(()=>[t(_,{cols:"12"},{default:e(()=>[t(y,{variant:"outlined"},{default:e(()=>[t(v,null,{default:e(()=>[...o[5]||(o[5]=[d("所有可用工具",-1)])]),_:1}),t(g,null,{default:e(()=>[t(N,{density:"compact"},{default:e(()=>[o[6]||(o[6]=n("thead",null,[n("tr",null,[n("th",{class:"text-left"},"工具名称"),n("th",{class:"text-left"},"描述"),n("th",{class:"text-center"},"Neuro Agent"),n("th",{class:"text-center"},"Memory Agent")])],-1)),n("tbody",null,[(u(!0),m(A,null,k(h(c).availableTools,a=>(u(),m("tr",{key:a.name},[n("td",null,f(a.name),1),n("td",null,f(a.description),1),n("td",O,[t(V,{modelValue:i.value.neuro_agent,"onUpdate:modelValue":o[0]||(o[0]=x=>i.value.neuro_agent=x),value:a.name,"hide-details":""},null,8,["modelValue","value"])]),n("td",I,[t(V,{modelValue:i.value.memory_agent,"onUpdate:modelValue":o[1]||(o[1]=x=>i.value.memory_agent=x),value:a.name,"hide-details":""},null,8,["modelValue","value"])])]))),128))])]),_:1})]),_:1})]),_:1})]),_:1})]),_:1}),t(p,null,{default:e(()=>[t(_,{md:"6",cols:"12"},{default:e(()=>[t(y,{variant:"outlined"},{default:e(()=>[t(v,null,{default:e(()=>[...o[7]||(o[7]=[d("Neuro Agent 工具集",-1)])]),_:1}),t(g,null,{default:e(()=>[t(M,{column:""},{default:e(()=>[(u(!0),m(A,null,k(h(c).allocations.neuro_agent,a=>(u(),b(w,{key:a},{default:e(()=>[d(f(a),1)]),_:2},1024))),128))]),_:1})]),_:1})]),_:1})]),_:1}),t(_,{md:"6",cols:"12"},{default:e(()=>[t(y,{variant:"outlined"},{default:e(()=>[t(v,null,{default:e(()=>[...o[8]||(o[8]=[d("Memory Agent 工具集",-1)])]),_:1}),t(g,null,{default:e(()=>[t(M,{column:""},{default:e(()=>[(u(!0),m(A,null,k(h(c).allocations.memory_agent,a=>(u(),b(w,{key:a},{default:e(()=>[d(f(a),1)]),_:2},1024))),128))]),_:1})]),_:1})]),_:1})]),_:1})]),_:1})]),_:1})}}});export{j as default};