@@ -8,6 +8,7 @@ use anyhow::{anyhow, Context as _, Result};
88use arrayvec:: ArrayVec ;
99use client:: { Client , UserStore } ;
1010use collections:: { HashMap , HashSet , VecDeque } ;
11+ use feature_flags:: FeatureFlagAppExt as _;
1112use futures:: AsyncReadExt ;
1213use gpui:: {
1314 actions, App , AppContext as _, AsyncApp , Context , Entity , EntityId , Global , Subscription , Task ,
@@ -298,7 +299,7 @@ impl Zeta {
298299 perform_predict_edits : F ,
299300 ) -> Task < Result < Option < InlineCompletion > > >
300301 where
301- F : FnOnce ( Arc < Client > , LlmApiToken , PredictEditsParams ) -> R + ' static ,
302+ F : FnOnce ( Arc < Client > , LlmApiToken , bool , PredictEditsParams ) -> R + ' static ,
302303 R : Future < Output = Result < PredictEditsResponse > > + Send + ' static ,
303304 {
304305 let snapshot = self . report_changes_for_buffer ( buffer, cx) ;
@@ -313,6 +314,7 @@ impl Zeta {
313314
314315 let client = self . client . clone ( ) ;
315316 let llm_token = self . llm_token . clone ( ) ;
317+ let is_staff = cx. is_staff ( ) ;
316318
317319 cx. spawn ( |_, cx| async move {
318320 let request_sent_at = Instant :: now ( ) ;
@@ -348,7 +350,7 @@ impl Zeta {
348350 outline : Some ( input_outline. clone ( ) ) ,
349351 } ;
350352
351- let response = perform_predict_edits ( client, llm_token, body) . await ?;
353+ let response = perform_predict_edits ( client, llm_token, is_staff , body) . await ?;
352354
353355 let output_excerpt = response. output_excerpt ;
354356 log:: debug!( "completion response: {}" , output_excerpt) ;
@@ -515,7 +517,7 @@ and then another
515517 ) -> Task < Result < Option < InlineCompletion > > > {
516518 use std:: future:: ready;
517519
518- self . request_completion_impl ( buffer, position, cx, |_, _, _| ready ( Ok ( response) ) )
520+ self . request_completion_impl ( buffer, position, cx, |_, _, _, _ | ready ( Ok ( response) ) )
519521 }
520522
521523 pub fn request_completion (
@@ -530,6 +532,7 @@ and then another
530532 fn perform_predict_edits (
531533 client : Arc < Client > ,
532534 llm_token : LlmApiToken ,
535+ is_staff : bool ,
533536 body : PredictEditsParams ,
534537 ) -> impl Future < Output = Result < PredictEditsResponse > > {
535538 async move {
@@ -538,14 +541,19 @@ and then another
538541 let mut did_retry = false ;
539542
540543 loop {
541- let request_builder = http_client:: Request :: builder ( ) ;
542- let request = request_builder
543- . method ( Method :: POST )
544- . uri (
544+ let request_builder = http_client:: Request :: builder ( ) . method ( Method :: POST ) ;
545+ let request_builder = if is_staff {
546+ request_builder. uri (
547+ "https://llm-worker-production.zed-industries.workers.dev/predict_edits" ,
548+ )
549+ } else {
550+ request_builder. uri (
545551 http_client
546552 . build_zed_llm_url ( "/predict_edits" , & [ ] ) ?
547553 . as_ref ( ) ,
548554 )
555+ } ;
556+ let request = request_builder
549557 . header ( "Content-Type" , "application/json" )
550558 . header ( "Authorization" , format ! ( "Bearer {}" , token) )
551559 . body ( serde_json:: to_string ( & body) ?. into ( ) ) ?;
0 commit comments