@@ -7,14 +7,8 @@ pub mod request;
77mod retry_classifier;
88pub mod send_message_output;
99
10- use std:: sync:: {
11- Arc ,
12- RwLock ,
13- } ;
1410use std:: time:: Duration ;
1511
16- use amzn_codewhisperer_client:: Client as CodewhispererClient ;
17- use amzn_codewhisperer_client:: types:: Model ;
1812use amzn_codewhisperer_streaming_client:: Client as CodewhispererStreamingClient ;
1913use amzn_qdeveloper_streaming_client:: Client as QDeveloperStreamingClient ;
2014use amzn_qdeveloper_streaming_client:: types:: Origin ;
@@ -46,31 +40,13 @@ use crate::aws_common::{
4640 behavior_version,
4741} ;
4842
49- pub const X_AMZN_CODEWHISPERER_OPT_OUT_HEADER : & str = "x-amzn-codewhisperer-optout" ;
50-
5143const DEFAULT_TIMEOUT_DURATION : Duration = Duration :: from_secs ( 60 * 5 ) ;
5244
53- #[ derive( Clone , Debug ) ]
54- pub struct ModelListResult {
55- pub models : Vec < Model > ,
56- pub default_model : Model ,
57- }
58-
59- impl From < ModelListResult > for ( Vec < Model > , Model ) {
60- fn from ( v : ModelListResult ) -> Self {
61- ( v. models , v. default_model )
62- }
63- }
64-
65- type ModelCache = Arc < RwLock < Option < ModelListResult > > > ;
66-
6745#[ derive( Clone ) ]
6846pub struct ApiClient {
69- client : CodewhispererClient ,
7047 streaming_client : Option < CodewhispererStreamingClient > ,
7148 sigv4_streaming_client : Option < QDeveloperStreamingClient > ,
7249 profile : Option < AuthProfile > ,
73- model_cache : ModelCache ,
7450}
7551
7652impl std:: fmt:: Debug for ApiClient {
@@ -93,7 +69,6 @@ impl std::fmt::Debug for ApiClient {
9369 } ,
9470 )
9571 . field ( "profile" , & self . profile )
96- . field ( "model_cache" , & self . model_cache )
9772 . finish ( )
9873 }
9974}
@@ -117,17 +92,6 @@ impl ApiClient {
11792 . load ( )
11893 . await ;
11994
120- let client = CodewhispererClient :: from_conf (
121- amzn_codewhisperer_client:: config:: Builder :: from ( & bearer_sdk_config)
122- . http_client ( crate :: aws_common:: http_client:: client ( ) )
123- // .interceptor(OptOutInterceptor::new(database))
124- . interceptor ( UserAgentOverrideInterceptor :: new ( ) )
125- . bearer_token_resolver ( BearerResolver )
126- . app_name ( app_name ( ) )
127- . endpoint_url ( endpoint. url ( ) )
128- . build ( ) ,
129- ) ;
130-
13195 // If SIGV4_AUTH_ENABLED is true, use Q developer client
13296 let mut streaming_client = None ;
13397 let mut sigv4_streaming_client = None ;
@@ -177,20 +141,11 @@ impl ApiClient {
177141 }
178142
179143 let profile = None ;
180- // let profile = match database.get_auth_profile() {
181- // Ok(profile) => profile,
182- // Err(err) => {
183- // error!("Failed to get auth profile: {err}");
184- // None
185- // },
186- // };
187144
188145 Ok ( Self {
189- client,
190146 streaming_client,
191147 sigv4_streaming_client,
192148 profile,
193- model_cache : Arc :: new ( RwLock :: new ( None ) ) ,
194149 } )
195150 }
196151
@@ -206,8 +161,6 @@ impl ApiClient {
206161 history,
207162 } = conversation;
208163
209- let model_id_opt: Option < String > = user_input_message. model_id . clone ( ) ;
210-
211164 if let Some ( client) = & self . streaming_client {
212165 let conversation_state = amzn_codewhisperer_streaming_client:: types:: ConversationState :: builder ( )
213166 . set_conversation_id ( conversation_id)
0 commit comments