feat: refine BoosAPI console and user workspace

This commit is contained in:
boos
2026-06-09 16:48:18 +08:00
parent aaba6f152e
commit 59106e6a96
284 changed files with 59886 additions and 5594 deletions
+13 -3
View File
@@ -11,6 +11,16 @@ use crate::{
use serde_json::{json, Map, Value};
use std::{collections::HashMap, sync::Arc, time::Duration};
const DEFAULT_TEXT_TO_VIDEO_MODEL: &str = "seedance-1-0-lite-t2v-250428";
fn normalize_video_model(value: &str) -> String {
match value.trim() {
"seedance-1-0-lite-t2v" => "seedance-1-0-lite-t2v-250428".to_string(),
"seedance-1-0-lite-i2v" => "seedance-1-0-pro-i2v-250528".to_string(),
other => other.to_string(),
}
}
#[derive(Debug, Clone)]
pub enum WorkflowProgressEvent {
Started {
@@ -630,7 +640,7 @@ async fn video_status(
node.id
)));
}
let model = param_str(node, "model", "seedance-1-0-lite-t2v");
let model = normalize_video_model(&param_str(node, "model", DEFAULT_TEXT_TO_VIDEO_MODEL));
let path = format!(
"/videos/{}?model={}",
simple_urlencode(task_id.trim()),
@@ -648,7 +658,7 @@ fn video_request_body(node: &WorkflowNode, prompt: String, image_url: Option<Str
let mut body = Map::new();
body.insert(
"model".to_string(),
json!(param_str(node, "model", "seedance-1-0-lite-t2v")),
json!(normalize_video_model(&param_str(node, "model", DEFAULT_TEXT_TO_VIDEO_MODEL))),
);
body.insert("prompt".to_string(), json!(prompt));
for key in ["ratio", "resolution"] {
@@ -696,7 +706,7 @@ async fn execute_video_generation(
let model = body
.get("model")
.and_then(Value::as_str)
.unwrap_or("seedance-1-0-lite-t2v");
.unwrap_or(DEFAULT_TEXT_TO_VIDEO_MODEL);
let interval = param_i64(node, "poll_interval_secs", 5).clamp(1, 30) as u64;
let timeout = param_i64(node, "timeout_secs", 180).clamp(10, 1800) as u64;
let task = task_id.as_str().unwrap_or_default();
+6 -3
View File
@@ -1,6 +1,9 @@
use crate::workflow::models::NodeTypeDefinition;
use serde_json::json;
const DEFAULT_TEXT_TO_VIDEO_MODEL: &str = "seedance-1-0-lite-t2v-250428";
const DEFAULT_IMAGE_TO_VIDEO_MODEL: &str = "seedance-1-0-pro-i2v-250528";
fn core_node_types() -> Vec<NodeTypeDefinition> {
vec![
NodeTypeDefinition {
@@ -182,7 +185,7 @@ pub fn node_types() -> Vec<NodeTypeDefinition> {
description: "通过 /v1/videos 创建文生视频任务。",
inputs: json!({ "prompt": { "type": "STRING", "required": true } }),
params: json!({
"model": { "ui": "text", "type": "STRING", "default": "seedance-1-0-lite-t2v" },
"model": { "ui": "text", "type": "STRING", "default": DEFAULT_TEXT_TO_VIDEO_MODEL },
"ratio": { "ui": "text", "type": "STRING", "default": "16:9" },
"duration": { "ui": "number", "type": "NUMBER", "default": 5, "min": 1, "max": 30 },
"resolution": { "ui": "text", "type": "STRING", "default": "720p" },
@@ -207,7 +210,7 @@ pub fn node_types() -> Vec<NodeTypeDefinition> {
"image": { "type": "IMAGE", "required": false }
}),
params: json!({
"model": { "ui": "text", "type": "STRING", "default": "seedance-1-0-lite-i2v" },
"model": { "ui": "text", "type": "STRING", "default": DEFAULT_IMAGE_TO_VIDEO_MODEL },
"image_url": { "ui": "text", "type": "STRING", "default": "" },
"ratio": { "ui": "text", "type": "STRING", "default": "16:9" },
"duration": { "ui": "number", "type": "NUMBER", "default": 5, "min": 1, "max": 30 },
@@ -230,7 +233,7 @@ pub fn node_types() -> Vec<NodeTypeDefinition> {
description: "查询 /v1/videos/{id} 视频任务结果。",
inputs: json!({ "task_id": { "type": "STRING", "required": true } }),
params: json!({
"model": { "ui": "text", "type": "STRING", "default": "seedance-1-0-lite-t2v" }
"model": { "ui": "text", "type": "STRING", "default": DEFAULT_TEXT_TO_VIDEO_MODEL }
}),
outputs: json!({
"video": { "type": "VIDEO" },