1+ use crate :: llm:: LLMBackend ;
12use toml;
23
34use dirs;
@@ -11,36 +12,43 @@ pub struct Config {
1112 #[ serde( default ) ]
1213 pub key_bindings : KeyBindings ,
1314
15+ #[ serde( default = "default_llm_backend" ) ]
16+ pub model : LLMBackend ,
17+
1418 #[ serde( default ) ]
15- pub gpt : GPTConfig ,
19+ pub chatgpt : ChatGPTConfig ,
1620}
1721
1822pub fn default_archive_file_name ( ) -> String {
1923 String :: from ( "tenere.archive" )
2024}
2125
26+ pub fn default_llm_backend ( ) -> LLMBackend {
27+ LLMBackend :: ChatGPT
28+ }
29+
2230#[ derive( Deserialize , Debug , Clone ) ]
23- pub struct GPTConfig {
31+ pub struct ChatGPTConfig {
2432 pub openai_api_key : Option < String > ,
2533
26- #[ serde( default = "GPTConfig ::default_model" ) ]
34+ #[ serde( default = "ChatGPTConfig ::default_model" ) ]
2735 pub model : String ,
2836
29- #[ serde( default = "GPTConfig ::default_url" ) ]
37+ #[ serde( default = "ChatGPTConfig ::default_url" ) ]
3038 pub url : String ,
3139}
3240
33- impl Default for GPTConfig {
41+ impl Default for ChatGPTConfig {
3442 fn default ( ) -> Self {
3543 Self {
3644 openai_api_key : None ,
37- model : String :: from ( "gpt-3.5-turbo" ) ,
38- url : String :: from ( "https://api.openai.com/v1/chat/completions" ) ,
45+ model : Self :: default_model ( ) ,
46+ url : Self :: default_url ( ) ,
3947 }
4048 }
4149}
4250
43- impl GPTConfig {
51+ impl ChatGPTConfig {
4452 pub fn default_model ( ) -> String {
4553 String :: from ( "gpt-3.5-turbo" )
4654 }
0 commit comments