Home

Version 12.1 by Jiahao Lai on 2026/03/26 15:46
Warning: For security reasons, the document is displayed in restricted mode as it is not the current version. There may be differences and errors due to this.

Failed to execute the [velocity] macro. Cause: [The execution of the [velocity] script macro is not allowed in [xwiki:Help.Code.VelocityMacros]. Check the rights of its last author or the parameters if it's rendered from another script.]. Click on this message for details.

Failed to execute the [velocity] macro. Cause: [The execution of the [velocity] script macro is not allowed in [xwiki:Home.WebHome]. Check the rights of its last author or the parameters if it's rendered from another script.]. Click on this message for details.

Failed to execute the [velocity] macro. Cause: [The execution of the [velocity] script macro is not allowed in [xwiki:Home.WebHome]. Check the rights of its last author or the parameters if it's rendered from another script.]. Click on this message for details.

Failed to execute the [velocity] macro. Cause: [The execution of the [velocity] script macro is not allowed in [xwiki:Home.WebHome]. Check the rights of its last author or the parameters if it's rendered from another script.]. Click on this message for details.

Failed to execute the [velocity] macro. Cause: [The execution of the [velocity] script macro is not allowed in [xwiki:Home.WebHome]. Check the rights of its last author or the parameters if it's rendered from another script.]. Click on this message for details.

Failed to execute the [velocity] macro. Cause: [The execution of the [velocity] script macro is not allowed in [xwiki:Home.WebHome]. Check the rights of its last author or the parameters if it's rendered from another script.]. Click on this message for details.

Failed to execute the [velocity] macro. Cause: [The execution of the [velocity] script macro is not allowed in [xwiki:Home.WebHome]. Check the rights of its last author or the parameters if it's rendered from another script.]. Click on this message for details.

document.addEventListener('DOMContentLoaded', function() {
  setTimeout(async () => {
    try {
      // 1. 先加载依赖库 marked.js(子 wiki 用的版本)
      await new Promise((resolve, reject) => {
        const markedScript = document.createElement('script');
        markedScript.src = 'https://docs.we-con.com.cn/webjars/wiki%3Awonway/marked/4.0.2/marked.min.js';
        markedScript.onload = resolve;
        markedScript.onerror = reject;
        document.body.appendChild(markedScript);
      });
      console.log("✅ marked.js 加载成功");

      // 2. 加载 CSS
      await new Promise((resolve) => {
        const link = document.createElement('link');
        link.rel = 'stylesheet';
        link.href = 'https://docs.we-con.com.cn/webjars/wiki%3Awonway/application-ai-llm-chat-webjar/0.7.2/chatWidget.css';
        link.onload = resolve;
        document.head.appendChild(link);
      });

      // 3. 加载 chatWidget.js
      await new Promise((resolve) => {
        const script = document.createElement('script');
        script.src = 'https://docs.we-con.com.cn/webjars/wiki%3Awonway/application-ai-llm-chat-webjar/0.7.2/chatWidget.js';
        script.onload = resolve;
        document.body.appendChild(script);
      });

      // 4. 启动浮窗
      if (window.LLMChatWidget && typeof LLMChatWidget.init === 'function') {
        LLMChatWidget.init();
        console.log("✅ 浮窗启动成功!");
      } else {
        throw new Error("LLMChatWidget 未初始化");
      }
    } catch (e) {
      console.error("❌ 加载失败", e);
      alert("浮窗加载失败:" + e.message);
    }
  }, 1000);
});