From ed6f781fbe1dd5297a54d61ba50b5d609bb1b639 Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期四, 20 三月 2025 10:31:59 +0800
Subject: [PATCH] Merge branch 'positec' into dms

---
 src/mob/components/navbar/normal-navbar/menus/menuform/index.jsx |    6 
 src/tabviews/zshare/mutilform/mkRadio/index.jsx                  |    7 
 src/mob/components/navbar/normal-navbar/index.jsx                |    2 
 package-lock.json                                                |    5 
 src/tabviews/zshare/topSearch/index.jsx                          |    2 
 src/views/mkai/index.jsx                                         |  312 ++++++++++++++++++----------------
 src/tabviews/custom/components/share/braftContent/index.scss     |    6 
 src/utils/utils-custom.js                                        |   23 +-
 src/router/index.js                                              |    4 
 src/menu/components/search/main-search/index.jsx                 |    5 
 src/menu/datasource/index.jsx                                    |    9 
 src/mob/components/navbar/normal-navbar/menus/index.jsx          |    3 
 src/tabviews/zshare/mutilform/mkSelect/index.jsx                 |    7 
 src/menu/components/share/actioncomponent/actionform/index.jsx   |    4 
 package.json                                                     |    1 
 src/menu/debug/index.jsx                                         |   72 ++++++++
 src/tabviews/zshare/actionList/normalbutton/index.jsx            |    1 
 src/views/menudesign/index.jsx                                   |   13 -
 src/menu/datasource/verifycard/index.jsx                         |   10 
 src/utils/utils.js                                               |   22 +-
 20 files changed, 320 insertions(+), 194 deletions(-)

diff --git a/package-lock.json b/package-lock.json
index 30c171f..bff0116 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -2438,6 +2438,11 @@
         "@types/yargs": "^13.0.0"
       }
     },
+    "@microsoft/fetch-event-source": {
+      "version": "2.0.1",
+      "resolved": "https://registry.npmjs.org/@microsoft/fetch-event-source/-/fetch-event-source-2.0.1.tgz",
+      "integrity": "sha512-W6CLUJ2eBMw3Rec70qrsEW0jOm/3twwJv21mrmj2yORiaVmVYGS4sSS5yUwvQc1ZlDLYGPnClVWmUUMagKNsfA=="
+    },
     "@mrmlnc/readdir-enhanced": {
       "version": "2.2.1",
       "resolved": "https://registry.npmjs.org/@mrmlnc/readdir-enhanced/-/readdir-enhanced-2.2.1.tgz",
diff --git a/package.json b/package.json
index f302d7f..ee14ee0 100644
--- a/package.json
+++ b/package.json
@@ -21,6 +21,7 @@
     "@antv/x6-plugin-transform": "^2.1.7",
     "@antv/xflow": "^1.0.50",
     "@babel/core": "7.5.5",
+    "@microsoft/fetch-event-source": "^2.0.1",
     "@svgr/webpack": "4.3.2",
     "@typescript-eslint/eslint-plugin": "1.13.0",
     "@typescript-eslint/parser": "1.13.0",
diff --git a/src/menu/components/search/main-search/index.jsx b/src/menu/components/search/main-search/index.jsx
index 5bf777b..c87bbd9 100644
--- a/src/menu/components/search/main-search/index.jsx
+++ b/src/menu/components/search/main-search/index.jsx
@@ -315,6 +315,11 @@
       match: 'like',
       focus: true
     }
+
+    if (card.search.length) {
+      item.ratio = card.search[card.search.length - 1].ratio
+    }
+    
     card.search.push(item)
 
     this.setState({card}, () => {
diff --git a/src/menu/components/share/actioncomponent/actionform/index.jsx b/src/menu/components/share/actioncomponent/actionform/index.jsx
index 1993cd4..77ac27d 100644
--- a/src/menu/components/share/actioncomponent/actionform/index.jsx
+++ b/src/menu/components/share/actioncomponent/actionform/index.jsx
@@ -161,6 +161,8 @@
     let reRequired = {}
     let reReadonly = {}
 
+    reTooltip.interface = ''
+    reTooltip.proInterface = '姝e紡绯荤粺鎵�浣跨敤鐨勬帴鍙e湴鍧�銆�'
     if (['pop', 'prompt', 'exec'].includes(openType)) {
       let intertype = this.record.intertype
 
@@ -183,6 +185,8 @@
         }
         reReadonly.interface = false
         reRequired.interface = true
+        reTooltip.interface = `鍙娇鐢ㄥ彉閲廆mywebsite@ (鍩熷悕+铏氭嫙鐩綍)銆丂mydomain@ (鍩熷悕)锛屽锛欯mywebsite@/webapi/dostars 浠h〃 ${window.GLOB.baseurl}webapi/dostars銆俙
+        reTooltip.proInterface += reTooltip.interface
       } else if (intertype === 'outer') {
         shows.push('procMode', 'sysInterface', 'outerFunc', 'callbackType')
         if (this.record.procMode === 'system') {
diff --git a/src/menu/datasource/index.jsx b/src/menu/datasource/index.jsx
index c86661c..661db31 100644
--- a/src/menu/datasource/index.jsx
+++ b/src/menu/datasource/index.jsx
@@ -139,7 +139,7 @@
     const { config } = this.props
 
     this.setState({loading: true})
-    this.verifyRef.submitDataSource().then(res => {
+    this.verifyRef.submitDataSource().then((res, hasMSearch) => {
 
       let MenuType = sessionStorage.getItem('MenuType')
 
@@ -339,6 +339,13 @@
           MKEmitter.emit('mkUpdateInter', {uuid: config.uuid, columns: res.columns}, {delay: 0})
         }, 150)
       }
+
+      if (config.type === 'interface' && res.setting && res.setting.useMSearch === 'true' && !hasMSearch) {
+        Modal.warning({
+          title: '鏁版嵁婧愪腑浣跨敤浜嗗閮ㄦ悳绱紝浣嗘悳绱㈡潯浠跺皻鏈坊鍔狅紒',
+          centered: true
+        })
+      }
     }, () => {
       this.setState({loading: false})
     })
diff --git a/src/menu/datasource/verifycard/index.jsx b/src/menu/datasource/verifycard/index.jsx
index a6b1d41..3e7cbd2 100644
--- a/src/menu/datasource/verifycard/index.jsx
+++ b/src/menu/datasource/verifycard/index.jsx
@@ -574,7 +574,7 @@
 
   submitDataSource = () => {
     const { config, mainSearch } = this.props
-    const { activeKey, setting, columns, subColumns, scripts, cols, median, searches } = this.state
+    const { activeKey, setting, columns, subColumns, scripts, cols, median, searches, hasMainSearch } = this.state
 
     if (config.subtype === 'dualdatacard') {
       let arr = columns.map(col => col.field.toLowerCase())
@@ -645,7 +645,7 @@
             searches: _searches,
             setting: res
           }, () => {
-            this.sqlverify(() => { resolve({setting: res, columns, subColumns, scripts, cols, searches: _searches }) }, reject, 'submit')
+            this.sqlverify(() => { resolve({setting: res, columns, subColumns, scripts, cols, searches: _searches }, hasMainSearch) }, reject, 'submit')
           })
         }, () => {
           reject()
@@ -660,7 +660,7 @@
           reject()
           return
         }
-        this.sqlverify(() => { resolve({setting, columns, subColumns, scripts, cols, searches }) }, reject, 'submit')
+        this.sqlverify(() => { resolve({setting, columns, subColumns, scripts, cols, searches }, hasMainSearch) }, reject, 'submit')
       } else if (activeKey === 'subcolumns') {
         if (this.subdatasource && this.subdatasource.state.editingKey) {
           notification.warning({
@@ -671,9 +671,9 @@
           reject()
           return
         }
-        this.sqlverify(() => { resolve({setting, columns, subColumns, scripts, cols, searches }) }, reject, 'submit')
+        this.sqlverify(() => { resolve({setting, columns, subColumns, scripts, cols, searches }, hasMainSearch) }, reject, 'submit')
       } else if (activeKey === 'scripts') {
-        this.sqlverify(() => { resolve({setting, columns, subColumns, scripts, cols, searches }) }, reject, 'submit')
+        this.sqlverify(() => { resolve({setting, columns, subColumns, scripts, cols, searches }, hasMainSearch) }, reject, 'submit')
       }
     })
   }
diff --git a/src/menu/debug/index.jsx b/src/menu/debug/index.jsx
index f6567bd..ac2ec2e 100644
--- a/src/menu/debug/index.jsx
+++ b/src/menu/debug/index.jsx
@@ -162,6 +162,78 @@
       return
     }
 
+    let getMsearch = (components) => {
+      let val = null
+      components.forEach(com => {
+        if (com.type !== 'search') return
+  
+        if (com.wrap && com.wrap.supModule && com.wrap.supModule.length > 0) {
+          let supModule = com.wrap.supModule[com.wrap.supModule.length - 1];
+
+          (com.search || []).forEach(item => {
+            if (item.type === 'datemonth') {
+              if (item.initval && item.dateShift) {
+                val = {supModule: supModule, name: com.name}
+              }
+            } else if (item.type === 'daterange') {
+              if (item.initval && item.dateShift) {
+                val = {supModule: supModule, name: com.name}
+              }
+            } else if ((item.type === 'select' || item.type === 'link') && item.resourceType === '1') {
+              if (/@BID@/ig.test(item.dataSource)) {
+                val = {supModule: supModule, name: com.name}
+              }
+            }
+          })
+        }
+      })
+
+      return val
+    }
+
+    let checkSearch = (components, mSearch) => {
+      components.forEach(item => {
+        if (error) return
+        
+        if (item.type === 'tabs') {
+          item.subtabs.forEach(tab => {
+            let _ms = getMsearch(tab.components)
+
+            if (_ms) {
+              checkSearch(tab.components, _ms)
+            } else {
+              checkSearch(tab.components, mSearch)
+            }
+          })
+          return
+        } else if (item.type === 'group') {
+          checkSearch(item.components, mSearch)
+          return
+        } else if (!mSearch || !item.setting) {
+          return
+        } else if (!(item.type === 'table' || (item.type === 'card' && ['datacard', 'dualdatacard'].includes(item.subtype)))) {
+          return
+        }
+
+        if (item.setting.useMSearch === 'true' && item.setting.supModule && item.setting.supModule[0] !== 'empty') {
+          let id = item.setting.supModule[item.setting.supModule.length - 1]
+          if (mSearch.supModule !== id) {
+            error = `${item.name} 浣跨敤浜嗗閮ㄦ悳绱紝浣嗕笌澶栭儴鎼滅储锛�${mSearch.name}锛夌殑涓婄骇缁勪欢涓嶄竴鑷淬�俙
+          }
+        }
+      })
+    }
+
+    checkSearch(config.components, getMsearch(config.components))
+
+    if (error) {
+      Modal.warning({
+        title: error,
+        okText: '鐭ラ亾浜�'
+      })
+      return
+    }
+
     this.sqlList = []
     this.linkMain = []
 
diff --git a/src/mob/components/navbar/normal-navbar/index.jsx b/src/mob/components/navbar/normal-navbar/index.jsx
index beb30d4..6f2d5ce 100644
--- a/src/mob/components/navbar/normal-navbar/index.jsx
+++ b/src/mob/components/navbar/normal-navbar/index.jsx
@@ -142,7 +142,7 @@
         } trigger="hover">
           <ToolOutlined />
         </Popover>
-        <MenuComponent menus={card.menus} columns={card.columns} updateConfig={(menus) => this.updateComponent({...card, menus: menus})}/>
+        <MenuComponent menus={card.menus} datatype={card.wrap.datatype} columns={card.columns} updateConfig={(menus) => this.updateComponent({...card, menus: menus})}/>
       </div>
     )
   }
diff --git a/src/mob/components/navbar/normal-navbar/menus/index.jsx b/src/mob/components/navbar/normal-navbar/menus/index.jsx
index 7ade24d..e1c5951 100644
--- a/src/mob/components/navbar/normal-navbar/menus/index.jsx
+++ b/src/mob/components/navbar/normal-navbar/menus/index.jsx
@@ -161,7 +161,7 @@
   }
 
   render() {
-    const { columns } = this.props
+    const { columns, datatype } = this.props
     const { menus, visible, editMenu } = this.state
 
     return (
@@ -184,6 +184,7 @@
           <ElementForm
             menu={editMenu}
             cols={columns}
+            datatype={datatype}
             inputSubmit={this.handleSubmit}
             wrappedComponentRef={(inst) => this.menuFormRef = inst}
           />
diff --git a/src/mob/components/navbar/normal-navbar/menus/menuform/index.jsx b/src/mob/components/navbar/normal-navbar/menus/menuform/index.jsx
index a8d4381..60cb2b9 100644
--- a/src/mob/components/navbar/normal-navbar/menus/menuform/index.jsx
+++ b/src/mob/components/navbar/normal-navbar/menus/menuform/index.jsx
@@ -74,7 +74,7 @@
   }
 
   render() {
-    const { menu, cols } = this.props
+    const { menu, cols, datatype } = this.props
     const { getFieldDecorator } = this.props.form
     const { property, appMenus, copyMenu } = this.state
 
@@ -216,7 +216,7 @@
               )}
             </Form.Item>
           </Col>
-          <Col span={12}>
+          {datatype === 'dynamic' ? <Col span={12}>
             <Form.Item label={
               <Tooltip placement="topLeft" title="缁戝畾鎻愮ず瀛楁鍚庯紝浼氬湪鑿滃崟鍙充笂瑙掓樉绀烘彁绀轰俊鎭�傛敞锛氬湪娣诲姞鍥炬爣鏃舵湁鏁堛��">
                 <QuestionCircleOutlined className="mk-form-tip" />
@@ -231,7 +231,7 @@
                 </Select>
               )}
             </Form.Item>
-          </Col>
+          </Col> : null}
           <Col span={12}>
             <Form.Item label="闅愯棌">
               {getFieldDecorator('hidden', {
diff --git a/src/router/index.js b/src/router/index.js
index fe59aa7..a1bc174 100644
--- a/src/router/index.js
+++ b/src/router/index.js
@@ -26,7 +26,7 @@
 const SystemProc = asyncLoadComponent(() => import('@/views/systemproc'))
 // const SystemCheck = asyncLoadComponent(() => import('@/views/syscheck'))
 const MkIframe = asyncLoadComponent(() => import('@/views/mkiframe'))
-const MkAi = asyncLoadComponent(() => import('@/views/mkai'))
+// const MkAi = asyncLoadComponent(() => import('@/views/mkai'))
 
 const routers = [
   {path: '/login', name: 'login', component: Login},
@@ -56,7 +56,7 @@
   {path: '/view/:menuId', name: 'iframe', component: MkIframe},
   {path: '/view/:menuId/:bid', name: 'iframe', component: MkIframe},
   {path: '/interface', name: 'interface', component: Interface},
-  {path: '/ai', name: 'ai', component: MkAi},
+  // {path: '/ai', name: 'ai', component: MkAi},
   // {path: '/syscheck', name: 'syscheck', component: SystemCheck}
 ]
 
diff --git a/src/tabviews/custom/components/share/braftContent/index.scss b/src/tabviews/custom/components/share/braftContent/index.scss
index ab7b200..93359e3 100644
--- a/src/tabviews/custom/components/share/braftContent/index.scss
+++ b/src/tabviews/custom/components/share/braftContent/index.scss
@@ -13,6 +13,8 @@
   br {
     content: "";
     display: block;
+  }
+  br + br {
     height: 18px;
   }
   hr {
@@ -41,10 +43,6 @@
       padding: 5px 10px;
       font-size: var(--table-font-size, 16px);
       border: 1px solid #ddd;
-
-      br:first-of-type {
-        height: 0px;
-      }
     }
   }
   ul {
diff --git a/src/tabviews/zshare/actionList/normalbutton/index.jsx b/src/tabviews/zshare/actionList/normalbutton/index.jsx
index a85684f..d903d9e 100644
--- a/src/tabviews/zshare/actionList/normalbutton/index.jsx
+++ b/src/tabviews/zshare/actionList/normalbutton/index.jsx
@@ -1809,6 +1809,7 @@
       url = btn.interface
     }
 
+    url = url.replace(/@mydomain@/ig, window.GLOB.location)
     
     let param = {}
 
diff --git a/src/tabviews/zshare/mutilform/mkRadio/index.jsx b/src/tabviews/zshare/mutilform/mkRadio/index.jsx
index ac79bbf..f1133b0 100644
--- a/src/tabviews/zshare/mutilform/mkRadio/index.jsx
+++ b/src/tabviews/zshare/mutilform/mkRadio/index.jsx
@@ -54,6 +54,13 @@
         this.setState({
           value: nextProps.config.initval,
         })
+        if (config.linkFields && nextProps.config.initval) {
+          config.linkFields.forEach((m, i) => {
+            setTimeout(() => {
+              MKEmitter.emit('mkFP', m.uuid, nextProps.config.initval, 0)
+            }, (i + 1) * 70)
+          })
+        }
       } else if (option && typeof(option.value) !== typeof(value)) {
         if (typeof(option.value) === 'number' && !isNaN(value)) {
           this.setState({
diff --git a/src/tabviews/zshare/mutilform/mkSelect/index.jsx b/src/tabviews/zshare/mutilform/mkSelect/index.jsx
index c08ba6f..ebc1a80 100644
--- a/src/tabviews/zshare/mutilform/mkSelect/index.jsx
+++ b/src/tabviews/zshare/mutilform/mkSelect/index.jsx
@@ -61,6 +61,13 @@
         this.setState({
           value: nextProps.config.initval,
         })
+        if (config.linkFields && nextProps.config.initval) {
+          config.linkFields.forEach((m, i) => {
+            setTimeout(() => {
+              MKEmitter.emit('mkFP', m.uuid, nextProps.config.initval, 0)
+            }, (i + 1) * 70)
+          })
+        }
       } else if (option && typeof(option.value) !== typeof(value)) {
         if (typeof(option.value) === 'number' && !isNaN(value)) {
           this.setState({
diff --git a/src/tabviews/zshare/topSearch/index.jsx b/src/tabviews/zshare/topSearch/index.jsx
index b6eed2b..6b79f41 100644
--- a/src/tabviews/zshare/topSearch/index.jsx
+++ b/src/tabviews/zshare/topSearch/index.jsx
@@ -381,7 +381,7 @@
   UNSAFE_componentWillReceiveProps(nextProps) {
     const { config, BID } = this.props
 
-    if (config.checkBid && config.type !== 'search' && nextProps.BID !== BID) {
+    if (config.$checkBid && nextProps.BID !== BID) {
       this.resetOptions(nextProps.BID)
     }
   }
diff --git a/src/utils/utils-custom.js b/src/utils/utils-custom.js
index dc7f0de..5c4b811 100644
--- a/src/utils/utils-custom.js
+++ b/src/utils/utils-custom.js
@@ -1983,15 +1983,20 @@
 
       if (cell.OpenType === 'form' && cell.formType === 'count_line') return
      
-      if (cell.intertype === 'system') {
-        // if (cell.Ot === 'notRequired' && cell.verify && cell.verify.voucher && cell.verify.voucher.enabled) {
-        //   errors.push({ level: 0, detail: `鎸夐挳鈥�${cell.label}鈥濅娇鐢ㄤ簡鍒涘缓鍑瘉鍑芥暟锛岄渶瑕侀�夋嫨琛岋紒`})
-        // }
-      } else if (cell.intertype === 'custom' || cell.intertype === 'outer') {
-        if (cell.callbackType === 'script' && (!cell.verify || !cell.verify.cbScripts || cell.verify.cbScripts.filter(item => item.status !== 'false').length === 0)) {
-          errors.push({ level: 0, detail: `鎸夐挳鈥�${cell.label}鈥濅娇鐢ㄤ簡鑷畾涔夎剼鏈洖璋冿紝鍥炶皟鑴氭湰涓嶅彲涓虹┖锛乣})
-        // } else if (cell.procMode === 'system' && cell.Ot === 'notRequired' && cell.verify && cell.verify.voucher && cell.verify.voucher.enabled) {
-        //   errors.push({ level: 0, detail: `鎸夐挳鈥�${cell.label}鈥濅娇鐢ㄤ簡鍒涘缓鍑瘉鍑芥暟锛岄渶瑕侀�夋嫨琛岋紒`})
+      // if (cell.intertype === 'system') {
+      //   // if (cell.Ot === 'notRequired' && cell.verify && cell.verify.voucher && cell.verify.voucher.enabled) {
+      //   //   errors.push({ level: 0, detail: `鎸夐挳鈥�${cell.label}鈥濅娇鐢ㄤ簡鍒涘缓鍑瘉鍑芥暟锛岄渶瑕侀�夋嫨琛岋紒`})
+      //   // }
+      // } else if (cell.intertype === 'custom' || cell.intertype === 'outer') {
+      //   if (cell.callbackType === 'script' && (!cell.verify || !cell.verify.cbScripts || cell.verify.cbScripts.filter(item => item.status !== 'false').length === 0)) {
+      //     errors.push({ level: 0, detail: `鎸夐挳鈥�${cell.label}鈥濅娇鐢ㄤ簡鑷畾涔夎剼鏈洖璋冿紝鍥炶皟鑴氭湰涓嶅彲涓虹┖锛乣})
+      //   // } else if (cell.procMode === 'system' && cell.Ot === 'notRequired' && cell.verify && cell.verify.voucher && cell.verify.voucher.enabled) {
+      //   //   errors.push({ level: 0, detail: `鎸夐挳鈥�${cell.label}鈥濅娇鐢ㄤ簡鍒涘缓鍑瘉鍑芥暟锛岄渶瑕侀�夋嫨琛岋紒`})
+      //   }
+      // }
+      if ((cell.intertype === 'custom' || cell.intertype === 'outer') && cell.callbackType === 'script') {
+        if (!cell.verify || !cell.verify.cbScripts) {
+          errors.push({ level: 0, detail: `鎸夐挳鈥�${cell.label}鈥濅娇鐢ㄤ簡鑷畾涔夎剼鏈洖璋冿紝璇疯缃獙璇佷俊鎭紒`})
         }
       }
     } else if (cell.OpenType === 'funcbutton') {
diff --git a/src/utils/utils.js b/src/utils/utils.js
index dbda559..cc06e69 100644
--- a/src/utils/utils.js
+++ b/src/utils/utils.js
@@ -192,8 +192,10 @@
    * @param {Array}   searches     鎼滅储鏉′欢
    */
   static initSearchVal (config) {
-    if (!config.search) {
+    if (!config.search || config.search.length === 0) {
       config.search = []
+      config.$s_keys = []
+      config.$s_req = false
       return
     }
 
@@ -247,9 +249,6 @@
 
               config.checkBid = true
               item.checkShift = true
-              if (config.setting) {
-                config.setting.checkBid = true
-              }
             }
 
             item.initval = ''
@@ -315,9 +314,6 @@
 
               config.checkBid = true
               item.checkShift = true
-              if (config.setting) {
-                config.setting.checkBid = true
-              }
             }
 
             item.initval = ''
@@ -416,9 +412,6 @@
         if (/@BID@/ig.test(item.dataSource) && supModule) {
           config.checkBid = true
           item.checkBid = true
-          if (config.setting) {
-            config.setting.checkBid = true
-          }
         }
         if (item.initval === '$first') {
           item.initval = ''
@@ -467,6 +460,15 @@
       return item
     })
 
+    if (config.checkBid) {
+      if (config.setting) {
+        config.setting.checkBid = true
+      }
+      if (config.type !== 'search') {
+        config.$checkBid = true
+      }
+    }
+
     config.$s_keys = keys
     config.$s_req = required
   }
diff --git a/src/views/menudesign/index.jsx b/src/views/menudesign/index.jsx
index 0c66ca1..56d8e6c 100644
--- a/src/views/menudesign/index.jsx
+++ b/src/views/menudesign/index.jsx
@@ -828,13 +828,7 @@
         }
 
         long_data = []
-        // let oriIds = {}
-        // if (config.allSqls) {
-        //   config.allSqls.forEach(item => {
-        //     if (!item.md5) return
-        //     oriIds[item.uuid + item.md5] = item.v_id
-        //   })
-        // }
+
         let perm = true
         if (config.permission === 'false' || config.sqlperm === 'false') {
           perm = false
@@ -843,10 +837,6 @@
         config.allSqls = sqls.map(item => {
           let v_id = _t + getguid()
 
-          // if (oriIds[item.uuid + item.md5]) {
-          //   v_id = oriIds[item.uuid + item.md5]
-          // }
-
           long_data.push(`${md5(window.GLOB.appkey + v_id)},${item.uuid},${v_id},${window.btoa(window.encodeURIComponent(item.LText))},${perm ? item.roleId || '' : ''}`)
           
           return {
@@ -854,7 +844,6 @@
             v_id: v_id,
             type: item.type,
             reps: item.reps,
-            // md5: item.md5 || '',
             luser: item.luser === true
           }
         })
diff --git a/src/views/mkai/index.jsx b/src/views/mkai/index.jsx
index 05fddfb..aff559b 100644
--- a/src/views/mkai/index.jsx
+++ b/src/views/mkai/index.jsx
@@ -4,6 +4,7 @@
 import { LoadingOutlined, EditOutlined, DeleteOutlined } from '@ant-design/icons'
 // import { Prism as SyntaxHighlighter } from 'react-syntax-highlighter'
 // import { dark } from 'react-syntax-highlighter/dist/esm/styles/prism'
+import { fetchEventSource } from '@microsoft/fetch-event-source'
 import moment from 'moment'
 
 import Api from '@/api'
@@ -180,46 +181,13 @@
     message.success('澶嶅埗鎴愬姛銆�')
   }
 
-  // eslint-disable-next-line
-  // let html = marked(item.content, {
-  //   highlight: (code, language) => {
-  //   // 閫氳繃鏃堕棿鎴崇敓鎴愬敮涓�鏍囪瘑
-  //   const codeIndex = parseInt(Date.now() + "") + Math.floor(Math.random() * 10000000)
-  //   // 鏍煎紡鍖栫涓�琛屾槸鍙充晶language鍜� 鈥滃鍒垛�� 鎸夐挳锛�
-  //   let html = ` 
-  //     <div class=${styles["code-block-header"]}>
-  //       <span>${language}</span>
-  //       <span id='copy-btn'data-clipboard-action="copy" data-clipboard-target="#copy${codeIndex}">澶嶅埗浠g爜</span>
-  //     </div>
-  //   `
-    
-  //   //浠g爜閮ㄥ垎
-  //   if (code) {
-  //     try {
-  //     // 浣跨敤 highlight.js 瀵逛唬鐮佽繘琛岄珮浜樉绀�
-  //       const preCode = hljs.highlightAuto(code).value;
-  //       // 灏嗕唬鐮佸寘瑁瑰湪 textarea 涓紝鐢变簬闃叉textarea娓叉煋鍑虹幇闂锛岃繖閲屽皢 "<" 鐢� "&lt;" 浠f浛锛屼笉褰卞搷澶嶅埗鍔熻兘
-  //       return `<pre class='${styles["hljs-customer"]} hljs'>
-  //           <code>${preCode}</code>
-  //       </pre>
-  //       <textarea style="position: absolute;top: -9999px;left: -9999px;z-index: -9999;" id="copy${codeIndex}">${code.replace(/<\/textarea>/g,"&lt;/textarea>")}</textarea>`;
-  //     } catch (error) {
-
-  //       }
-  //     }
-  //   }
-  // })
-  // <SyntaxHighlighter language="javascript" style={dark}>
-  //   {item.content}
-  // </SyntaxHighlighter>
-
   return (
     <div className="assist-wrap" {...restProps}>
       <DeepSeekLogo/>
-      {item.type === 'deepseek-reasoner' ? <div className="top-level">
+      <div className="top-level">
         <DeepSeekIcon />
         {item.loading ? '鎬濊�冧腑...' : '宸叉繁搴︽�濊��'}
-      </div> : null}
+      </div>
       {item.loading ? <LoadingOutlined /> : null}
       <div dangerouslySetInnerHTML={{ __html: item.content }}></div>
       {item.oriText ? <MkCopy onClick={copy}/> : null}
@@ -233,8 +201,9 @@
     UserID: '',
     LoginUID: '',
     textInput: '',
-    type: 'deepseek-reasoner', // deepseek-chat deepseek-reasoner
+    type: 'DeepSeek-R1-Distill-Qwen-32B', // deepseek-chat deepseek-reasoner
     currentChat: {id: '', list: [], title: ''},
+    dpChat: null,
     chats: []
   }
 
@@ -380,7 +349,7 @@
             id: cell.id,
             content: _content,
             oriText: content,
-            type: cell.typecharone || '',
+            type: 'deepseek-reasoner',
             role
           }
         })
@@ -390,14 +359,14 @@
     })
   }
 
-  changeType = () => {
-    const { type } = this.state
+  // changeType = () => {
+  //   const { type } = this.state
 
-    this.setState({type: type === 'deepseek-reasoner' ? 'deepseek-chat' : 'deepseek-reasoner'})
-  }
+  //   this.setState({type: type === 'deepseek-reasoner' ? 'deepseek-chat' : 'deepseek-reasoner'})
+  // }
 
   submit = () => {
-    const { textInput, currentChat, UserID, LoginUID, loading, type } = this.state
+    const { textInput, currentChat, loading, type /*, UserID, LoginUID*/ } = this.state
 
     let val = textInput.replace(/\t+|\v+/g, '').replace(/^\s+|\s+$/g, '')
 
@@ -406,122 +375,174 @@
     let node = document.getElementById('mk-input')
     node && node.blur()
 
-    let isNew = false
+    // let isNew = false
+    const that = this
     let chat = fromJS(currentChat).toJS()
 
-    if (!chat.id) {
-      chat.id = Utils.getuuid()
-      isNew = true
-    }
-
     chat.list.push({ role: 'user', content: val, id: Utils.getuuid() })
-    chat.list.push({ role: 'assistant', content: '', type: type, loading: true, id: Utils.getuuid() })
 
     if (!chat.title) {
       chat.title = val.substr(0, 32)
     }
     chat.loading = true
 
-    this.setState({textInput: '', currentChat: chat})
+    let reschat = { role: 'assistant', content: '', type: type, loading: true, id: Utils.getuuid() }
 
-    let list = []
-    chat.list.forEach(item => {
-      if (!item.loading) {
-        list.push({
-          role: item.role,
-          content: item.oriText || item.content
-        })
-      }
-    })
+    this.setState({textInput: '', currentChat: fromJS(chat).toJS(), dpChat: reschat})
 
-    Api.directRequest({
-      url: burl + '/chat/completions',
-      method: 'post',
-      headers: { 'Content-Type': 'application/json' },
-      data: {
-        model: type,
-        messages: list,
-        stream: false
-      }
-    }).then(res => {
-      let _chat = fromJS(chat).toJS()
+    // let list = []
+    // chat.list.forEach(item => {
+    //   if (!item.loading) {
+    //     list.push({
+    //       role: item.role,
+    //       content: item.oriText || item.content
+    //     })
+    //   }
+    // })
 
-      delete _chat.loading
-      _chat.list.pop()
+    // const ctrlAbout = new AbortController()
+    // const { signal } = ctrlAbout
+    let contents = []
+    let timer = setInterval(() => {
+      if (contents.length) {
+        let _cont = contents.shift()
 
-      let _val = '鏈嶅姟鍣ㄧ箒蹇欙紝璇风◢鍚庡啀璇曘��'
-      let _html = _val
-      let tokens_count = 0
-      if (res.success && res.choices && res.choices[0]) {
-        _val = res.choices[0].message.content
-        _html = this.getAssistVal(_val)
-      } else if (!res.success && res.rawStatusCode === 400 && res.message && /This\s*model's\s*maximum\s*context\s*length/.test(res.message)) {
-        _html = `褰撳墠瀵硅瘽宸茶秴鍑�${type === 'deepseek-reasoner' ? '娣卞害鎬濊�冪殑' : ''}鏈�澶ч暱搴﹂檺鍒讹紝寮�鍚竴涓柊瀵硅瘽缁х画鎬濊�冨惂~`
-        _val = _html
-      }
-
-      if (res.usage && res.usage.total_tokens) {
-        tokens_count = res.usage.total_tokens
-      }
-
-      _chat.list = _chat.list.map(item => {
-        delete item.loading
-        delete item.step
-        return item
-      })
-
-      _chat.list.push({ role: 'assistant', content: _html, oriText: _val, type: type, step: true, id: Utils.getuuid() })
-
-      this.setState({currentChat: _chat})
-
-      Api.genericInterface({
-        func: 's_deepseek_ai',
-        rduri: burl + '/webapi/dostars',
-        file_url: '',
-        userid: UserID,
-        LoginUID: LoginUID,
-        u_id: sessionStorage.getItem('UserID'),
-        content: window.btoa(window.encodeURIComponent(_val)),
-        title: window.btoa(window.encodeURIComponent(chat.title)),
-        data_type: 'reply',
-        tokens_count: tokens_count,
-        version: type,
-        ID: chat.id
-      }).then(r => {
-        if (!r.status) {
-          notification.error({
-            top: 92,
-            message: r.message,
-            duration: 10
-          })
-        } else if (isNew) {
-          this.getList()
+        if (_cont === '[CLOSE]') {
+          clearInterval(timer)
+          chat.list.push(reschat)
+          that.setState({dpChat: null, currentChat: chat, loading: false})
+        } else {
+          reschat.content += _cont
+    
+          if (_cont === '</think>') {
+            delete reschat.loading
+          }
+  
+          that.setState({dpChat: reschat})
         }
-      })
-    })
+      }
+    }, 30)
 
-    Api.genericInterface({
-      func: 's_deepseek_ai',
-      rduri: burl + '/webapi/dostars',
-      file_url: '',
-      userid: UserID,
-      LoginUID: LoginUID,
-      u_id: sessionStorage.getItem('UserID'),
-      content: window.btoa(window.encodeURIComponent(val)),
-      title: window.btoa(window.encodeURIComponent(chat.title)),
-      data_type: 'request',
-      version: type,
-      tokens_count: 0,
-      ID: chat.id
-    }).then(result => {
-      if (!result.status) {
-        notification.error({
-          top: 92,
-          message: result.message,
-          duration: 10
-        })
+    fetchEventSource(burl + '/chat', {
+      mode: 'cors',
+      method: 'POST',
+      headers: {
+        'Content-Type': 'application/json',
+        'Accept': 'text/event-stream'
+      },
+      body: JSON.stringify({
+        chat_session_id: chat.id || '',
+        model: type,
+        prompt: val,
+        stream: true
+      }),
+      onmessage(event) {
+        if (event.data) {
+          if (event.data === '[CLOSE]') {
+            contents.push(event.data)
+          } else {
+            let data = JSON.parse(event.data)
+            if (!chat.id && data.id) {
+              chat.id = data.id
+            }
+            contents.push(data.content)
+          }
+        }
+      },
+      onclose() {},
+      onerror(error) {
+        console.info(error)
       }
     })
+
+    // Api.directRequest({
+    //   url: burl + '/chat/completions',
+    //   method: 'post',
+    //   headers: { 'Content-Type': 'application/json' },
+    //   data: {
+    //     model: type,
+    //     messages: list,
+    //     stream: false
+    //   }
+    // }).then(res => {
+    //   let _chat = fromJS(chat).toJS()
+
+    //   delete _chat.loading
+    //   _chat.list.pop()
+
+    //   let _val = '鏈嶅姟鍣ㄧ箒蹇欙紝璇风◢鍚庡啀璇曘��'
+    //   let _html = _val
+    //   let tokens_count = 0
+    //   if (res.success && res.choices && res.choices[0]) {
+    //     _val = res.choices[0].message.content
+    //     _html = this.getAssistVal(_val)
+    //   } else if (!res.success && res.rawStatusCode === 400 && res.message && /This\s*model's\s*maximum\s*context\s*length/.test(res.message)) {
+    //     _html = `褰撳墠瀵硅瘽宸茶秴鍑�${type === 'deepseek-reasoner' ? '娣卞害鎬濊�冪殑' : ''}鏈�澶ч暱搴﹂檺鍒讹紝寮�鍚竴涓柊瀵硅瘽缁х画鎬濊�冨惂~`
+    //     _val = _html
+    //   }
+
+    //   if (res.usage && res.usage.total_tokens) {
+    //     tokens_count = res.usage.total_tokens
+    //   }
+
+    //   _chat.list = _chat.list.map(item => {
+    //     delete item.loading
+    //     delete item.step
+    //     return item
+    //   })
+
+    //   _chat.list.push({ role: 'assistant', content: _html, oriText: _val, type: type, step: true, id: Utils.getuuid() })
+
+    //   this.setState({currentChat: _chat})
+
+    //   Api.genericInterface({
+    //     func: 's_deepseek_ai',
+    //     rduri: burl + '/webapi/dostars',
+    //     file_url: '',
+    //     userid: UserID,
+    //     LoginUID: LoginUID,
+    //     u_id: sessionStorage.getItem('UserID'),
+    //     content: window.btoa(window.encodeURIComponent(_val)),
+    //     title: window.btoa(window.encodeURIComponent(chat.title)),
+    //     data_type: 'reply',
+    //     tokens_count: tokens_count,
+    //     version: type,
+    //     ID: chat.id
+    //   }).then(r => {
+    //     if (!r.status) {
+    //       notification.error({
+    //         top: 92,
+    //         message: r.message,
+    //         duration: 10
+    //       })
+    //     } else if (isNew) {
+    //       this.getList()
+    //     }
+    //   })
+    // })
+
+    // Api.genericInterface({
+    //   func: 's_deepseek_ai',
+    //   rduri: burl + '/webapi/dostars',
+    //   file_url: '',
+    //   userid: UserID,
+    //   LoginUID: LoginUID,
+    //   u_id: sessionStorage.getItem('UserID'),
+    //   content: window.btoa(window.encodeURIComponent(val)),
+    //   title: window.btoa(window.encodeURIComponent(chat.title)),
+    //   data_type: 'request',
+    //   version: type,
+    //   tokens_count: 0,
+    //   ID: chat.id
+    // }).then(result => {
+    //   if (!result.status) {
+    //     notification.error({
+    //       top: 92,
+    //       message: result.message,
+    //       duration: 10
+    //     })
+    //   }
+    // })
   }
 
   getAssistVal = (val) => {
@@ -595,10 +616,10 @@
   }
 
   render () {
-    const { loading, textInput, type, currentChat, chats } = this.state
+    const { loading, textInput, currentChat, chats, dpChat } = this.state
 
     let able = textInput && !/^\s+$/.test(textInput)
-    let empty = !currentChat.id
+    let empty = currentChat.list.length === 0
 
     return (
       <div className="mk-deepseek-wrap">
@@ -643,6 +664,7 @@
                     return <UserChat key={item.id} item={item}/>
                   }
                 })}
+                {dpChat ? <DpChat key='chat' item={dpChat}/> : null}
               </div> : null}
               {!empty ? <div className="chat-reset">
                 <div className="wrap" onClick={this.newContent}>
@@ -657,7 +679,7 @@
                       <TextArea id="mk-input" value={textInput} autoSize={{minRows: 2, maxRows: 12}} placeholder="缁� DeepSeek 鍙戦�佹秷鎭� " onChange={this.changeVal} onPressEnter={this.submit}/>
                     </div>
                     <div className="ec4f5d61">
-                      {type === 'deepseek-chat' ? <Tooltip placement="left" title="璋冪敤鏂版ā鍨� DeekSeek-R1锛岃В鍐虫帹鐞嗛棶棰�">
+                      {/* {type === 'deepseek-chat' ? <Tooltip placement="left" title="璋冪敤鏂版ā鍨� DeekSeek-R1锛岃В鍐虫帹鐞嗛棶棰�">
                         <div className="ds-button" onClick={this.changeType}>
                           <DeepSeekIcon/>
                           <span className="text">娣卞害鎬濊�� (R1)</span>
@@ -665,7 +687,7 @@
                       </Tooltip> : <div className="ds-button active" onClick={this.changeType}>
                         <DeepSeekIcon/>
                         <span className="text">娣卞害鎬濊�� (R1)</span>
-                      </div>}
+                      </div>} */}
                       {/* <div className="ds-button">
                         <span className="ds-icon">
                           <svg width="20" height="20" viewBox="0 0 20 20" fill="none"><circle cx="10" cy="10" r="9" stroke="currentColor" strokeWidth="1.8"></circle><path d="M10 1c1.657 0 3 4.03 3 9s-1.343 9-3 9M10 19c-1.657 0-3-4.03-3-9s1.343-9 3-9M1 10h18" stroke="currentColor" strokeWidth="1.8"></path></svg>

--
Gitblit v1.8.0