Browse Source

屏蔽关键词检索

master
HolyKnightIX 1 year ago
parent
commit
2d234f03af
2 changed files with 29 additions and 33 deletions
  1. +28
    -32
      miniprogram/pages/chat/chat.js
  2. +1
    -1
      project.private.config.json

+ 28
- 32
miniprogram/pages/chat/chat.js View File

@@ -105,44 +105,40 @@ Page({
send() {
if (!this.data.message) return

this.msgSec(this.data.message)
.then(() => {
console.log('非敏感词,放行');
// 当socket连接被关闭时,重新连接socket
if (this.data.reLoadSocket) {
this.socketLink()
this.setData({
waitingMessage: this.data.message
})
}

const data = {
message: this.data.message,
id: 1 // 带id为用户发送的讯息,不带则为服务器返回的讯息
}
// 当socket连接被关闭时,重新连接socket
if (this.data.reLoadSocket) {
this.socketLink()
this.setData({
waitingMessage: this.data.message
})
}

const data = {
message: this.data.message,
id: 1 // 带id为用户发送的讯息,不带则为服务器返回的讯息
}

const arr = this.data.chatList
arr.push(data)
const arr = this.data.chatList
arr.push(data)

// 非重载状态下向服务器发送讯息
if (!this.data.reLoadSocket) {
this.socketSend(this.data.message)
}
// 非重载状态下向服务器发送讯息
if (!this.data.reLoadSocket) {
this.socketSend(this.data.message)
}

this.setData({
chatList: arr,
message: '',
messageFlag: true
})
console.log(this.data.chatList, 'chatList');
this.setData({
chatList: arr,
message: '',
messageFlag: true
})
console.log(this.data.chatList, 'chatList');

this.msgSec(this.data.message)
.then(() => {
console.log('非敏感词,放行');
}).catch(() => {
console.log('触发敏感词!');
// wx.showToast({
// title: '触发敏感词!',
// icon: 'error',
// duration: 5000
// })
return
})
},



+ 1
- 1
project.private.config.json View File

@@ -3,7 +3,7 @@
"projectname": "GPT-Agent",
"setting": {
"compileHotReLoad": true,
"urlCheck": false
"urlCheck": true
},
"libVersion": "2.31.0",
"condition": {


Loading…
Cancel
Save