fix fal client errors

This commit is contained in:
Brandon Thomas committed 2025-06-14 00:36:20 -04:00
1 parent 27891ee526
commit d449eb007c
4 files changed
+12 -6

No files matched your search

Generated
+1
View File
@@ -3598,6 +3598,7 @@ dependencies = [
"fal",
"file_to_base64_url",
"futures 0.3.31",
"log",
"reqwest 0.12.15",
"serde",
"testing",
@@ -23,6 +23,7 @@ errors = { workspace = true }
# External
anyhow = { workspace = true }
futures = { workspace = true }
log = { workspace = true }
reqwest = { workspace = true }
serde = { workspace = true }
tokio = { workspace = true }
@@ -22,7 +22,7 @@ pub async fn remove_background_rembg<P: AsRef<Path>>(image_path: P, api_key: &Fa
crop_to_bbox: None,
sync_mode: None
};
let result = rembg(request)
.with_api_key(&api_key.0)
.queue()
@@ -56,6 +56,7 @@ mod tests {
use crate::creds::fal_api_key::FalApiKey;
use crate::requests::queue::remove_background_rembg::remove_background_rembg;
use errors::AnyhowResult;
use std::fs::read_to_string;
use testing::test_file_path::test_file_path;
#[tokio::test]
@@ -63,9 +64,9 @@ mod tests {
async fn test_remove_background_rembg() -> AnyhowResult<()> {
let image = test_file_path("test_data/image/juno.jpg")?;
// TODO: DO NOT COMMIT SECRET !
const KEY : &str = "DO NOT COMMIT";
let api_key = FalApiKey::from_str(KEY);
// XXX: Don't commit secrets!
let secret = read_to_string("/Users/bt/Artcraft/credentials/fal_api_key.txt")?;
let api_key = FalApiKey::from_str(&secret);
let result = remove_background_rembg(image, &api_key).await?;
+5 -2
View File
@@ -22,11 +22,14 @@ pub enum Status {
Completed,
}
// NB(bt, 2025-06-13): Some of these fields have started to become optional.
// eg, errors:
// "missing field `source`", line: 1, column: 1019
#[derive(Debug, Serialize, Deserialize)]
pub struct RequestLog {
pub timestamp: String,
pub level: String,
pub source: String,
pub level: Option<String>, // NB(bt): Now optional
pub source: Option<String>, // NB(bt): Now optional
pub message: String,
}