Acquire LLM token from Cloud instead of Collab for Edit Predictions (#35431)

This PR updates the Zed Edit Prediction provider to acquire the LLM
token from Cloud instead of Collab to allow using Edit Predictions even
when disconnected from or unable to connect to the Collab server.

Release Notes:

- N/A

---------

Co-authored-by: Richard Feldman <oss@rtfeldman.com>
This commit is contained in:
Marshall Bowers 2025-07-31 18:12:04 -04:00 committed by GitHub
parent 8e7f1899e1
commit 410348deb0
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
8 changed files with 211 additions and 125 deletions

View file

@ -64,9 +64,14 @@ impl LlmApiToken {
mut lock: RwLockWriteGuard<'_, Option<String>>,
client: &Arc<Client>,
) -> Result<String> {
let response = client.request(proto::GetLlmToken {}).await?;
*lock = Some(response.token.clone());
Ok(response.token.clone())
let system_id = client
.telemetry()
.system_id()
.map(|system_id| system_id.to_string());
let response = client.cloud_client().create_llm_token(system_id).await?;
*lock = Some(response.token.0.clone());
Ok(response.token.0.clone())
}
}