collab: Include max monthly spend preference in LLM token (#18955)

This PR updates the LLM token claims to include the maximum monthly
spend.

Release Notes:

- N/A
This commit is contained in:
Marshall Bowers 2024-10-09 17:39:34 -04:00 committed by GitHub
parent 99a6a3d5e3
commit 3db789ed90
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 22 additions and 1 deletions

View file

@ -4917,10 +4917,14 @@ async fn get_llm_api_token(
if Utc::now().naive_utc() - account_created_at < MIN_ACCOUNT_AGE_FOR_LLM_USE {
Err(anyhow!("account too young"))?
}
let billing_preferences = db.get_billing_preferences(user.id).await?;
let token = LlmTokenClaims::create(
user.id,
user.github_login.clone(),
session.is_staff(),
billing_preferences,
has_llm_closed_beta_feature_flag,
session.has_llm_subscription(&db).await?,
session.current_plan(&db).await?,