Ver Fonte

fix: 改回 embed.min.js 方式并使用 HTTPS 地址

weipengtao há 6 meses atrás
pai
commit
3a8ba9fb8a
1 ficheiros alterados com 20 adições e 48 exclusões
  1. 20 48
      src/views/Project/Schedule.vue

+ 20 - 48
src/views/Project/Schedule.vue

@@ -1,6 +1,4 @@
 <template>
-  <div class="schedule-layout">
-  <div class="schedule-left">
   <el-row  style="display: flex;flex-direction: row;align-items: center;margin-bottom: 10px;color: #333333">
     <h4>项目概览</h4>
   </el-row>
@@ -93,17 +91,6 @@
     </el-row>
     <img src="@/assets/example.png" style="height: 400px; width: 100%">
   </ElDrawer>
-  </div>
-  <div class="schedule-right">
-    <div class="chat-header">AI 需求助手</div>
-    <iframe
-      class="chat-iframe"
-      :src="chatUrl"
-      frameborder="0"
-      allow="microphone"
-    ></iframe>
-  </div>
-  </div>
 </template>
 
 <script>
@@ -125,7 +112,6 @@ export default {
   },
   data() {
     return {
-      chatUrl: 'https://dify.seec.seecoder.cn/chatbot/h8mBtz4IQMSuT3xm',
       loading: false,
       requirements: [],
       showRequirementDrawer: false,
@@ -165,6 +151,21 @@ export default {
       return this.$store.state.workspace.currentProjectMembers;
     },
   },
+  mounted() {
+    // Dify chatbot
+    window.difyChatbotConfig = {
+      token: 'h8mBtz4IQMSuT3xm',
+      baseUrl: 'https://dify.seec.seecoder.cn',
+      systemVariables: {},
+      userVariables: {},
+    };
+    if (!document.getElementById('h8mBtz4IQMSuT3xm')) {
+      const script = document.createElement('script');
+      script.src = 'https://dify.seec.seecoder.cn/embed.min.js';
+      script.id = 'h8mBtz4IQMSuT3xm';
+      document.body.appendChild(script);
+    }
+  },
   watch: {
     $route: {
       async handler() {
@@ -360,40 +361,11 @@ export default {
 .el-table .cell{
   white-space: pre-line;
 }
-.schedule-layout {
-  display: flex;
-  gap: 16px;
-  height: calc(100vh - 120px);
-}
-.schedule-left {
-  flex: 1;
-  min-width: 0;
-  overflow-y: auto;
-}
-.schedule-right {
-  width: 400px;
-  min-width: 400px;
-  display: flex;
-  flex-direction: column;
-  border: 1px solid #e4e7ed;
-  border-radius: 8px;
-  background: #fff;
-  overflow: hidden;
-  height: 100%;
-}
-.chat-header {
-  padding: 12px 16px;
-  font-size: 16px;
-  font-weight: bold;
-  color: #333;
-  border-bottom: 1px solid #e4e7ed;
-  background: #f8f9fa;
-  flex-shrink: 0;
+#dify-chatbot-bubble-button {
+  background-color: #1C64F2 !important;
 }
-.chat-iframe {
-  flex: 1;
-  width: 100%;
-  height: 100%;
-  border: none;
+#dify-chatbot-bubble-window {
+  width: 24rem !important;
+  height: 40rem !important;
 }
 </style>