From e5d35893690fa0ad00b68e209389b5ea351bff5d Mon Sep 17 00:00:00 2001 From: Xavier Lau Date: Thu, 15 Aug 2024 14:14:50 +0800 Subject: [PATCH] Add `chatgpt-4o-latest` Signed-off-by: Xavier Lau --- src/component/openai.rs | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/src/component/openai.rs b/src/component/openai.rs index 0291a4f..db89340 100644 --- a/src/component/openai.rs +++ b/src/component/openai.rs @@ -58,6 +58,7 @@ impl OpenAi { pub enum Model { Custom(String), Gpt4o, + Gpt4oLatest, Gpt4oMini, Gpt4Turbo, Gpt35Turbo, @@ -70,6 +71,7 @@ impl Model { match self { Self::Custom(s) => s, Self::Gpt4o => "gpt-4o", + Self::Gpt4oLatest => "chatgpt-4o-latest", Self::Gpt4oMini => "gpt-4o-mini", Self::Gpt4Turbo => "gpt-4-turbo", Self::Gpt35Turbo => "gpt-3.5-turbo", @@ -79,7 +81,7 @@ impl Model { pub fn prices(&self) -> (f32, f32) { match self { Self::Custom(_) => (0., 0.), - Self::Gpt4o => (0.000005, 0.000015), + Self::Gpt4o | Self::Gpt4oLatest => (0.000005, 0.000015), Self::Gpt4oMini => (0.00000015, 0.0000006), Self::Gpt4Turbo => (0.00001, 0.00003), Self::Gpt35Turbo => (0.0000005, 0.0000015), @@ -94,16 +96,24 @@ impl Default for Model { impl ComboBoxItem for Model { type Array = [Self; Self::COUNT]; - const COUNT: usize = 5; + const COUNT: usize = 6; fn all() -> Self::Array { - [Self::Custom("".into()), Self::Gpt4o, Self::Gpt4oMini, Self::Gpt4Turbo, Self::Gpt35Turbo] + [ + Self::Custom("".into()), + Self::Gpt4o, + Self::Gpt4oLatest, + Self::Gpt4oMini, + Self::Gpt4Turbo, + Self::Gpt35Turbo, + ] } fn selectable_str(&self) -> Cow { match self { Self::Custom(_) => "Custom", Self::Gpt4o => "GPT-4o", + Self::Gpt4oLatest => "GPT-4o Latest", Self::Gpt4oMini => "GPT-4o Mini", Self::Gpt4Turbo => "GPT-4 Turbo", Self::Gpt35Turbo => "GPT-3.5 Turbo",