mirror of
https://github.com/MindWorkAI/AI-Studio.git
synced 2025-07-27 21:22:57 +00:00
Call file format determination synchronously & added logging
This commit is contained in:
parent
42be87c473
commit
d8e8d8b66c
@ -123,9 +123,13 @@ async fn stream_data(file_path: &str) -> Result<ChunkStream> {
|
||||
}
|
||||
|
||||
let file_path_clone = file_path.to_owned();
|
||||
let fmt = tokio::task::spawn_blocking(move || {
|
||||
FileFormat::from_file(&file_path_clone)
|
||||
}).await??;
|
||||
let fmt = match FileFormat::from_file(&file_path_clone) {
|
||||
Ok(format) => format,
|
||||
Err(error) => {
|
||||
error!("Failed to determine file format for '{file_path}': {error}");
|
||||
return Err(format!("Failed to determine file format for '{file_path}': {error}").into());
|
||||
},
|
||||
};
|
||||
|
||||
let ext = file_path.split('.').next_back().unwrap_or("");
|
||||
debug!("Extracting data from file: '{file_path}', format: '{fmt:?}', extension: '{ext}'");
|
||||
|
Loading…
Reference in New Issue
Block a user