From 32431a7ce3f9a642ec988cf21bcda8935070ddd2 Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期五, 14 二月 2025 12:04:29 +0800
Subject: [PATCH] 2025-02-14

---
 src/menu/debug/index.jsx                              |    3 +
 src/tabviews/zshare/actionList/normalbutton/index.jsx |   30 +++++----
 src/templates/zshare/verifycard/index.jsx             |    1 
 src/views/mkai/index.jsx                              |  112 ++++++++++++++++++++++++++++++-------
 src/views/mkai/index.scss                             |    5 +
 5 files changed, 115 insertions(+), 36 deletions(-)

diff --git a/src/menu/debug/index.jsx b/src/menu/debug/index.jsx
index a18b52e..75a83a4 100644
--- a/src/menu/debug/index.jsx
+++ b/src/menu/debug/index.jsx
@@ -1762,6 +1762,7 @@
     _sql = _sql.replace(/@BID@/ig, `'${BID}'`)
     _sql = _sql.replace(/@typename@/ig, `'typename'`)
     _sql = _sql.replace(/@\$|\$@/ig, '').replace(/@datam@/ig, `''`)
+    _sql = _sql.replace(/\$check@|@check\$/ig, '')
   
     return _sql
   }
@@ -2028,6 +2029,8 @@
         aaa: select @ErrorCode as ErrorCode,@retmsg as retmsg`
     }
 
+    sql = sql.replace(/\$check@|@check\$/ig, '')
+
     return sql
   }
 
diff --git a/src/tabviews/zshare/actionList/normalbutton/index.jsx b/src/tabviews/zshare/actionList/normalbutton/index.jsx
index 279985e..ab1d815 100644
--- a/src/tabviews/zshare/actionList/normalbutton/index.jsx
+++ b/src/tabviews/zshare/actionList/normalbutton/index.jsx
@@ -1123,20 +1123,22 @@
         let works_flow_sign_field = 'statuscharone'
         let works_flow_sign_label = ''
         let works_begin_branch = ''
-        if (line.approvalMethod === 'countersign' && node.checkIds.length > 1) {
-          works_flow_countersign = 'Y'
-          let mark = line.mark || '宸插鏍�'
-          let fields = ['statuscharone', 'statuschartwo', 'statuscharthree', 'statuscharfour', 'statuscharfive']
-          node.checkUsers.forEach((user, index) => {
-            if (user.worker_id === userid) {
-              works_flow_sign_field = fields[index]
-              works_flow_sign_label = `${user.parentNames[2] || ''}${user.workername || ''}${mark}`
-            } else {
-              works_flow_sign_values += `${user.parentNames[2] || ''}${user.workername || ''}${mark}`
-            }
-          })
-        } else {
-          works_begin_branch = line.mknode === 'startEdge' ? 'Y' : ''
+        if (line) {
+          if (line.approvalMethod === 'countersign' && node.checkIds.length > 1) {
+            works_flow_countersign = 'Y'
+            let mark = line.mark || '宸插鏍�'
+            let fields = ['statuscharone', 'statuschartwo', 'statuscharthree', 'statuscharfour', 'statuscharfive']
+            node.checkUsers.forEach((user, index) => {
+              if (user.worker_id === userid) {
+                works_flow_sign_field = fields[index]
+                works_flow_sign_label = `${user.parentNames[2] || ''}${user.workername || ''}${mark}`
+              } else {
+                works_flow_sign_values += `${user.parentNames[2] || ''}${user.workername || ''}${mark}`
+              }
+            })
+          } else {
+            works_begin_branch = line.mknode === 'startEdge' ? 'Y' : ''
+          }
         }
 
         exps.push(
diff --git a/src/templates/zshare/verifycard/index.jsx b/src/templates/zshare/verifycard/index.jsx
index e6c8b75..1b2627f 100644
--- a/src/templates/zshare/verifycard/index.jsx
+++ b/src/templates/zshare/verifycard/index.jsx
@@ -1740,6 +1740,7 @@
     _sql = _sql.replace(/@BID@/ig, `'${BID}'`)
     _sql = _sql.replace(/@typename@/ig, `'typename'`)
     _sql = _sql.replace(/@\$|\$@/ig, '').replace(/@datam@/ig, `''`)
+    _sql = _sql.replace(/\$check@|@check\$/ig, '')
   
     return _sql
   }
diff --git a/src/views/mkai/index.jsx b/src/views/mkai/index.jsx
index 64b076e..ec2e43b 100644
--- a/src/views/mkai/index.jsx
+++ b/src/views/mkai/index.jsx
@@ -1,8 +1,9 @@
 import React, { Component, useState } from 'react'
+import { fromJS } from 'immutable'
 import { Spin, notification, Tooltip, Input } from 'antd'
 
 import Api from '@/api'
-// import Utils from '@/utils/utils.js'
+import Utils from '@/utils/utils.js'
 
 import avatar from '@/assets/img/avatar.jpg'
 import './index.scss'
@@ -78,6 +79,7 @@
     LoginUID: '',
     textInput: '',
     type: 'deepseek-chat', // deepseek-chat deepseek-reasoner
+    currentChat: {uuid: Utils.getuuid(), list: [], title: ''}
   }
 
   UNSAFE_componentWillMount() {
@@ -135,13 +137,15 @@
           duration: 10
         })
       } else {
-
+        this.setState({
+          chats: result.data || []
+        })
       }
     })
   }
 
   newContent = () => {
-    this.setState({textInput: ''})
+    this.setState({textInput: '', currentChat: {uuid: Utils.getuuid(), list: [], title: ''}})
     let node = document.getElementById('mk-input')
     node && node.focus()
   }
@@ -157,35 +161,101 @@
   }
 
   submit = () => {
-    const { textInput } = this.state
+    const { textInput, currentChat, UserID, LoginUID } = this.state
 
     let val = textInput.replace(/\t+|\v+/g, '').replace(/^\s+|\s+$/g, '')
 
-    if (!val) return
+    if (!val || currentChat.loading) return
 
     let node = document.getElementById('mk-input')
     node && node.blur()
 
-    this.setState({textInput: ''})
+    let chat = fromJS(currentChat).toJS()
+    chat.list.push({ role: 'user', content: val })
+    chat.list.push({ role: 'assistant', content: '', loading: true })
 
-    // Api.directRequest({
-    //   url: burl + '/chat/completions',
-    //   method: 'post',
-    //   headers: { 'Content-Type': 'application/json' },
-    //   data: {
-    //     model: this.state.type,
-    //     messages: [
-    //       { role: 'user', content: val }
-    //     ],
-    //     stream: false
-    //   }
-    // }).then(result => {
+    if (!chat.title) {
+      chat.title = val.substr(0, 32)
+    }
+    chat.loading = true
 
-    // })
+    this.setState({textInput: '', currentChat: chat})
+
+    Api.directRequest({
+      url: burl + '/chat/completions',
+      method: 'post',
+      headers: { 'Content-Type': 'application/json' },
+      data: {
+        model: this.state.type,
+        messages: chat.list,
+        stream: false
+      }
+    }).then(res => {
+      let _chat = fromJS(chat).toJS()
+
+      delete _chat.loading
+      _chat.list.shift()
+
+      let _val = '鏈嶅姟鍣ㄧ箒蹇欙紝璇风◢鍚庡啀璇曘��'
+      if (res.success && res.choices && res.choices[0]) {
+        _val = res.choices[0].message.content
+      }
+
+      _chat.list = _chat.list.map(item => {
+        delete item.step
+        return item
+      })
+
+      _chat.list.push({ role: 'assistant', content: _val, step: true })
+
+      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',
+        ID: chat.uuid
+      }).then(r => {
+        if (!r.status) {
+          notification.error({
+            top: 92,
+            message: r.message,
+            duration: 10
+          })
+        }
+      })
+    })
+
+    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',
+      ID: chat.uuid
+    }).then(result => {
+      if (!result.status) {
+        notification.error({
+          top: 92,
+          message: result.message,
+          duration: 10
+        })
+      }
+    })
   }
 
   render () {
-    const { loading, textInput, type } = this.state
+    const { loading, textInput, type, currentChat } = this.state
 
     let able = textInput && !/^\s+$/.test(textInput)
 
@@ -201,7 +271,7 @@
           <div className="mk-right">
             <div className="mk-faad">
               <div className="title">
-                <span>鏍囬</span>
+                <span>{currentChat.title}</span>
               </div>
             </div>
             <div className="mk-ksje">
diff --git a/src/views/mkai/index.scss b/src/views/mkai/index.scss
index 610e41f..4bcae79 100644
--- a/src/views/mkai/index.scss
+++ b/src/views/mkai/index.scss
@@ -356,7 +356,7 @@
                     white-space: nowrap;
                     cursor: pointer;
                     color: #fff;
-                    background: var(--mk-sys-color);
+                    background: var(--mk-sys-color5);
                     border: none;
                     border-radius: 16px;
                     min-width: 32px;
@@ -365,6 +365,9 @@
                     justify-content: center;
                     display: flex;
                   }
+                  .ds-icon:not(.disabled):hover {
+                    background: var(--mk-sys-color);
+                  }
 
                   .ds-icon.disabled {
                     background: var(--mk-sys-color4);

--
Gitblit v1.8.0