Skip to content

Commit

Permalink
Merge f1af1d7 into 3ffd466
Browse files Browse the repository at this point in the history
  • Loading branch information
Hoshinonyaruko authored May 8, 2024
2 parents 3ffd466 + f1af1d7 commit 4029a30
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 6 deletions.
13 changes: 7 additions & 6 deletions applogic/gensokyo.go
Original file line number Diff line number Diff line change
Expand Up @@ -600,19 +600,20 @@ func (app *App) GensokyoHandler(w http.ResponseWriter, r *http.Request) {
utils.SendPrivateMessageSSE(message.UserID, messageSSE)
}
} else {
// 这里发送的是newPart api最后补充的部分
if !config.GetMdPromptKeyboardAtGroup() {
// 如果没有 EnhancedAContent
if EnhancedAContent == "" {
utils.SendGroupMessage(message.GroupID, message.UserID, newPart, selfid)
} else {
utils.SendGroupMessage(message.GroupID, message.UserID, EnhancedAContent+response, selfid)
utils.SendGroupMessage(message.GroupID, message.UserID, newPart+EnhancedAContent, selfid)
}
} else {
// 如果没有 EnhancedAContent
if EnhancedAContent == "" {
utils.SendGroupMessageMdPromptKeyboard(message.GroupID, message.UserID, response, selfid, newmsg, response, promptstr)
utils.SendGroupMessageMdPromptKeyboard(message.GroupID, message.UserID, newPart, selfid, newmsg, response, promptstr)
} else {
utils.SendGroupMessageMdPromptKeyboard(message.GroupID, message.UserID, EnhancedAContent+response, selfid, newmsg, response, promptstr)
utils.SendGroupMessageMdPromptKeyboard(message.GroupID, message.UserID, newPart+EnhancedAContent, selfid, newmsg, response, promptstr)
}
}
}
Expand All @@ -632,7 +633,7 @@ func (app *App) GensokyoHandler(w http.ResponseWriter, r *http.Request) {
if EnhancedAContent == "" {
utils.SendPrivateMessage(message.UserID, response, selfid)
} else {
utils.SendPrivateMessage(message.UserID, EnhancedAContent+response, selfid)
utils.SendPrivateMessage(message.UserID, response+EnhancedAContent, selfid)
}
} else {
//判断是否最后一条
Expand All @@ -654,14 +655,14 @@ func (app *App) GensokyoHandler(w http.ResponseWriter, r *http.Request) {
if EnhancedAContent == "" {
utils.SendGroupMessage(message.GroupID, message.UserID, response, selfid)
} else {
utils.SendGroupMessage(message.GroupID, message.UserID, EnhancedAContent+response, selfid)
utils.SendGroupMessage(message.GroupID, message.UserID, response+EnhancedAContent, selfid)
}
} else {
// 如果没有 EnhancedAContent
if EnhancedAContent == "" {
utils.SendGroupMessageMdPromptKeyboard(message.GroupID, message.UserID, response, selfid, newmsg, response, promptstr)
} else {
utils.SendGroupMessageMdPromptKeyboard(message.GroupID, message.UserID, EnhancedAContent+response, selfid, newmsg, response, promptstr)
utils.SendGroupMessageMdPromptKeyboard(message.GroupID, message.UserID, response+EnhancedAContent, selfid, newmsg, response, promptstr)
}
}

Expand Down
8 changes: 8 additions & 0 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -248,6 +248,14 @@ exitOnQ需要enhancedPromptChoices=true,其实enhancedPromptChoices最好就是t

promptMarks和switchOnQ、switchOnA在功能上是相同的,都是根据关键字跳转分支,promptMarks先执行,不分轮次不分QA,switchOnQ和switchOnA更具体,区分Q和A,区分轮次,实现细节跳转。

## 已知问题

如果有固定且不需要切换的分支,请设置该yml的promptMarksLength为99999

promptMarksLength : 99999

以避免错误的切换到不存在的分支,导致会话报错.

## 为什么采用文本控制流而不是ai-agent?

配置控制流简单直观,通过配置文件来管理对话逻辑,配置文件易于维护,非技术人员,如剧情编写者,可以直接学习配置文件规则,修改配置文件来更新对话逻辑,不需要编程知识。
Expand Down

0 comments on commit 4029a30

Please sign in to comment.