From version 13.1
edited by Jiahao Lai
on 2026/03/26 15:47
on 2026/03/26 15:47
Change comment:
There is no comment for this version
To version 22.1
edited by Jiahao Lai
on 2026/03/26 16:17
on 2026/03/26 16:17
Change comment:
There is no comment for this version
Summary
-
Page properties (1 modified, 0 added, 0 removed)
Details
- Page properties
-
- Content
-
... ... @@ -186,61 +186,19 @@ 186 186 {{/html}} 187 187 {{/velocity}} 188 188 189 - 190 - 191 191 {{html clean="false"}} 192 -<div id="llm-chat-widget" style="position:fixed;right:20px;bottom:20px;z-index:9999;"></div> 190 +<style> 191 +#aiChatIcon{position:fixed;right:24px;bottom:24px;width:60px;height:60px;border-radius:50%;background:#007bff;display:flex;align-items:center;justify-content:center;color:white;font-size:24px;cursor:pointer;box-shadow:0 4px 16px rgba(0,0,0,0.2);z-index:999999;} 192 +#aiChatPanel{position:fixed;right:24px;bottom:96px;width:380px;height:580px;background:white;border-radius:16px;box-shadow:0 8px 32px rgba(0,0,0,0.1);display:none;overflow:hidden;z-index:999998;} 193 +#aiChatPanel iframe{width:100%;height:100%;border:none;} 194 +#aiChatPanel .close{position:absolute;top:8px;right:12px;font-size:18px;cursor:pointer;color:#666;} 195 +</style> 193 193 194 -<script> 195 -document.addEventListener('DOMContentLoaded', function() { 196 - // 延长等待时间,确保配置和依赖完全加载 197 - setTimeout(async () => { 198 - try { 199 - // 1. 加载 marked.js 依赖 200 - await new Promise((resolve) => { 201 - const s = document.createElement('script'); 202 - s.src = 'https://docs.we-con.com.cn/webjars/wiki%3Awonway/marked/4.0.2/marked.min.js'; 203 - s.onload = resolve; 204 - document.body.appendChild(s); 205 - }); 206 - 207 - // 2. 加载 CSS 208 - await new Promise((resolve) => { 209 - const l = document.createElement('link'); 210 - l.rel = 'stylesheet'; 211 - l.href = 'https://docs.we-con.com.cn/webjars/wiki%3Awonway/application-ai-llm-chat-webjar/0.7.2/chatWidget.css'; 212 - l.onload = resolve; 213 - document.head.appendChild(l); 214 - }); 215 - 216 - // 3. 加载 chatWidget.js 217 - await new Promise((resolve) => { 218 - const s = document.createElement('script'); 219 - s.src = 'https://docs.we-con.com.cn/webjars/wiki%3Awonway/application-ai-llm-chat-webjar/0.7.2/chatWidget.js'; 220 - s.onload = resolve; 221 - document.body.appendChild(s); 222 - }); 223 - 224 - // 4. 循环等待,直到 LLM 配置就绪 225 - let retries = 0; 226 - const maxRetries = 20; // 最多等 20*200ms = 4秒 227 - const waitForLLM = () => { 228 - if (window.LLMChatWidget && typeof LLMChatWidget.init === 'function') { 229 - LLMChatWidget.init(); 230 - console.log("✅ 浮窗启动成功!"); 231 - } else if (retries < maxRetries) { 232 - retries++; 233 - setTimeout(waitForLLM, 200); 234 - } else { 235 - throw new Error("LLM 配置超时未就绪"); 236 - } 237 - }; 238 - waitForLLM(); 239 - } catch (e) { 240 - console.error("❌ 最终失败", e); 241 - alert("浮窗加载失败:" + (e.message || "未知错误")); 242 - } 243 - }, 1500); // 延长初始等待时间 244 -}); 245 -</script> 197 +<div id="aiChatIcon" onclick="document.getElementById('aiChatPanel').style.display='block'">💬</div> 198 +<div id="aiChatPanel"> 199 + <div class="close" onclick="this.parentElement.style.display='none'">✕</div> 200 + <iframe src="https://docs.we-con.com.cn/bin/view/wonway/AIConfigSheet"></iframe> 201 +</div> 246 246 {{/html}} 203 + 204 +