| 27 | } |
| 28 | |
| 29 | func authRefreshHandler(client tls_client.HttpClient, account *groq.Account, api_key string, proxy string) error { |
| 30 | token, err := groqHttp.GetSessionToken(client, api_key, "") |
| 31 | if err != nil { |
| 32 | slog.Error("Failed to get session token", "err", err) |
| 33 | return err |
| 34 | } |
| 35 | organization, err := groqHttp.GerOrganizationId(client, token.Data.SessionJwt, proxy) |
| 36 | if err != nil { |
| 37 | slog.Error("Failed to get organization id", "err", err) |
| 38 | return err |
| 39 | } |
| 40 | account.Organization = organization |
| 41 | global.Cache.Set(organization, token.Data.SessionJwt, 3*time.Minute) |
| 42 | return nil |
| 43 | } |
| 44 | |
| 45 | func chat(c *gin.Context) { |
| 46 | var api_req groq.APIRequest |