chore: prune legacy node backend and mix workflow models
This commit is contained in:
+27
-12
@@ -317,9 +317,7 @@ async fn execute_node(
|
||||
.cloned()
|
||||
.or_else(|| inputs.get("image").cloned())
|
||||
.or_else(|| inputs.get("IMAGE").cloned())
|
||||
.ok_or_else(|| {
|
||||
AppError::BadRequest(format!("{} missing images input", node.id))
|
||||
})?;
|
||||
.ok_or_else(|| AppError::BadRequest(format!("{} missing images input", node.id)))?;
|
||||
Ok(NodeExecution {
|
||||
inputs,
|
||||
outputs: json!({ "IMAGE": image, "image": image }),
|
||||
@@ -354,7 +352,12 @@ async fn execute_node(
|
||||
.get("file")
|
||||
.cloned()
|
||||
.or_else(|| inputs.get("image").cloned())
|
||||
.or_else(|| inputs.get("images").and_then(|images| images.get(0)).cloned())
|
||||
.or_else(|| {
|
||||
inputs
|
||||
.get("images")
|
||||
.and_then(|images| images.get(0))
|
||||
.cloned()
|
||||
})
|
||||
.ok_or_else(|| AppError::BadRequest(format!("{} missing file input", node.id)))?;
|
||||
Ok(NodeExecution {
|
||||
inputs,
|
||||
@@ -643,7 +646,10 @@ async fn video_status(
|
||||
|
||||
fn video_request_body(node: &WorkflowNode, prompt: String, image_url: Option<String>) -> Value {
|
||||
let mut body = Map::new();
|
||||
body.insert("model".to_string(), json!(param_str(node, "model", "seedance-1-0-lite-t2v")));
|
||||
body.insert(
|
||||
"model".to_string(),
|
||||
json!(param_str(node, "model", "seedance-1-0-lite-t2v")),
|
||||
);
|
||||
body.insert("prompt".to_string(), json!(prompt));
|
||||
for key in ["ratio", "resolution"] {
|
||||
let value = param_str(node, key, "");
|
||||
@@ -776,10 +782,7 @@ async fn vae_decode_to_image(
|
||||
.and_then(Value::as_str)
|
||||
.or_else(|| vae.get("model").and_then(Value::as_str))
|
||||
.unwrap_or("gpt-image-2");
|
||||
let width = samples
|
||||
.get("width")
|
||||
.and_then(Value::as_i64)
|
||||
.unwrap_or(1024);
|
||||
let width = samples.get("width").and_then(Value::as_i64).unwrap_or(1024);
|
||||
let height = samples
|
||||
.get("height")
|
||||
.and_then(Value::as_i64)
|
||||
@@ -895,7 +898,14 @@ async fn get_json(ctx: &RunContext, path: &str) -> AppResult<Value> {
|
||||
}
|
||||
|
||||
fn extract_task_id(value: &Value) -> Value {
|
||||
for pointer in ["/id", "/task_id", "/data/id", "/data/task_id", "/result/id", "/result/task_id"] {
|
||||
for pointer in [
|
||||
"/id",
|
||||
"/task_id",
|
||||
"/data/id",
|
||||
"/data/task_id",
|
||||
"/result/id",
|
||||
"/result/task_id",
|
||||
] {
|
||||
if let Some(id) = value.pointer(pointer).and_then(Value::as_str) {
|
||||
if !id.trim().is_empty() {
|
||||
return json!(id);
|
||||
@@ -927,7 +937,10 @@ fn video_task_is_terminal_failure(value: &Value) -> bool {
|
||||
|
||||
fn extract_media_url(value: Option<&Value>) -> Option<String> {
|
||||
let value = value?;
|
||||
find_url_key(value, &["url", "remote_url", "remoteUrl", "image_url", "imageUrl"])
|
||||
find_url_key(
|
||||
value,
|
||||
&["url", "remote_url", "remoteUrl", "image_url", "imageUrl"],
|
||||
)
|
||||
}
|
||||
|
||||
fn find_string_key(value: &Value, keys: &[&str]) -> Option<String> {
|
||||
@@ -972,7 +985,9 @@ fn find_url_by_extension(value: &Value, extensions: &[&str]) -> Option<String> {
|
||||
match value {
|
||||
Value::String(text)
|
||||
if (text.starts_with("http://") || text.starts_with("https://"))
|
||||
&& extensions.iter().any(|ext| text.to_ascii_lowercase().contains(ext)) =>
|
||||
&& extensions
|
||||
.iter()
|
||||
.any(|ext| text.to_ascii_lowercase().contains(ext)) =>
|
||||
{
|
||||
Some(text.clone())
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user