From version 11.1
edited by Jiahao Lai
on 2026/03/26 15:43
on 2026/03/26 15:43
Change comment:
There is no comment for this version
To version 9.1
edited by Jiahao Lai
on 2026/03/26 15:40
on 2026/03/26 15:40
Change comment:
There is no comment for this version
Summary
-
Page properties (1 modified, 0 added, 0 removed)
Details
- Page properties
-
- Content
-
... ... @@ -189,35 +189,27 @@ 189 189 190 190 191 191 {{html clean="false"}} 192 -<div id="llm-chat-widget" style="position:fixed;right:20px;bottom:20px;z-index:9999;"></div> 193 - 192 +<div id="llm-chat-widget"></div> 194 194 <script> 195 -document.addEventListener('DOMContentLoaded', function() { 196 - setTimeout(async () => { 197 - // 强制加载 198 - await new Promise((resolve) => { 199 - const l = document.createElement('link'); 200 - l.rel = 'stylesheet'; 201 - l.href = 'https://docs.we-con.com.cn/webjars/wiki%3Awonway/application-ai-llm-chat-webjar/0.7.2/chatWidget.css'; 202 - l.onload = resolve; 203 - document.head.appendChild(l); 204 - }); 194 +window.addEventListener('load', function() { 195 + // 直接用子 wiki 能加载的资源(绝对可用) 196 + const css = 'https://docs.we-con.com.cn/webjars/wiki%3Awonway/application-ai-llm-chat-webjar/0.7.2/chatWidget.css'; 197 + const js = 'https://docs.we-con.com.cn/webjars/wiki%3Awonway/application-ai-llm-chat-webjar/0.7.2/chatWidget.js'; 205 205 206 - await new Promise((resolve) => { 207 - const s = document.createElement('script'); 208 - s.src = 'https://docs.we-con.com.cn/webjars/wiki%3Awonway/application-ai-llm-chat-webjar/0.7.2/chatWidget.js'; 209 - s.onload = resolve; 210 - document.body.appendChild(s); 211 - }); 199 + // 加载 CSS 200 + const link = document.createElement('link'); 201 + link.rel = 'stylesheet'; 202 + link.href = css; 203 + document.head.appendChild(link); 212 212 213 - try{214 - LLMChatWidget.init();215 - console.log("✅浮窗启动成功");216 - }catch(e) {217 - console.error("❌失败", e);218 - alert("浮窗加载失败,请看控制台!");219 - }220 - }, 800);205 + // 加载 JS 并启动 206 + const script = document.createElement('script'); 207 + script.src = js; 208 + script.onload = () => { 209 + console.log("✅ 浮窗JS加载成功!"); 210 + LLMChatWidget.init(); 211 + }; 212 + document.body.appendChild(script); 221 221 }); 222 222 </script> 223 223 {{/html}}