Skip to content

Commit

Permalink
Beta129 (#128)
Browse files Browse the repository at this point in the history
* beta1

* beta2

* beta3

* beta4

* beta5

* beta6

* beta7

* beta8

* beta9

* beta10

* beta11

* beta12

* beta13

* beta14

* beta15

* beta16

* beta16

* beta19

* beta20

* beta21

* beta22

* beta23

* beta24

* beta25

* beta27

* beta28

* beta29

* beta30

* beta31

* beta33

* beta34

* beta35

* beta36

* beta37

* beta38

* beta39

* beta40

* beta41

* beta42

* beta43

* beta44

* beta45

* beta45

* beta46

* beat48

* beta49

* beta50

* beta51

* beta52

* beta53

* beta54

* beta55

* beta57

* beta58

* beta59

* beta61

* beta62

* beta63

* beta63

* beta64

* beta65

* beta66

* beta67

* beta70

* beta71

* beta72

* beta72

* beta74

* beta75

* beta76

* beta77

* beta78

* beta79

* beta80

* beta81

* beta82

* beta83

* beta85

* beta86

* beta87

* beta88

* beta89

* beta90

* beta91

* beta92

* beta93

* beta94

* beta94

* beta96

* beta97

* beta98

* beta99

* beta100

* beta101

* beta102

* beta104

* beta105

* beta106

* beta107

* beta108

* beta109

* beta110

* beta111

* beta112

* beta113

* beta115

* beta116

* beta117

* beta118

* beta119

* beta120

* beta121

* beta122

* beta123

* beta124

* beta125

* beta126

* beta127

* beta128

* beta129
  • Loading branch information
Hoshinonyaruko authored May 24, 2024
1 parent 9cae967 commit dfc18f7
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 8 deletions.
2 changes: 1 addition & 1 deletion applogic/yuanqi.go
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ func (app *App) ChatHandlerYuanQi(w http.ResponseWriter, r *http.Request) {
}

apiURL := config.GetYuanqiApiPath(promptstr)
token := config.GetYuanqiToken()
token := config.GetYuanqiToken(promptstr)
fmtf.Printf("YuanQi上下文history:%v\n", history)

// 构建请求到yuanqi API的请求体
Expand Down
12 changes: 6 additions & 6 deletions config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ func loadConfigFromFile(path string) (*Config, error) {

conf := &Config{}
if err := yaml.Unmarshal(configData, conf); err != nil {
log.Println("Failed to unmarshal YAML:", err)
log.Printf("failed to unmarshal YAML[%v]:%v", path, err)
return nil, err
}

Expand Down Expand Up @@ -2897,7 +2897,7 @@ func getYuanqiAssistantIDInternal(options ...string) string {
}

basename := options[0]
assistantIDInterface, err := prompt.GetSettingFromFilename(basename, "yuanqiAssistantID")
assistantIDInterface, err := prompt.GetSettingFromFilename(basename, "YuanqiAssistantID")
if err != nil {
log.Println("Error retrieving YuanqiAssistantID:", err)
return getYuanqiAssistantIDInternal() // 递归调用内部函数,不传递任何参数
Expand Down Expand Up @@ -2932,7 +2932,7 @@ func getYuanqiTokenInternal(options ...string) string {
}

basename := options[0]
YuanqiTokenInterface, err := prompt.GetSettingFromFilename(basename, "yuanqiToken")
YuanqiTokenInterface, err := prompt.GetSettingFromFilename(basename, "YuanqiToken")
if err != nil {
log.Println("Error retrieving YuanqiToken:", err)
return getYuanqiTokenInternal() // 递归调用内部函数,不传递任何参数
Expand Down Expand Up @@ -2967,7 +2967,7 @@ func getYuanqiVersionInternal(options ...string) float64 {
}

basename := options[0]
versionInterface, err := prompt.GetSettingFromFilename(basename, "yuanqiVersion")
versionInterface, err := prompt.GetSettingFromFilename(basename, "YuanqiVersion")
if err != nil {
log.Println("Error retrieving YuanqiVersion:", err)
return getYuanqiVersionInternal() // 递归调用内部函数,不传递任何参数
Expand Down Expand Up @@ -3002,7 +3002,7 @@ func getYuanqiChatTypeInternal(options ...string) string {
}

basename := options[0]
chatTypeInterface, err := prompt.GetSettingFromFilename(basename, "yuanqiChatType")
chatTypeInterface, err := prompt.GetSettingFromFilename(basename, "YuanqiChatType")
if err != nil {
log.Println("Error retrieving YuanqiChatType:", err)
return getYuanqiChatTypeInternal() // 递归调用内部函数,不传递任何参数
Expand Down Expand Up @@ -3037,7 +3037,7 @@ func getYuanqiApiPathInternal(options ...string) string {
}

basename := options[0]
chatTypeInterface, err := prompt.GetSettingFromFilename(basename, "yuanqiApiPath")
chatTypeInterface, err := prompt.GetSettingFromFilename(basename, "YuanqiApiPath")
if err != nil {
log.Println("Error retrieving YuanqiApiPath:", err)
return getYuanqiApiPathInternal() // 递归调用内部函数,不传递任何参数
Expand Down
2 changes: 1 addition & 1 deletion prompt/prompt.go
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ func loadFile(filename string) {
var prompts PromptFile
err = yaml.Unmarshal(data, &prompts)
if err != nil {
log.Println("Failed to unmarshal YAML:", err)
log.Printf("failed to unmarshal YAML[%v]:%v", filename, err)
return
}

Expand Down
5 changes: 5 additions & 0 deletions utils/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -1119,6 +1119,11 @@ func SendSSEPrivateRestoreMessage(userID int64, RestoreResponse string) {

// LanguageIntercept 检查文本语言,如果不在允许列表中,则返回 true 并发送消息
func LanguageIntercept(text string, message structs.OnebotGroupMessage, selfid string) bool {
hintWords := config.GetGroupHintWords()
// 遍历所有触发词,将其从文本中剔除
for _, word := range hintWords {
text = strings.Replace(text, word, "", -1)
}
info := whatlanggo.Detect(text)
lang := whatlanggo.LangToString(info.Lang)
fmtf.Printf("LanguageIntercept:%v\n", lang)
Expand Down

0 comments on commit dfc18f7

Please sign in to comment.