Skip to content

Commit 3d3be47

Browse files
committed
update the model cache structure
1 parent 3aff859 commit 3d3be47

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

crates/chat-cli/src/api_client/mod.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,14 +69,17 @@ pub const X_AMZN_CODEWHISPERER_OPT_OUT_HEADER: &str = "x-amzn-codewhisperer-opto
6969
// TODO(bskiser): confirm timeout is updated to an appropriate value?
7070
const DEFAULT_TIMEOUT_DURATION: Duration = Duration::from_secs(60 * 5);
7171

72+
type ModelListResult = (Vec<Model>, Option<Model>);
73+
type ModelCache = Arc<RwLock<Option<ModelListResult>>>;
74+
7275
#[derive(Clone, Debug)]
7376
pub struct ApiClient {
7477
client: CodewhispererClient,
7578
streaming_client: Option<CodewhispererStreamingClient>,
7679
sigv4_streaming_client: Option<QDeveloperStreamingClient>,
7780
mock_client: Option<Arc<Mutex<std::vec::IntoIter<Vec<ChatResponseStream>>>>>,
7881
profile: Option<AuthProfile>,
79-
model_cache: Arc<RwLock<Option<(Vec<Model>, Option<Model>)>>>,
82+
model_cache: ModelCache,
8083
}
8184

8285
impl ApiClient {

crates/chat-cli/src/cli/chat/cli/model.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ pub async fn select_model(os: &mut Os, session: &mut ChatSession) -> Result<Opti
8888

8989
if let Some(index) = selection {
9090
let selected = &models[index];
91-
let model_id_str = selected.model_id.to_string();
91+
let model_id_str = selected.model_id.clone();
9292
session.conversation.model = Some(model_id_str);
9393
let display_name = get_display_name(selected.model_id());
9494

0 commit comments

Comments
 (0)