mirror of
https://github.com/ikechan8370/chatgpt-plugin.git
synced 2025-12-17 13:57:10 +00:00
fix: 修改claude moderation鉴别方式
This commit is contained in:
parent
aa040d4bf1
commit
3e1fcad103
1 changed files with 8 additions and 4 deletions
|
|
@ -1,7 +1,7 @@
|
||||||
import { Config } from '../config.js'
|
import { Config } from '../config.js'
|
||||||
import slack from '@slack/bolt'
|
import slack from '@slack/bolt'
|
||||||
import delay from 'delay'
|
import delay from 'delay'
|
||||||
import {limitString} from "../common.js";
|
import { limitString } from '../common.js'
|
||||||
let proxy
|
let proxy
|
||||||
if (Config.proxy) {
|
if (Config.proxy) {
|
||||||
try {
|
try {
|
||||||
|
|
@ -78,11 +78,13 @@ export class SlackClaudeClient {
|
||||||
token: this.config.slackUserToken,
|
token: this.config.slackUserToken,
|
||||||
channel: channel.id,
|
channel: channel.id,
|
||||||
limit: 1000,
|
limit: 1000,
|
||||||
ts: ts
|
ts
|
||||||
})
|
})
|
||||||
await await redis.set(`CHATGPT:SLACK_CONVERSATION:${qq}`, `${ts}`)
|
await await redis.set(`CHATGPT:SLACK_CONVERSATION:${qq}`, `${ts}`)
|
||||||
if (replies.messages.length > 0) {
|
if (replies.messages.length > 0) {
|
||||||
let formalMessages = replies.messages.filter(m => m.text.indexOf('anthropic.com') === -1)
|
let formalMessages = replies.messages
|
||||||
|
.filter(m => m.metadata?.event_type !== 'claude_moderation')
|
||||||
|
.filter(m => !m.text.startsWith('_'))
|
||||||
if (!formalMessages[formalMessages.length - 1].bot_profile) {
|
if (!formalMessages[formalMessages.length - 1].bot_profile) {
|
||||||
// 问题的下一句不是bot回复的,这属于意料之外的问题,可能是多人同时问问题导致 再问一次吧
|
// 问题的下一句不是bot回复的,这属于意料之外的问题,可能是多人同时问问题导致 再问一次吧
|
||||||
return await this.sendMessage(prompt, e, t + 1)
|
return await this.sendMessage(prompt, e, t + 1)
|
||||||
|
|
@ -127,7 +129,9 @@ export class SlackClaudeClient {
|
||||||
ts: conversationId
|
ts: conversationId
|
||||||
})
|
})
|
||||||
if (replies.messages.length > 0) {
|
if (replies.messages.length > 0) {
|
||||||
let formalMessages = replies.messages.filter(m => m.text.indexOf('anthropic.com') === -1)
|
let formalMessages = replies.messages
|
||||||
|
.filter(m => m.metadata?.event_type !== 'claude_moderation')
|
||||||
|
.filter(m => !m.text.startsWith('_'))
|
||||||
if (!formalMessages[formalMessages.length - 1].bot_profile) {
|
if (!formalMessages[formalMessages.length - 1].bot_profile) {
|
||||||
// 问题的下一句不是bot回复的,这属于意料之外的问题,可能是多人同时问问题导致 再问一次吧
|
// 问题的下一句不是bot回复的,这属于意料之外的问题,可能是多人同时问问题导致 再问一次吧
|
||||||
return await this.sendMessage(prompt, e, t + 1)
|
return await this.sendMessage(prompt, e, t + 1)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue