Skip to content

Commit

Permalink
release-v0.1.5
Browse files Browse the repository at this point in the history
  • Loading branch information
aurorax-neo committed Apr 23, 2024
2 parents aeabdc9 + 6273b85 commit e997cdb
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 10 deletions.
2 changes: 0 additions & 2 deletions Pool/Gpt35Pool.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,6 @@ func (G *Gpt35Pool) GetGpt35(retry int) *chat.Gpt35 {
G.Index = (G.Index + 1) % G.MaxCount
return &gpt35_
} else if retry > 0 { //无缓存或者缓存无效
// time
time.Sleep(time.Millisecond * 200)
// 释放锁 防止死锁
G.Lock.Unlock()
defer G.Lock.Lock()
Expand Down
2 changes: 1 addition & 1 deletion RequestClient/RequestClient.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ var (

func GetInstance() *TlsClient {
clientOnce.Do(func() {
Instance = NewTlsClient(300, profiles.Firefox_102)
Instance = NewTlsClient(300, profiles.Okhttp4Android13)
})
return Instance
}
10 changes: 5 additions & 5 deletions chat/Gpt35.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,15 +52,15 @@ func NewGpt35() *Gpt35 {
MaxUseCount: 1,
ExpiresIn: common.GetTimestampSecond(config.AuthED),
Session: &session{},
Ua: browser.Firefox(),
Ua: browser.Chrome(),
Language: common.RandomLanguage(),
IsUpdating: false,
}
// 获取代理池
ProxyPoolInstance := ProxyPool.GetProxyPoolInstance()
// 如果代理池中有代理数大于 1 则使用 各自requestClient
if len(ProxyPoolInstance.Proxies) > 1 {
instance.RequestClient = RequestClient.NewTlsClient(300, profiles.Firefox_102)
instance.RequestClient = RequestClient.NewTlsClient(300, profiles.Okhttp4Android13)
} else {
instance.RequestClient = RequestClient.GetInstance()
}
Expand All @@ -72,9 +72,9 @@ func NewGpt35() *Gpt35 {
err = instance.getNewSession()
if err != nil {
return &Gpt35{
MaxUseCount: 0,
ExpiresIn: 0,
IsUpdating: true,
MaxUseCount: -1,
ExpiresIn: -1,
IsUpdating: false,
}
}
return instance
Expand Down
3 changes: 1 addition & 2 deletions common/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,7 @@ func RandomLanguage() string {
seed := time.Now().UnixNano()
rng := rand.New(rand.NewSource(seed))
// 语言列表
//languages := []string{"af", "am", "ar-sa", "as", "az-Latn", "be", "bg", "bn-BD", "bn-IN", "bs", "ca", "ca-ES-valencia", "cs", "cy", "da", "de", "de-de", "el", "en-GB", "en-US", "es", "es-ES", "es-US", "es-MX", "et", "eu", "fa", "fi", "fil-Latn", "fr", "fr-FR", "fr-CA", "ga", "gd-Latn", "gl", "gu", "ha-Latn", "he", "hi", "hr", "hu", "hy", "id", "ig-Latn", "is", "it", "it-it", "ja", "ka", "kk", "km", "kn", "ko", "kok", "ku-Arab", "ky-Cyrl", "lb", "lt", "lv", "mi-Latn", "mk", "ml", "mn-Cyrl", "mr", "ms", "mt", "nb", "ne", "nl", "nl-BE", "nn", "nso", "or", "pa", "pa-Arab", "pl", "prs-Arab", "pt-BR", "pt-PT", "qut-Latn", "quz", "ro", "ru", "rw", "sd-Arab", "si", "sk", "sl", "sq", "sr-Cyrl-BA", "sr-Cyrl-RS", "sr-Latn-RS", "sv", "sw", "ta", "te", "tg-Cyrl", "th", "ti", "tk-Latn", "tn", "tr", "tt-Cyrl", "ug-Arab", "uk", "ur", "uz-Latn", "vi", "wo", "xh", "yo-Latn", "zh-Hans", "zh-Hant", "zu"}
languages := []string{"en-US,en;q=0.9"}
languages := []string{"af", "am", "ar-sa", "as", "az-Latn", "be", "bg", "bn-BD", "bn-IN", "bs", "ca", "ca-ES-valencia", "cs", "cy", "da", "de", "de-de", "el", "en-GB", "en-US", "es", "es-ES", "es-US", "es-MX", "et", "eu", "fa", "fi", "fil-Latn", "fr", "fr-FR", "fr-CA", "ga", "gd-Latn", "gl", "gu", "ha-Latn", "he", "hi", "hr", "hu", "hy", "id", "ig-Latn", "is", "it", "it-it", "ja", "ka", "kk", "km", "kn", "ko", "kok", "ku-Arab", "ky-Cyrl", "lb", "lt", "lv", "mi-Latn", "mk", "ml", "mn-Cyrl", "mr", "ms", "mt", "nb", "ne", "nl", "nl-BE", "nn", "nso", "or", "pa", "pa-Arab", "pl", "prs-Arab", "pt-BR", "pt-PT", "qut-Latn", "quz", "ro", "ru", "rw", "sd-Arab", "si", "sk", "sl", "sq", "sr-Cyrl-BA", "sr-Cyrl-RS", "sr-Latn-RS", "sv", "sw", "ta", "te", "tg-Cyrl", "th", "ti", "tk-Latn", "tn", "tr", "tt-Cyrl", "ug-Arab", "uk", "ur", "uz-Latn", "vi", "wo", "xh", "yo-Latn", "zh-Hans", "zh-Hant", "zu"}
// 随机选择一个语言
randomIndex := rng.Intn(len(languages))
return languages[randomIndex]
Expand Down

0 comments on commit e997cdb

Please sign in to comment.