Changes for page Home

Last modified by Iris on 2026/04/14 17:40

From version 22.1
edited by Jiahao Lai
on 2026/03/26 16:17
Change comment: There is no comment for this version
To version 12.1
edited by Jiahao Lai
on 2026/03/26 15:46
Change comment: There is no comment for this version

Summary

Details

Page properties
Content
... ... @@ -186,19 +186,54 @@
186 186  {{/html}}
187 187  {{/velocity}}
188 188  
189 +
190 +
189 189  {{html clean="false"}}
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>
192 +<div id="llm-chat-widget" style="position:fixed;right:20px;bottom:20px;z-index:9999;"></div>
196 196  
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>
202 -{{/html}}
194 +<script>
195 +document.addEventListener('DOMContentLoaded', function() {
196 + setTimeout(async () => {
197 + try {
198 + // 1. 先加载依赖库 marked.js(子 wiki 用的版本)
199 + await new Promise((resolve, reject) => {
200 + const markedScript = document.createElement('script');
201 + markedScript.src = 'https://docs.we-con.com.cn/webjars/wiki%3Awonway/marked/4.0.2/marked.min.js';
202 + markedScript.onload = resolve;
203 + markedScript.onerror = reject;
204 + document.body.appendChild(markedScript);
205 + });
206 + console.log("✅ marked.js 加载成功");
203 203  
204 -
208 + // 2. 加载 CSS
209 + await new Promise((resolve) => {
210 + const link = document.createElement('link');
211 + link.rel = 'stylesheet';
212 + link.href = 'https://docs.we-con.com.cn/webjars/wiki%3Awonway/application-ai-llm-chat-webjar/0.7.2/chatWidget.css';
213 + link.onload = resolve;
214 + document.head.appendChild(link);
215 + });
216 +
217 + // 3. 加载 chatWidget.js
218 + await new Promise((resolve) => {
219 + const script = document.createElement('script');
220 + script.src = 'https://docs.we-con.com.cn/webjars/wiki%3Awonway/application-ai-llm-chat-webjar/0.7.2/chatWidget.js';
221 + script.onload = resolve;
222 + document.body.appendChild(script);
223 + });
224 +
225 + // 4. 启动浮窗
226 + if (window.LLMChatWidget && typeof LLMChatWidget.init === 'function') {
227 + LLMChatWidget.init();
228 + console.log("✅ 浮窗启动成功!");
229 + } else {
230 + throw new Error("LLMChatWidget 未初始化");
231 + }
232 + } catch (e) {
233 + console.error("❌ 加载失败", e);
234 + alert("浮窗加载失败:" + e.message);
235 + }
236 + }, 1000);
237 +});
238 +</script>
239 +{{/html}}