From aac39e32a66e2bdb6fa7ac70faeb74ecfe79f14a Mon Sep 17 00:00:00 2001 From: bincooo Date: Thu, 14 Dec 2023 12:45:11 +0800 Subject: [PATCH] =?UTF-8?q?style:=20=E4=BF=AE=E6=94=B9uagent?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- chat.go | 5 +++-- examples/main.go | 11 ++++------- 2 files changed, 7 insertions(+), 9 deletions(-) diff --git a/chat.go b/chat.go index 90aeeff..241df3e 100644 --- a/chat.go +++ b/chat.go @@ -18,7 +18,7 @@ import ( ) var H = map[string]string{ - "User-Agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/117.0.0.0 Safari/537.36 Edg/117.0.2045.55", + "User-Agent": "Mozilla/5.0 (iPhone; CPU iPhone OS 16_6 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/16.6 Mobile/15E148 Safari/604.1 Edg/120.0.0.0", } type kv = map[string]string @@ -45,9 +45,10 @@ func NewDefaultOptions(cookie, agency string) (Options, error) { } co := cookie - if !strings.Contains(cookie, "_U=") { + if cookie != "" && !strings.Contains(cookie, "_U=") { co = "_U=" + cookie } + return Options{ Retry: 2, WebSock: ws, diff --git a/examples/main.go b/examples/main.go index 6a890eb..497d280 100644 --- a/examples/main.go +++ b/examples/main.go @@ -29,11 +29,11 @@ var pMessages = []map[string]string{ func main() { const ( - cookie = "xxx" + cookie = "" agency = "" - KievAuth = "xxx" - RwBf = "xxx" + KievAuth = "FAB6BBRaTOJILtFsMkpLVWSG6AN6C/svRwNmAAAEgAAACNZgd665tz89OAR/PpV+2auHTEVdmOzj6VcZ7Ht3KQtJrGIOjBF5FkAAVwazcW/T0i3G9Lh75iqBxZXtEJK1G1EiqlSeb9Z22M5Y7dFM4xeSEZnLkPLHWxj/u0889GUd1MCNIev1phvAxR7M3YmfqZKq86BtVS3zzvHe0Q+SlOFyzTkE+I/V0wdx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UKmJ/XBZFysiHxp8FesaXyNUIbbsKM7ihF8PEvYnvlUw1n/XkjzWE/8qW3uzmkaz9+gogCfbrKKtGk+cGqApUMsrHUvX9xMG7dxycooCKDSLryt3WY5OivnpnobWf2mkOMO5HQErJDq8vjbskSWq24euIzPJ96Kl3n0Sr7va+p96VSuULUUAHHaBjZS124+0pFzBylFqN0Ui/8d" + RwBf = "r=1&ilt=1&ihpd=0&ispd=1&rc=3880&rb=3880&gb=0&rg=0&pc=3880&mtu=0&rbb=0.0&g=0&cid=&clo=0&v=7&l=2023-12-13T08:00:00.0000000Z&lft=0001-01-01T00:00:00.0000000&aof=0&o=0&p=bingcopilotwaitlist&c=MY00IA&t=8731&s=2023-02-09T05:43:58.6175399+00:00&ts=2023-12-14T04:15:45.1824280+00:00&rwred=0&wls=2&wlb=0&lka=0&lkt=0&aad=0&TH=&mta=0&e=DEXUb252ZC9SFK4xHrsOiXrviFzKvU4xTYFhd2fcf9zIYWoAHoZxCvabGCapPO9hHfELbWR8GYg-bXFEOg3W03lVS7W-BVEoFln5poMCU0o&A=&ccp=0&wle=1&ard=0001-01-01T00:00:00.0000000" ) options, err := edge.NewDefaultOptions(cookie, agency) if err != nil { @@ -43,10 +43,7 @@ func main() { options.RwBf = RwBf options.Proxy = "http://127.0.0.1:7890" options.Model = edge.Sydney - chat, err := edge.New(options) - if err != nil { - panic(err) - } + chat := edge.New(options) prompt := "(你的主人名字叫「折戟成沙丶丿」。当前与你对话的人是「折戟成沙丶丿」在同一个聊天室内,结合之前的历史对话以喵小爱的口吻回复下面的对话)\n「折戟成沙丶丿」: 摸摸" fmt.Println("You: ", prompt)