|
|
package initialize
|
|
|
|
|
|
import (
|
|
|
"bufio"
|
|
|
groq "github.com/learnLi/groq_client"
|
|
|
"groqai2api/global"
|
|
|
"groqai2api/pkg/accountpool"
|
|
|
"os"
|
|
|
)
|
|
|
|
|
|
func InitAuth() {
|
|
|
var Secrets []*groq.Account
|
|
|
|
|
|
if _, err := os.Stat("session_tokens.txt"); err == nil {
|
|
|
|
|
|
file, _ := os.Open("session_tokens.txt")
|
|
|
defer file.Close()
|
|
|
scanner := bufio.NewScanner(file)
|
|
|
for scanner.Scan() {
|
|
|
|
|
|
token := scanner.Text()
|
|
|
if len(token) == 0 {
|
|
|
continue
|
|
|
}
|
|
|
|
|
|
Secrets = append(Secrets, groq.NewAccount(token, ""))
|
|
|
}
|
|
|
}
|
|
|
|
|
|
global.AccountPool = accountpool.NewAccounts(Secrets)
|
|
|
}
|
|
|
|