Skip to content

Commit

Permalink
-- FIX
Browse files Browse the repository at this point in the history
 - UPDATE Baidu LLM engine from ERNIE to QIANFAN
  • Loading branch information
NoahAmethyst committed Oct 29, 2024
1 parent b2342ff commit 69b4f12
Show file tree
Hide file tree
Showing 8 changed files with 200 additions and 73 deletions.
22 changes: 12 additions & 10 deletions constant/preference.go
Original file line number Diff line number Diff line change
@@ -1,16 +1,18 @@
package constant

const (
REMOTE_PROXY = "REMOTE_PROXY"
OPENAI_API_KEY = "OPENAI_API_KEY"
CHIMERA_KEY = "CHIMERA_KEY"
ERNIE_APP_KEY = "ERNIE_APP_KEY"
ERNIE_APP_SECRET = "ERNIE_APP_SECRET"
NOT_MIRROR = "NOT_MIRROR"
FILE_ROOT = "FILE_ROOT"
OWNER = "OWNER"
BING_COOKIE = "BING_COOKIE"
OPENAI_PROXY = "OPENAI_PROXY"
REMOTE_PROXY = "REMOTE_PROXY"
OPENAI_API_KEY = "OPENAI_API_KEY"
CHIMERA_KEY = "CHIMERA_KEY"
ERNIE_APP_KEY = "ERNIE_APP_KEY"
ERNIE_APP_SECRET = "ERNIE_APP_SECRET"
QIANFAN_ACCESS_KEY = "QIANFAN_ACCESS_KEY"
QIANFAN_SECRET_KEY = "QIANFAN_SECRET_KEY"
NOT_MIRROR = "NOT_MIRROR"
FILE_ROOT = "FILE_ROOT"
OWNER = "OWNER"
BING_COOKIE = "BING_COOKIE"
OPENAI_PROXY = "OPENAI_PROXY"
)

const (
Expand Down
5 changes: 2 additions & 3 deletions coolq/chat_assistant.go
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,6 @@ func AskAssistant(assistant Assistant) {
assistant.Reply(fmt.Sprintf("no handler set,model:%d", assistant.Model()))
return
}

recvChan := make(chan struct{}, 1)
go func(assistant Assistant) {
select {
Expand All @@ -274,9 +273,7 @@ func AskAssistant(assistant Assistant) {
assistant.Reply(fmt.Sprintf("%s 正在响应,请稍后...", vendor))
}
}(assistant)

askHandler(assistant, recvChan)

}

func askBingCopilot(assistant Assistant, _ chan struct{}) {
Expand All @@ -292,10 +289,12 @@ func askBingCopilot(assistant Assistant, _ chan struct{}) {
content := strings.ReplaceAll(answer.CopilotResp.Content, "*", "")
strBuilder.WriteString(content)
if len(answer.CopilotResp.Suggestions) > 0 {

strBuilder.WriteString("\n\n你也可以这样提问:")
for i, _suggestion := range answer.CopilotResp.Suggestions {
strBuilder.WriteString(fmt.Sprintf("\n%d. %s", i, _suggestion))
}

}
assistant.Reply(strBuilder.String())

Expand Down
1 change: 1 addition & 0 deletions coolq/job.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ func (bot *CQBot) D36krHotReporter(corn string) *ReportJob {
func (bot *CQBot) WallStreetNewsReporter(corn string) *ReportJob {
return &ReportJob{
Report: func() {

groupIds := bot.state.reportState.getReportList(true)
bot.ReportWallStreetNews(groupIds, true)
privateIds := bot.state.reportState.getReportList(false)
Expand Down
59 changes: 38 additions & 21 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -10,29 +10,30 @@ require (
github.com/RomiChan/syncx v0.0.0-20220404072119-d7ea0ae15a4c
github.com/RomiChan/websocket v1.4.3-0.20220123145318-307a86b127bc
github.com/anhao/go-ernie v1.0.2
github.com/baidubce/bce-qianfan-sdk/go/qianfan v0.0.12
github.com/dengsgo/math-engine v0.0.0-20220911070221-a5a560a8684b
github.com/fumiama/go-base16384 v1.5.2
github.com/fumiama/go-hide-param v0.1.4
github.com/google/uuid v1.3.0
github.com/google/uuid v1.4.0
github.com/grpc-ecosystem/go-grpc-middleware v1.4.0
github.com/lestrrat-go/file-rotatelogs v2.4.0+incompatible
github.com/mattn/go-colorable v0.1.12
github.com/mattn/go-colorable v0.1.13
github.com/pkg/errors v0.9.1
github.com/robfig/cron v1.2.0
github.com/sashabaranov/go-openai v1.17.7
github.com/segmentio/asm v1.1.3
github.com/sirupsen/logrus v1.9.0
github.com/stretchr/testify v1.8.0
github.com/sirupsen/logrus v1.9.3
github.com/stretchr/testify v1.8.4
github.com/syndtr/goleveldb v1.0.1-0.20210819022825-2ae1ddf74ef7
github.com/tencentyun/cos-go-sdk-v5 v0.7.41
github.com/tidwall/gjson v1.14.3
github.com/wdvxdr1123/go-silk v0.0.0-20210316130616-d47b553def60
go.mongodb.org/mongo-driver v1.8.3
golang.org/x/crypto v0.0.0-20220722155217-630584e8d5aa
golang.org/x/term v0.5.0
golang.org/x/time v0.0.0-20220224211638-0e9765cccd65
google.golang.org/grpc v1.40.0
google.golang.org/protobuf v1.28.0
golang.org/x/crypto v0.16.0
golang.org/x/term v0.15.0
golang.org/x/time v0.5.0
google.golang.org/grpc v1.59.0
google.golang.org/protobuf v1.31.0
gopkg.in/yaml.v3 v3.0.1
)

Expand All @@ -53,29 +54,42 @@ require (
github.com/alibabacloud-go/tea-utils/v2 v2.0.1 // indirect
github.com/alibabacloud-go/tea-xml v1.1.2 // indirect
github.com/aliyun/credentials-go v1.1.2 // indirect
github.com/baidubce/bce-sdk-go v0.9.164 // indirect
github.com/bwmarrin/snowflake v0.3.0 // indirect
github.com/cenkalti/backoff/v4 v4.1.2 // indirect
github.com/clbanning/mxj v1.8.4 // indirect
github.com/clbanning/mxj/v2 v2.5.5 // indirect
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect
github.com/fsnotify/fsnotify v1.7.0 // indirect
github.com/fumiama/imgsz v0.0.2 // indirect
github.com/go-stack/stack v1.8.0 // indirect
github.com/golang/protobuf v1.5.2 // indirect
github.com/golang/protobuf v1.5.3 // indirect
github.com/golang/snappy v0.0.4 // indirect
github.com/google/go-querystring v1.1.0 // indirect
github.com/gorilla/websocket v1.5.0 // indirect
github.com/hashicorp/hcl v1.0.0 // indirect
github.com/jonboulle/clockwork v0.2.2 // indirect
github.com/json-iterator/go v1.1.12 // indirect
github.com/klauspost/compress v1.15.9 // indirect
github.com/klauspost/compress v1.17.0 // indirect
github.com/lestrrat-go/strftime v1.0.6 // indirect
github.com/mattn/go-isatty v0.0.14 // indirect
github.com/mitchellh/mapstructure v1.4.3 // indirect
github.com/magiconair/properties v1.8.7 // indirect
github.com/mattn/go-isatty v0.0.17 // indirect
github.com/mitchellh/mapstructure v1.5.0 // indirect
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
github.com/modern-go/reflect2 v1.0.2 // indirect
github.com/mozillazg/go-httpheader v0.2.1 // indirect
github.com/pelletier/go-toml/v2 v2.1.0 // indirect
github.com/pierrec/lz4/v4 v4.1.15 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect
github.com/remyoudompheng/bigfft v0.0.0-20200410134404-eec4a21b6bb0 // indirect
github.com/sagikazarmark/locafero v0.4.0 // indirect
github.com/sagikazarmark/slog-shim v0.1.0 // indirect
github.com/sourcegraph/conc v0.3.0 // indirect
github.com/spf13/afero v1.11.0 // indirect
github.com/spf13/cast v1.6.0 // indirect
github.com/spf13/pflag v1.0.5 // indirect
github.com/spf13/viper v1.18.2 // indirect
github.com/subosito/gotenv v1.6.0 // indirect
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common v1.0.638 // indirect
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/tmt v1.0.638 // indirect
github.com/tidwall/match v1.1.1 // indirect
Expand All @@ -86,12 +100,15 @@ require (
github.com/xdg-go/scram v1.0.2 // indirect
github.com/xdg-go/stringprep v1.0.2 // indirect
github.com/youmark/pkcs8 v0.0.0-20181117223130-1be2e3e5546d // indirect
golang.org/x/net v0.7.0 // indirect
golang.org/x/sync v0.1.0 // indirect
golang.org/x/sys v0.5.0 // indirect
golang.org/x/text v0.8.0 // indirect
google.golang.org/genproto v0.0.0-20210917145530-b395a37504d4 // indirect
gopkg.in/ini.v1 v1.66.6 // indirect
go.uber.org/atomic v1.9.0 // indirect
go.uber.org/multierr v1.9.0 // indirect
golang.org/x/exp v0.0.0-20230905200255-921286631fa9 // indirect
golang.org/x/net v0.19.0 // indirect
golang.org/x/sync v0.5.0 // indirect
golang.org/x/sys v0.15.0 // indirect
golang.org/x/text v0.14.0 // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20231120223509-83a465c0220f // indirect
gopkg.in/ini.v1 v1.67.0 // indirect
modernc.org/libc v1.8.1 // indirect
modernc.org/mathutil v1.2.2 // indirect
modernc.org/memory v1.0.4 // indirect
Expand Down
Loading

0 comments on commit 69b4f12

Please sign in to comment.