소스 검색

feat: 将 Dify chatbot 嵌入代码移至 index.html 全局加载

weipengtao 6 달 전
부모
커밋
ac83980dc0
2개의 변경된 파일22개의 추가작업 그리고 24개의 파일을 삭제
  1. 22 0
      public/index.html
  2. 0 24
      src/views/Project/Schedule.vue

+ 22 - 0
public/index.html

@@ -13,5 +13,27 @@
     </noscript>
     <div id="app"></div>
     <!-- built files will be auto injected -->
+    <script>
+      window.difyChatbotConfig = {
+        token: 'h8mBtz4IQMSuT3xm',
+        baseUrl: 'http://dify.seec.seecoder.cn',
+        systemVariables: {},
+        userVariables: {},
+      }
+    </script>
+    <script
+      src="http://dify.seec.seecoder.cn/embed.min.js"
+      id="h8mBtz4IQMSuT3xm"
+      defer>
+    </script>
+    <style>
+      #dify-chatbot-bubble-button {
+        background-color: #1C64F2 !important;
+      }
+      #dify-chatbot-bubble-window {
+        width: 24rem !important;
+        height: 40rem !important;
+      }
+    </style>
   </body>
 </html>

+ 0 - 24
src/views/Project/Schedule.vue

@@ -151,23 +151,6 @@ export default {
       return this.$store.state.workspace.currentProjectMembers;
     },
   },
-  mounted() {
-    // Dify chatbot 配置
-    window.difyChatbotConfig = {
-      token: 'h8mBtz4IQMSuT3xm',
-      baseUrl: 'http://dify.seec.seecoder.cn',
-      systemVariables: {},
-      userVariables: {},
-    };
-    // 动态加载 Dify chatbot 脚本
-    if (!document.getElementById('h8mBtz4IQMSuT3xm')) {
-      const script = document.createElement('script');
-      script.src = 'http://dify.seec.seecoder.cn/embed.min.js';
-      script.id = 'h8mBtz4IQMSuT3xm';
-      script.defer = true;
-      document.head.appendChild(script);
-    }
-  },
   watch: {
     $route: {
       async handler() {
@@ -363,11 +346,4 @@ export default {
 .el-table .cell{
   white-space: pre-line;
 }
-#dify-chatbot-bubble-button {
-  background-color: #1C64F2 !important;
-}
-#dify-chatbot-bubble-window {
-  width: 24rem !important;
-  height: 40rem !important;
-}
 </style>