@@ -16,7 +16,6 @@ use aigitcommit::built_info::{PKG_NAME, PKG_VERSION};
1616use aigitcommit:: cli:: Cli ;
1717use aigitcommit:: git:: message:: GitMessage ;
1818use aigitcommit:: git:: repository:: Repository ;
19- use aigitcommit:: openai;
2019use aigitcommit:: openai:: OpenAI ;
2120use arboard:: Clipboard ;
2221use async_openai:: types:: {
@@ -28,9 +27,7 @@ use std::io::Write;
2827use std:: path:: Path ;
2928use tracing:: { Level , debug, error, info, trace} ;
3029
31- use aigitcommit:: utils:: {
32- OutputFormat , check_env_variables, env, format_openai_error, save_to_file, should_signoff,
33- } ;
30+ use aigitcommit:: utils:: { OutputFormat , check_env_variables, env, save_to_file, should_signoff} ;
3431
3532// Constants for better performance and maintainability
3633const DEFAULT_MODEL : & str = "gpt-5" ;
@@ -119,10 +116,7 @@ async fn main() -> Result<()> {
119116 ] ;
120117
121118 // Send the request to OpenAI API and get the response
122- let result = client
123- . chat ( & model_name, messages)
124- . await
125- . map_err ( |e| format_openai_error ( e) ) ?;
119+ let result = client. chat ( & model_name, messages) . await ?;
126120
127121 let ( title, content) = result
128122 . split_once ( "\n \n " )
@@ -139,9 +133,10 @@ async fn main() -> Result<()> {
139133
140134 // Copy the commit message to clipboard if the --copy option is enabled
141135 if cli. copy_to_clipboard {
142- let mut clipboard = Clipboard :: new ( )
143- . map_err ( |e| format ! ( "failed to initialize clipboard: {e}" ) ) ?;
144- clipboard. set_text ( message. to_string ( ) )
136+ let mut clipboard =
137+ Clipboard :: new ( ) . map_err ( |e| format ! ( "failed to initialize clipboard: {e}" ) ) ?;
138+ clipboard
139+ . set_text ( message. to_string ( ) )
145140 . map_err ( |e| format ! ( "failed to copy to clipboard: {e}" ) ) ?;
146141 writeln ! (
147142 std:: io:: stdout( ) ,
0 commit comments