king
2025-03-18 5a28b02ca32e2da88aefc9261a47061a3b2a7694
Merge branch 'develop'
19个文件已修改
510 ■■■■■ 已修改文件
package-lock.json 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
package.json 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/menu/components/search/main-search/index.jsx 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/menu/components/share/actioncomponent/actionform/index.jsx 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/menu/datasource/index.jsx 9 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/menu/datasource/verifycard/index.jsx 10 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/menu/debug/index.jsx 72 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/mob/components/navbar/normal-navbar/index.jsx 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/mob/components/navbar/normal-navbar/menus/index.jsx 3 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/mob/components/navbar/normal-navbar/menus/menuform/index.jsx 6 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/tabviews/custom/components/share/braftContent/index.scss 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/tabviews/zshare/actionList/normalbutton/index.jsx 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/tabviews/zshare/mutilform/mkRadio/index.jsx 7 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/tabviews/zshare/mutilform/mkSelect/index.jsx 7 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/tabviews/zshare/topSearch/index.jsx 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/utils/utils-custom.js 23 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/utils/utils.js 22 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/menudesign/index.jsx 13 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/mkai/index.jsx 312 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
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",
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",
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}, () => {
src/menu/components/share/actioncomponent/actionform/index.jsx
@@ -161,6 +161,8 @@
    let reRequired = {}
    let reReadonly = {}
    reTooltip.interface = ''
    reTooltip.proInterface = '正式系统所使用的接口地址。'
    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 代表 ${window.GLOB.baseurl}webapi/dostars。`
        reTooltip.proInterface += reTooltip.interface
      } else if (intertype === 'outer') {
        shows.push('procMode', 'sysInterface', 'outerFunc', 'callbackType')
        if (this.record.procMode === 'system') {
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})
    })
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')
      }
    })
  }
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 = []
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>
    )
  }
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}
          />
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', {
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 {
src/tabviews/zshare/actionList/normalbutton/index.jsx
@@ -1809,6 +1809,7 @@
      url = btn.interface
    }
    url = url.replace(/@mydomain@/ig, window.GLOB.location)
    
    let param = {}
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({
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({
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)
    }
  }
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') {
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
  }
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
          }
        })
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}">复制代码</span>
  //     </div>
  //   `
  //   //代码部分
  //   if (code) {
  //     try {
  //     // 使用 highlight.js 对代码进行高亮显示
  //       const preCode = hljs.highlightAuto(code).value;
  //       // 将代码包裹在 textarea 中,由于防止textarea渲染出现问题,这里将 "<" 用 "&lt;" 代替,不影响复制功能
  //       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>