Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Beta138 #137

Merged
merged 137 commits into from
Jun 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
137 commits
Select commit Hold shift + click to select a range
ea4bcc6
beta1
Hoshinonyaruko Jan 21, 2024
5002a28
beta2
Hoshinonyaruko Jan 21, 2024
969841e
beta3
Hoshinonyaruko Jan 21, 2024
a2989c2
beta4
Hoshinonyaruko Jan 21, 2024
611cd8b
beta5
Hoshinonyaruko Jan 21, 2024
dbad42b
beta6
Hoshinonyaruko Jan 21, 2024
4f8895e
beta7
Hoshinonyaruko Jan 21, 2024
30a9cab
beta8
Hoshinonyaruko Jan 21, 2024
461d879
beta9
Hoshinonyaruko Jan 21, 2024
c90c2ee
beta10
Hoshinonyaruko Jan 21, 2024
5227c32
beta11
Hoshinonyaruko Jan 21, 2024
8e14e56
beta12
Hoshinonyaruko Jan 21, 2024
6adfb7f
beta13
Hoshinonyaruko Jan 21, 2024
b04f6c0
beta14
Hoshinonyaruko Jan 21, 2024
649e740
beta15
Hoshinonyaruko Jan 21, 2024
d55cf29
beta16
Hoshinonyaruko Jan 21, 2024
1cc351e
beta16
Hoshinonyaruko Jan 21, 2024
f1a373e
beta19
Hoshinonyaruko Jan 21, 2024
cbf2fe1
beta20
Hoshinonyaruko Jan 21, 2024
3485bfc
beta21
Hoshinonyaruko Jan 21, 2024
3e3bb1a
beta22
Hoshinonyaruko Jan 21, 2024
2e4f3fa
beta23
Hoshinonyaruko Mar 29, 2024
f74075d
beta24
Hoshinonyaruko Mar 29, 2024
f3913cf
beta25
Hoshinonyaruko Mar 29, 2024
4cfb51a
beta27
Hoshinonyaruko Mar 30, 2024
d9b26c0
beta28
Hoshinonyaruko Mar 31, 2024
19da709
beta29
Hoshinonyaruko Mar 31, 2024
e06dcbf
merge
Hoshinonyaruko Mar 31, 2024
c76923e
beta30
Hoshinonyaruko Mar 31, 2024
9ae21da
beta31
Hoshinonyaruko Apr 1, 2024
4f333bc
merge
Hoshinonyaruko Apr 1, 2024
5acba8f
beta33
Hoshinonyaruko Apr 1, 2024
c637fcd
beta34
Hoshinonyaruko Apr 1, 2024
4e85b37
beta35
Hoshinonyaruko Apr 1, 2024
970948e
beta36
Hoshinonyaruko Apr 1, 2024
14271c3
beta37
Hoshinonyaruko Apr 1, 2024
6154d1a
beta38
Hoshinonyaruko Apr 1, 2024
d5be5e6
beta39
Hoshinonyaruko Apr 3, 2024
54afe18
beta40
Hoshinonyaruko Apr 3, 2024
0b71855
beta41
Hoshinonyaruko Apr 3, 2024
8c5f9a3
merge
Hoshinonyaruko Apr 3, 2024
cf752d4
beta42
Hoshinonyaruko Apr 3, 2024
3698824
beta43
Hoshinonyaruko Apr 3, 2024
1e9c189
beta44
Hoshinonyaruko Apr 3, 2024
2adb4ac
beta45
Hoshinonyaruko Apr 4, 2024
79eb713
beta45
Hoshinonyaruko Apr 4, 2024
064f0d0
beta45
Hoshinonyaruko Apr 4, 2024
5a4a59e
beta46
Hoshinonyaruko Apr 5, 2024
df30a32
beta46
Hoshinonyaruko Apr 5, 2024
c920893
beat48
Hoshinonyaruko Apr 7, 2024
3491d5d
beta49
Hoshinonyaruko Apr 8, 2024
575b2ca
beta50
Hoshinonyaruko Apr 8, 2024
4c4bbaa
beta51
Hoshinonyaruko Apr 8, 2024
2ea728b
beta52
Hoshinonyaruko Apr 8, 2024
82bf952
beta53
Hoshinonyaruko Apr 8, 2024
869685c
beta54
Hoshinonyaruko Apr 9, 2024
1f3646e
beta55
Hoshinonyaruko Apr 9, 2024
d6bbadf
beta57
Hoshinonyaruko Apr 10, 2024
fc5086c
beta58
Hoshinonyaruko Apr 10, 2024
602ff65
beta59
Hoshinonyaruko Apr 10, 2024
a82538d
Merge branch 'main' of https://github.com/Hoshinonyaruko/Gensokyo-llm…
Hoshinonyaruko Apr 10, 2024
6433600
beta61
Hoshinonyaruko Apr 10, 2024
9ce88b3
beta62
Hoshinonyaruko Apr 12, 2024
b53617b
beta63
Hoshinonyaruko Apr 12, 2024
ff64c69
beta63
Hoshinonyaruko Apr 12, 2024
b34885f
beta64
Hoshinonyaruko Apr 13, 2024
3658648
beta65
Hoshinonyaruko Apr 13, 2024
3307439
beta66
Hoshinonyaruko Apr 15, 2024
f15c422
beta67
Hoshinonyaruko Apr 17, 2024
518de35
beta70
Hoshinonyaruko Apr 18, 2024
a65f07d
beta71
Hoshinonyaruko Apr 18, 2024
59d07c7
beta72
Hoshinonyaruko Apr 18, 2024
a16ea64
beta72
Hoshinonyaruko Apr 18, 2024
08d5864
beta74
Hoshinonyaruko Apr 19, 2024
9b09401
beta75
Hoshinonyaruko Apr 19, 2024
b51e185
beta76
Hoshinonyaruko Apr 20, 2024
c978654
beta77
Hoshinonyaruko Apr 21, 2024
6aa9f33
beta78
Hoshinonyaruko Apr 22, 2024
7b84a9d
beta79
Hoshinonyaruko Apr 25, 2024
4b96807
beta80
Hoshinonyaruko Apr 25, 2024
9b97146
beta81
Hoshinonyaruko Apr 25, 2024
f481e85
beta82
Hoshinonyaruko Apr 29, 2024
cb33ba5
beta83
Hoshinonyaruko Apr 29, 2024
7dbe4d5
beta85
Hoshinonyaruko Apr 29, 2024
2fb67a2
beta86
Hoshinonyaruko Apr 29, 2024
20f26c1
beta87
Hoshinonyaruko Apr 29, 2024
3146232
beta88
Hoshinonyaruko Apr 29, 2024
cbf731b
beta89
Hoshinonyaruko Apr 29, 2024
cc8a439
beta90
Hoshinonyaruko Apr 29, 2024
f56c272
beta91
Hoshinonyaruko Apr 29, 2024
c19f071
beta92
Hoshinonyaruko Apr 29, 2024
84d0513
beta93
Hoshinonyaruko Apr 29, 2024
c2f8e28
beta94
Hoshinonyaruko Apr 29, 2024
142f2fa
beta94
Hoshinonyaruko Apr 29, 2024
8828006
beta96
Hoshinonyaruko Apr 29, 2024
541a127
beta97
Hoshinonyaruko Apr 30, 2024
9d52ce8
beta98
Hoshinonyaruko Apr 30, 2024
16e0ed4
beta99
Hoshinonyaruko Apr 30, 2024
8f0e406
beta100
Hoshinonyaruko May 1, 2024
d242bc2
beta101
Hoshinonyaruko May 1, 2024
2ea5f4a
beta102
Hoshinonyaruko May 2, 2024
c208482
beta104
Hoshinonyaruko May 3, 2024
777aaa0
beta105
Hoshinonyaruko May 4, 2024
3ccedea
beta106
Hoshinonyaruko May 4, 2024
956c9a2
beta107
Hoshinonyaruko May 8, 2024
1a04702
beta108
Hoshinonyaruko May 8, 2024
d88d84b
beta109
Hoshinonyaruko May 8, 2024
e9a3788
beta110
Hoshinonyaruko May 9, 2024
a6dccf7
beta111
Hoshinonyaruko May 13, 2024
48a1d26
beta112
Hoshinonyaruko May 13, 2024
5cbd1a6
beta113
Hoshinonyaruko May 13, 2024
a8f8dbd
Merge branch 'main' of https://github.com/Hoshinonyaruko/Gensokyo-llm…
Hoshinonyaruko May 13, 2024
0ce3929
beta115
Hoshinonyaruko May 13, 2024
3c24828
beta116
Hoshinonyaruko May 14, 2024
d17b87e
beta117
Hoshinonyaruko May 14, 2024
a0d9d93
beta118
Hoshinonyaruko May 16, 2024
81c5f60
beta119
Hoshinonyaruko May 17, 2024
0bf4eae
beta120
Hoshinonyaruko May 19, 2024
dfff20e
beta121
Hoshinonyaruko May 19, 2024
6659607
beta122
Hoshinonyaruko May 19, 2024
89c92a0
beta123
Hoshinonyaruko May 19, 2024
a35581e
beta124
Hoshinonyaruko May 19, 2024
434c738
beta125
Hoshinonyaruko May 19, 2024
18e97cc
beta126
Hoshinonyaruko May 20, 2024
49cfe96
beta127
Hoshinonyaruko May 20, 2024
6c98d9f
beta128
Hoshinonyaruko May 23, 2024
3301dc2
beta129
Hoshinonyaruko May 24, 2024
32b6189
beta130
Hoshinonyaruko May 24, 2024
b6a0b9f
beta131
Hoshinonyaruko May 27, 2024
5eca7eb
beta132
Hoshinonyaruko May 27, 2024
1b7aefe
beta1333
Hoshinonyaruko May 28, 2024
c12eb7c
beta134
Hoshinonyaruko Jun 1, 2024
87fe0b9
beta135
Hoshinonyaruko Jun 3, 2024
937eb77
beta136
Hoshinonyaruko Jun 3, 2024
bc71abc
beta137
Hoshinonyaruko Jun 6, 2024
3100125
beta138
Hoshinonyaruko Jun 6, 2024
85bbdff
Merge branch 'main' into beta138
Hoshinonyaruko Jun 6, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion applogic/env.go
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ func (app *App) GetAndSendEnv(msg string, promptstr string, message structs.Oneb
if message.RealMessageType == "group_private" || message.MessageType == "private" {
utils.SendPrivateMessageRaw(message.UserID, newResponse, selfid)
} else {
utils.SendGroupMessage(message.GroupID, message.UserID, newResponse, selfid)
utils.SendGroupMessage(message.GroupID, message.UserID, newResponse, selfid, promptstr)
}
}

Expand Down
16 changes: 8 additions & 8 deletions applogic/flow.go
Original file line number Diff line number Diff line change
Expand Up @@ -404,7 +404,7 @@ func (app *App) ProcessExitChoicesQ(promptstr string, requestmsg *string, messag
}
}
if bestMatchCount > 0 {
app.HandleExit(bestText, message, selfid)
app.HandleExit(bestText, message, selfid, promptstr)
return
}
}
Expand All @@ -422,7 +422,7 @@ func (app *App) ProcessExitChoicesQ(promptstr string, requestmsg *string, messag
texts := strings.Split(addedTexts, "-")
if len(texts) > 0 {
selectedText := texts[rand.Intn(len(texts))]
app.HandleExit(selectedText, message, selfid)
app.HandleExit(selectedText, message, selfid, promptstr)
return
}
}
Expand All @@ -431,7 +431,7 @@ func (app *App) ProcessExitChoicesQ(promptstr string, requestmsg *string, messag
}

// HandleExit 处理用户退出逻辑,包括发送消息和重置用户状态。
func (app *App) HandleExit(exitText string, message *structs.OnebotGroupMessage, selfid string) {
func (app *App) HandleExit(exitText string, message *structs.OnebotGroupMessage, selfid string, promptstr string) {
userid := message.UserID
if config.GetGroupContext() && message.MessageType != "private" {
userid = message.GroupID
Expand All @@ -442,12 +442,12 @@ func (app *App) HandleExit(exitText string, message *structs.OnebotGroupMessage,
RestoreResponse := config.GetRandomRestoreResponses()
if message.RealMessageType == "group_private" || message.MessageType == "private" {
if !config.GetUsePrivateSSE() {
utils.SendPrivateMessage(message.UserID, RestoreResponse, selfid)
utils.SendPrivateMessage(message.UserID, RestoreResponse, selfid, promptstr)
} else {
utils.SendSSEPrivateRestoreMessage(message.UserID, RestoreResponse)
utils.SendSSEPrivateRestoreMessage(message.UserID, RestoreResponse, promptstr)
}
} else {
utils.SendGroupMessage(message.GroupID, message.UserID, RestoreResponse, selfid)
utils.SendGroupMessage(message.GroupID, message.UserID, RestoreResponse, selfid, promptstr)
}
app.deleteCustomRecord(userid)
}
Expand Down Expand Up @@ -508,7 +508,7 @@ func (app *App) ProcessExitChoicesA(promptstr string, response *string, message
}
}
if bestMatchCount > 0 {
app.HandleExit(bestText, message, selfid)
app.HandleExit(bestText, message, selfid, promptstr)
return
}
}
Expand All @@ -526,7 +526,7 @@ func (app *App) ProcessExitChoicesA(promptstr string, response *string, message
texts := strings.Split(addedTexts, "-")
if len(texts) > 0 {
selectedText := texts[rand.Intn(len(texts))]
app.HandleExit(selectedText, message, selfid)
app.HandleExit(selectedText, message, selfid, promptstr)
return
}
}
Expand Down
72 changes: 38 additions & 34 deletions applogic/gensokyo.go
Original file line number Diff line number Diff line change
Expand Up @@ -339,7 +339,7 @@ func (app *App) GensokyoHandler(w http.ResponseWriter, r *http.Request) {
}
}

if utils.BlacklistIntercept(message, selfid) {
if utils.BlacklistIntercept(message, selfid, promptstr) {
fmtf.Printf("userid:[%v]groupid:[%v]这位用户或群在黑名单中,被拦截", message.UserID, message.GroupID)
return
}
Expand All @@ -355,12 +355,12 @@ func (app *App) GensokyoHandler(w http.ResponseWriter, r *http.Request) {
RestoreResponse := config.GetRandomRestoreResponses()
if message.RealMessageType == "group_private" || message.MessageType == "private" {
if !config.GetUsePrivateSSE() {
utils.SendPrivateMessage(message.UserID, RestoreResponse, selfid)
utils.SendPrivateMessage(message.UserID, RestoreResponse, selfid, promptstr)
} else {
utils.SendSSEPrivateRestoreMessage(message.UserID, RestoreResponse)
utils.SendSSEPrivateRestoreMessage(message.UserID, RestoreResponse, promptstr)
}
} else {
utils.SendGroupMessage(message.GroupID, message.UserID, RestoreResponse, selfid)
utils.SendGroupMessage(message.GroupID, message.UserID, RestoreResponse, selfid, promptstr)
}
// 处理故事情节的重置
if config.GetGroupContext() && message.MessageType != "private" {
Expand Down Expand Up @@ -402,7 +402,7 @@ func (app *App) GensokyoHandler(w http.ResponseWriter, r *http.Request) {

// 进行字数拦截
if config.GetQuestionMaxLenth() != 0 {
if utils.LengthIntercept(newmsg, message, selfid) {
if utils.LengthIntercept(newmsg, message, selfid, promptstr) {
fmtf.Printf("字数过长,可在questionMaxLenth配置项修改,Q: %v", newmsg)
// 发送响应
w.WriteHeader(http.StatusOK)
Expand All @@ -413,7 +413,7 @@ func (app *App) GensokyoHandler(w http.ResponseWriter, r *http.Request) {

// 进行语言判断拦截 skipLangCheck为false时
if len(config.GetAllowedLanguages()) > 0 && !skipLangCheck {
if utils.LanguageIntercept(newmsg, message, selfid) {
if utils.LanguageIntercept(newmsg, message, selfid, promptstr) {
fmtf.Printf("不安全!不支持的语言,可在config.yml设置允许的语言,allowedLanguages配置项,Q: %v", newmsg)
// 发送响应
w.WriteHeader(http.StatusOK)
Expand All @@ -440,7 +440,7 @@ func (app *App) GensokyoHandler(w http.ResponseWriter, r *http.Request) {

// 向量安全词部分,机器人向量安全屏障
if config.GetVectorSensitiveFilter() {
ret, retstr, err := app.InterceptSensitiveContent(vector, message, selfid)
ret, retstr, err := app.InterceptSensitiveContent(vector, message, selfid, promptstr)
if err != nil {
fmtf.Printf("Error in InterceptSensitiveContent: %v", err)
// 发送响应
Expand Down Expand Up @@ -490,12 +490,12 @@ func (app *App) GensokyoHandler(w http.ResponseWriter, r *http.Request) {
// 发送响应消息
if message.RealMessageType == "group_private" || message.MessageType == "private" {
if !config.GetUsePrivateSSE() {
utils.SendPrivateMessage(message.UserID, responseText, selfid)
utils.SendPrivateMessage(message.UserID, responseText, selfid, promptstr)
} else {
utils.SendSSEPrivateMessage(message.UserID, responseText)
utils.SendSSEPrivateMessage(message.UserID, responseText, promptstr)
}
} else {
utils.SendGroupMessage(message.GroupID, message.UserID, responseText, selfid)
utils.SendGroupMessage(message.GroupID, message.UserID, responseText, selfid, promptstr)
}
// 发送响应
w.WriteHeader(http.StatusOK)
Expand Down Expand Up @@ -535,12 +535,12 @@ func (app *App) GensokyoHandler(w http.ResponseWriter, r *http.Request) {
if saveresponse != "" {
if message.RealMessageType == "group_private" || message.MessageType == "private" {
if !config.GetUsePrivateSSE() {
utils.SendPrivateMessage(message.UserID, saveresponse, selfid)
utils.SendPrivateMessage(message.UserID, saveresponse, selfid, promptstr)
} else {
utils.SendSSEPrivateSafeMessage(message.UserID, saveresponse)
utils.SendSSEPrivateSafeMessage(message.UserID, saveresponse, promptstr)
}
} else {
utils.SendGroupMessage(message.GroupID, message.UserID, saveresponse, selfid)
utils.SendGroupMessage(message.GroupID, message.UserID, saveresponse, selfid, promptstr)
}
}
// 发送响应
Expand Down Expand Up @@ -575,7 +575,7 @@ func (app *App) GensokyoHandler(w http.ResponseWriter, r *http.Request) {

// 处理保存记忆
if ismemoryCommand {
app.handleSaveMemory(message, conversationID, parentMessageID) // 适配群
app.handleSaveMemory(message, conversationID, parentMessageID, promptstr) // 适配群
return
}

Expand All @@ -597,13 +597,13 @@ func (app *App) GensokyoHandler(w http.ResponseWriter, r *http.Request) {

// 处理记忆列表
if ismemoryLoadCommand {
app.handleMemoryList(message) // 适配群
app.handleMemoryList(message, promptstr) // 适配群
return
}

// 新增处理载入记忆的逻辑
if isPrefixedMemoryLoadCommand {
app.handleLoadMemory(message, checkResetCommand) // 适配群
app.handleLoadMemory(message, checkResetCommand, promptstr) // 适配群
return
}

Expand All @@ -621,7 +621,7 @@ func (app *App) GensokyoHandler(w http.ResponseWriter, r *http.Request) {

// 处理新对话
if isnewConversationCommand {
app.handleNewConversation(message, conversationID, parentMessageID) // 适配群
app.handleNewConversation(message, conversationID, parentMessageID, promptstr) // 适配群
return
}

Expand Down Expand Up @@ -686,6 +686,10 @@ func (app *App) GensokyoHandler(w http.ResponseWriter, r *http.Request) {
PromptMarksLength := config.GetPromptMarksLength(promptstr)
app.GetAndSendEnv(requestmsg, promptstr, message, selfid, CustomRecord.PromptStrStat, PromptMarksLength)
}

// 按提示词区分的细化替换 这里主要不是为了安全和敏感词,而是细化效果,也就没有使用acnode提高效率
requestmsg = utils.ReplaceTextIn(requestmsg, promptstr)

if config.GetGroupContext() && message.MessageType != "private" {
fmtf.Printf("实际请求conversation端点内容:[%v]%v\n", message.GroupID, requestmsg)
} else {
Expand Down Expand Up @@ -817,7 +821,7 @@ func (app *App) GensokyoHandler(w http.ResponseWriter, r *http.Request) {
// 判断消息类型,如果是私人消息或私有群消息,发送私人消息;否则,根据配置决定是否发送群消息
if userinfo.RealMessageType == "group_private" || userinfo.MessageType == "private" {
if !config.GetUsePrivateSSE() {
utils.SendPrivateMessage(userinfo.UserID, newPart, selfid)
utils.SendPrivateMessage(userinfo.UserID, newPart, selfid, promptstr)
} else {
//判断是否最后一条
var state int
Expand All @@ -830,16 +834,16 @@ func (app *App) GensokyoHandler(w http.ResponseWriter, r *http.Request) {
Content: newPart,
State: state,
}
utils.SendPrivateMessageSSE(userinfo.UserID, messageSSE)
utils.SendPrivateMessageSSE(userinfo.UserID, messageSSE, promptstr)
}
} else {
// 这里发送的是newPart api最后补充的部分
if !config.GetMdPromptKeyboardAtGroup() {
// 如果没有 EnhancedAContent
if EnhancedAContent == "" {
utils.SendGroupMessage(userinfo.GroupID, userinfo.UserID, newPart, selfid)
utils.SendGroupMessage(userinfo.GroupID, userinfo.UserID, newPart, selfid, promptstr)
} else {
utils.SendGroupMessage(userinfo.GroupID, userinfo.UserID, newPart+EnhancedAContent, selfid)
utils.SendGroupMessage(userinfo.GroupID, userinfo.UserID, newPart+EnhancedAContent, selfid, promptstr)
}
} else {
// 如果没有 EnhancedAContent
Expand All @@ -864,9 +868,9 @@ func (app *App) GensokyoHandler(w http.ResponseWriter, r *http.Request) {
if !config.GetUsePrivateSSE() {
// 如果没有 EnhancedAContent
if EnhancedAContent == "" {
utils.SendPrivateMessage(userinfo.UserID, response, selfid)
utils.SendPrivateMessage(userinfo.UserID, response, selfid, promptstr)
} else {
utils.SendPrivateMessage(userinfo.UserID, response+EnhancedAContent, selfid)
utils.SendPrivateMessage(userinfo.UserID, response+EnhancedAContent, selfid, promptstr)
}
} else {
//判断是否最后一条
Expand All @@ -880,15 +884,15 @@ func (app *App) GensokyoHandler(w http.ResponseWriter, r *http.Request) {
Content: response,
State: state,
}
utils.SendPrivateMessageSSE(userinfo.UserID, messageSSE)
utils.SendPrivateMessageSSE(userinfo.UserID, messageSSE, promptstr)
}
} else {
if !config.GetMdPromptKeyboardAtGroup() {
// 如果没有 EnhancedAContent
if EnhancedAContent == "" {
utils.SendGroupMessage(userinfo.GroupID, userinfo.UserID, response, selfid)
utils.SendGroupMessage(userinfo.GroupID, userinfo.UserID, response, selfid, promptstr)
} else {
utils.SendGroupMessage(userinfo.GroupID, userinfo.UserID, response+EnhancedAContent, selfid)
utils.SendGroupMessage(userinfo.GroupID, userinfo.UserID, response+EnhancedAContent, selfid, promptstr)
}
} else {
// 如果没有 EnhancedAContent
Expand Down Expand Up @@ -936,7 +940,7 @@ func (app *App) GensokyoHandler(w http.ResponseWriter, r *http.Request) {
Content: EnhancedAContent,
State: 11,
}
utils.SendPrivateMessageSSE(message.UserID, messageSSE)
utils.SendPrivateMessageSSE(message.UserID, messageSSE, promptstr)
}
}
}
Expand Down Expand Up @@ -1015,7 +1019,7 @@ func (app *App) GensokyoHandler(w http.ResponseWriter, r *http.Request) {
State: 20,
PromptKeyboard: promptkeyboard,
}
utils.SendPrivateMessageSSE(message.UserID, messageSSE)
utils.SendPrivateMessageSSE(message.UserID, messageSSE, promptstr)
ResetIndex(newmsg)
}
}
Expand All @@ -1041,9 +1045,9 @@ func (app *App) GensokyoHandler(w http.ResponseWriter, r *http.Request) {
if response, ok = responseData["response"].(string); ok && response != "" {
// 判断消息类型,如果是私人消息或私有群消息,发送私人消息;否则,根据配置决定是否发送群消息
if message.RealMessageType == "group_private" || message.MessageType == "private" {
utils.SendPrivateMessage(message.UserID, response, selfid)
utils.SendPrivateMessage(message.UserID, response, selfid, promptstr)
} else {
utils.SendGroupMessage(message.GroupID, message.UserID, response, selfid)
utils.SendGroupMessage(message.GroupID, message.UserID, response, selfid, promptstr)
}
}

Expand Down Expand Up @@ -1157,7 +1161,7 @@ func processMessage(response string, conversationid string, newmesssage string,
// 判断消息类型,如果是私人消息或私有群消息,发送私人消息;否则,根据配置决定是否发送群消息
if userinfo.RealMessageType == "group_private" || userinfo.MessageType == "private" {
if !config.GetUsePrivateSSE() {
utils.SendPrivateMessage(userinfo.UserID, accumulatedMessage, selfid)
utils.SendPrivateMessage(userinfo.UserID, accumulatedMessage, selfid, promptstr)
} else {
if IncrementIndex(newmesssage) == 1 {
//第一条信息
Expand All @@ -1170,18 +1174,18 @@ func processMessage(response string, conversationid string, newmesssage string,
ActionButton: 10,
CallbackData: uerid,
}
utils.SendPrivateMessageSSE(userinfo.UserID, messageSSE)
utils.SendPrivateMessageSSE(userinfo.UserID, messageSSE, promptstr)
} else {
//SSE的前半部分
messageSSE := structs.InterfaceBody{
Content: accumulatedMessage,
State: 1,
}
utils.SendPrivateMessageSSE(userinfo.UserID, messageSSE)
utils.SendPrivateMessageSSE(userinfo.UserID, messageSSE, promptstr)
}
}
} else {
utils.SendGroupMessage(userinfo.GroupID, userinfo.UserID, accumulatedMessage, selfid)
utils.SendGroupMessage(userinfo.GroupID, userinfo.UserID, accumulatedMessage, selfid, promptstr)
}

ClearMessage(conversationid)
Expand Down
Loading
Loading