Skip to content

Commit

Permalink
feat(bnig): 添加支持reasoning
Browse files Browse the repository at this point in the history
  • Loading branch information
bincooo authored and bincooo committed Feb 11, 2025
1 parent e02bcfd commit a52e131
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 7 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ WantedBy=multi-user.target

- 爬虫逆向之 [ja3 指纹篇](https://github.com/bincooo/chatgpt-adapter/discussions/106)
- 爬虫逆向之 [new bing copilot篇](https://github.com/bincooo/chatgpt-adapter/discussions/105)
- 爬虫逆向之 [cursor & windsurf (proto+gzip)篇](https://github.com/bincooo/chatgpt-adapter/discussions/107)
- 爬虫逆向之 [cursor & windsurf (protobuf+gzip)篇](https://github.com/bincooo/chatgpt-adapter/discussions/107)

## 特别声明
> 本仓库发布的程序代码及其中涉及的任何解锁和解密分析脚本,仅用于测试和学习研究,禁止用于商业用途,不能保证其合法性,准确性,完整性和有效性,请根据情况自行判断。
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ go 1.23.3
require (
github.com/antonfisher/nested-logrus-formatter v1.3.1
github.com/bincooo/coze-api v1.0.2-0.20250118010946-7c4f3c5e25ea
github.com/bincooo/edge-api v1.0.4-0.20250107061327-657cb89a05af
github.com/bincooo/edge-api v1.0.4-0.20250211074233-37fe84649a9b
github.com/bincooo/emit.io v1.0.1-0.20250107024658-671bcfad17e9
github.com/bincooo/you.com v0.0.0-20250205070606-666b6847729b
github.com/bogdanfinn/tls-client v1.7.7
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,8 @@ github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM=
github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw=
github.com/bincooo/coze-api v1.0.2-0.20250118010946-7c4f3c5e25ea h1:yNk4bxooejMYMkUyiRCO0ffHL6kZNMh/XarETVcLXAw=
github.com/bincooo/coze-api v1.0.2-0.20250118010946-7c4f3c5e25ea/go.mod h1:L39ul6Q6lDT/0jOakWKCg4KjJh1pK5Fa2B8Ud8qbcGQ=
github.com/bincooo/edge-api v1.0.4-0.20250107061327-657cb89a05af h1:9oFDFg5lmeLLWtgFExWOo93IrPlUhq/wcbSNr8LA7gY=
github.com/bincooo/edge-api v1.0.4-0.20250107061327-657cb89a05af/go.mod h1:O6hvVd4ekQtiHx5YBbwsmJ4RyF0jV3O5jHHpp4Srfw8=
github.com/bincooo/edge-api v1.0.4-0.20250211074233-37fe84649a9b h1:zxLIcGXY5jlbCKFVjmgKXlAJwJ9oRv4xdHZ8B/l7QsU=
github.com/bincooo/edge-api v1.0.4-0.20250211074233-37fe84649a9b/go.mod h1:O6hvVd4ekQtiHx5YBbwsmJ4RyF0jV3O5jHHpp4Srfw8=
github.com/bincooo/emit.io v1.0.1-0.20250107024658-671bcfad17e9 h1:m8AFZPJYm8CsjGaPsYGjm9Zwg33CVdC4Pda/IIA6cx8=
github.com/bincooo/emit.io v1.0.1-0.20250107024658-671bcfad17e9/go.mod h1:cPNK/qXkuZp+YXYnkRatPMlGUlCD0rqJ8CeAqLAe+LA=
github.com/bincooo/go-annotation v0.0.0-20241210101123-2fc3053d2f16 h1:/2MZmTiHa1a+hfUsmZxvOjQh1+lfZU/9gd7QRjD+xo8=
Expand Down
10 changes: 8 additions & 2 deletions relay/llm/bing/adapter.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ type api struct {

func (api *api) Match(ctx *gin.Context, model string) (ok bool, err error) {
var token = ctx.GetString("token")
ok = Model == model
ok = Model == model || model == Model+"-reason"
if ok {
password := api.env.GetString("server.password")
if password != "" && password != token {
Expand All @@ -53,6 +53,12 @@ func (*api) Models() (slice []model.Model) {
Created: 1686935002,
By: Model + "-adapter",
})
slice = append(slice, model.Model{
Id: Model + "-reason",
Object: "model",
Created: 1686935002,
By: Model + "-adapter",
})
return
}

Expand Down Expand Up @@ -114,7 +120,7 @@ label:
conversationId,
challenge,
content,
elseOf(query == "", "读取内容并以[\n\nAi:]角色继续回复", query), attr)
elseOf(query == "", "读取内容并以[\n\nAi:]角色继续回复", query), attr, elseOf[byte](completion.Model == Model, 0, 1))
if err != nil {
if challenge == "" && err.Error() == "challenge" {
challenge, err = hookCloudflare()
Expand Down
7 changes: 6 additions & 1 deletion relay/llm/bing/toolcall.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,12 @@ func toolChoice(ctx *gin.Context, completion model.Completion) bool {

challenge := ""
label:
buffer, err := edge.Chat(elseOf(proxied, common.HTTPClient, common.NopHTTPClient), ctx.Request.Context(), accessToken, conversationId, challenge, "", message, "")
buffer, err := edge.Chat(elseOf(proxied, common.HTTPClient, common.NopHTTPClient),
ctx.Request.Context(),
accessToken,
conversationId,
challenge, "", message, "",
elseOf[byte](completion.Model == Model, 0, 1))
if err != nil {
if challenge == "" && err.Error() == "challenge" {
challenge, err = hookCloudflare()
Expand Down

0 comments on commit a52e131

Please sign in to comment.