File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -89,27 +89,17 @@ fn is_pdf_path(path: &Path) -> bool {
8989}
9090
9191pub fn load_api_key ( env_file : & Path ) -> Result < String > {
92- let env_file_exists = env_file. try_exists ( ) . with_context ( || {
93- format ! (
94- "Failed to access env file metadata: {}" ,
95- env_file. display( )
96- )
97- } ) ?;
92+ let env_file_exists = env_file
93+ . try_exists ( )
94+ . with_context ( || format ! ( "Failed to access env file metadata: {}" , env_file. display( ) ) ) ?;
9895
9996 if env_file_exists {
100- let entries = dotenvy:: from_path_iter ( env_file) . with_context ( || {
101- format ! (
102- "Failed to read or parse env file: {}" ,
103- env_file. display( )
104- )
105- } ) ?;
97+ let entries = dotenvy:: from_path_iter ( env_file)
98+ . with_context ( || format ! ( "Failed to read or parse env file: {}" , env_file. display( ) ) ) ?;
10699 let mut file_key = None ;
107100 for entry in entries {
108101 let ( key, value) = entry. with_context ( || {
109- format ! (
110- "Failed to read or parse env file: {}" ,
111- env_file. display( )
112- )
102+ format ! ( "Failed to read or parse env file: {}" , env_file. display( ) )
113103 } ) ?;
114104 if key == "ZAI_API_KEY" {
115105 if value. trim ( ) . is_empty ( ) {
@@ -137,7 +127,10 @@ pub fn load_api_key(env_file: &Path) -> Result<String> {
137127 ) ) ;
138128 }
139129
140- Err ( anyhow ! ( "ZAI_API_KEY was not found in {}" , env_file. display( ) ) )
130+ Err ( anyhow ! (
131+ "ZAI_API_KEY was not found in {}" ,
132+ env_file. display( )
133+ ) )
141134}
142135
143136pub async fn process_pdf (
You can’t perform that action at this time.
0 commit comments