feat(config): add jimeng provider config section
This commit is contained in:
+16
@@ -74,3 +74,19 @@ n_scenes = 5
|
|||||||
video_fps = 30
|
video_fps = 30
|
||||||
poll_interval_secs = 5
|
poll_interval_secs = 5
|
||||||
timeout_secs = 900
|
timeout_secs = 900
|
||||||
|
|
||||||
|
[jimeng]
|
||||||
|
# 即梦(火山引擎视觉/CV)异步生成 provider:图片 jimeng_t2i_v40 + 视频 jimeng_ti2v_v30_pro。
|
||||||
|
# 默认关闭,配齐 AK/SK 后再开。AK/SK 不要写在这里,走环境变量:
|
||||||
|
# BOOSAPI_JIMENG__ACCESS_KEY / BOOSAPI_JIMENG__SECRET_KEY
|
||||||
|
# BOOSAPI_JIMENG__SESSION_TOKEN(STS 临时凭证,可选)
|
||||||
|
enabled = false
|
||||||
|
region = "cn-north-1"
|
||||||
|
host = "visual.volcengineapi.com"
|
||||||
|
image_poll_interval_secs = 2
|
||||||
|
image_timeout_secs = 120
|
||||||
|
video_poll_interval_secs = 8
|
||||||
|
video_timeout_secs = 600
|
||||||
|
# 计费单价,接 billing;先打通链路默认 0:
|
||||||
|
image_cost = 0.0
|
||||||
|
video_cost = 0.0
|
||||||
|
|||||||
@@ -17,6 +17,8 @@ pub struct AppConfig {
|
|||||||
pub pixelle_video: PixelleVideoConfig,
|
pub pixelle_video: PixelleVideoConfig,
|
||||||
#[serde(default)]
|
#[serde(default)]
|
||||||
pub payment: PaymentConfig,
|
pub payment: PaymentConfig,
|
||||||
|
#[serde(default)]
|
||||||
|
pub jimeng: JimengConfig,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Deserialize, Clone)]
|
#[derive(Debug, Deserialize, Clone)]
|
||||||
@@ -104,6 +106,52 @@ pub struct PixelleVideoConfig {
|
|||||||
pub compose_dir: String,
|
pub compose_dir: String,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Jimeng (Volcengine Visual / CV) async generation provider.
|
||||||
|
///
|
||||||
|
/// Credentials are read from config or the `BOOSAPI_JIMENG__*` environment
|
||||||
|
/// variables (e.g. `BOOSAPI_JIMENG__ACCESS_KEY`) and never hard-coded. The
|
||||||
|
/// provider is gated behind `enabled`; when false the routes short-circuit
|
||||||
|
/// with a "capability disabled" response and no upstream calls are made.
|
||||||
|
#[derive(Debug, Deserialize, Clone)]
|
||||||
|
pub struct JimengConfig {
|
||||||
|
/// Master switch. Defaults to false until AK/SK are configured.
|
||||||
|
#[serde(default)]
|
||||||
|
pub enabled: bool,
|
||||||
|
/// Volcengine access key id.
|
||||||
|
#[serde(default)]
|
||||||
|
pub access_key: String,
|
||||||
|
/// Volcengine secret access key.
|
||||||
|
#[serde(default)]
|
||||||
|
pub secret_key: String,
|
||||||
|
/// Optional STS session token (sent as `X-Security-Token` when present).
|
||||||
|
#[serde(default)]
|
||||||
|
pub session_token: Option<String>,
|
||||||
|
/// Signing region.
|
||||||
|
#[serde(default = "default_jimeng_region")]
|
||||||
|
pub region: String,
|
||||||
|
/// API host.
|
||||||
|
#[serde(default = "default_jimeng_host")]
|
||||||
|
pub host: String,
|
||||||
|
/// Poll interval for image tasks (seconds).
|
||||||
|
#[serde(default = "default_jimeng_image_poll_interval_secs")]
|
||||||
|
pub image_poll_interval_secs: u64,
|
||||||
|
/// Overall timeout for image tasks (seconds).
|
||||||
|
#[serde(default = "default_jimeng_image_timeout_secs")]
|
||||||
|
pub image_timeout_secs: u64,
|
||||||
|
/// Poll interval for video tasks (seconds).
|
||||||
|
#[serde(default = "default_jimeng_video_poll_interval_secs")]
|
||||||
|
pub video_poll_interval_secs: u64,
|
||||||
|
/// Overall timeout for video tasks (seconds).
|
||||||
|
#[serde(default = "default_jimeng_video_timeout_secs")]
|
||||||
|
pub video_timeout_secs: u64,
|
||||||
|
/// Cost charged per successful image generation.
|
||||||
|
#[serde(default)]
|
||||||
|
pub image_cost: f64,
|
||||||
|
/// Cost charged per successful video generation.
|
||||||
|
#[serde(default)]
|
||||||
|
pub video_cost: f64,
|
||||||
|
}
|
||||||
|
|
||||||
#[derive(Debug, Deserialize, Clone)]
|
#[derive(Debug, Deserialize, Clone)]
|
||||||
pub struct PaymentConfig {
|
pub struct PaymentConfig {
|
||||||
pub enabled: bool,
|
pub enabled: bool,
|
||||||
@@ -177,6 +225,30 @@ fn default_pixelle_compose_dir() -> String {
|
|||||||
"/opt/Pixelle-Video".to_string()
|
"/opt/Pixelle-Video".to_string()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn default_jimeng_region() -> String {
|
||||||
|
"cn-north-1".to_string()
|
||||||
|
}
|
||||||
|
|
||||||
|
fn default_jimeng_host() -> String {
|
||||||
|
"visual.volcengineapi.com".to_string()
|
||||||
|
}
|
||||||
|
|
||||||
|
fn default_jimeng_image_poll_interval_secs() -> u64 {
|
||||||
|
2
|
||||||
|
}
|
||||||
|
|
||||||
|
fn default_jimeng_image_timeout_secs() -> u64 {
|
||||||
|
120
|
||||||
|
}
|
||||||
|
|
||||||
|
fn default_jimeng_video_poll_interval_secs() -> u64 {
|
||||||
|
8
|
||||||
|
}
|
||||||
|
|
||||||
|
fn default_jimeng_video_timeout_secs() -> u64 {
|
||||||
|
600
|
||||||
|
}
|
||||||
|
|
||||||
fn default_workflow_points_cost() -> f64 {
|
fn default_workflow_points_cost() -> f64 {
|
||||||
10.0
|
10.0
|
||||||
}
|
}
|
||||||
@@ -266,6 +338,25 @@ impl Default for PaymentConfig {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl Default for JimengConfig {
|
||||||
|
fn default() -> Self {
|
||||||
|
Self {
|
||||||
|
enabled: false,
|
||||||
|
access_key: String::new(),
|
||||||
|
secret_key: String::new(),
|
||||||
|
session_token: None,
|
||||||
|
region: default_jimeng_region(),
|
||||||
|
host: default_jimeng_host(),
|
||||||
|
image_poll_interval_secs: default_jimeng_image_poll_interval_secs(),
|
||||||
|
image_timeout_secs: default_jimeng_image_timeout_secs(),
|
||||||
|
video_poll_interval_secs: default_jimeng_video_poll_interval_secs(),
|
||||||
|
video_timeout_secs: default_jimeng_video_timeout_secs(),
|
||||||
|
image_cost: 0.0,
|
||||||
|
video_cost: 0.0,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
impl Default for AppConfig {
|
impl Default for AppConfig {
|
||||||
fn default() -> Self {
|
fn default() -> Self {
|
||||||
Self {
|
Self {
|
||||||
@@ -299,6 +390,7 @@ impl Default for AppConfig {
|
|||||||
comfyui: ComfyUIConfig::default(),
|
comfyui: ComfyUIConfig::default(),
|
||||||
pixelle_video: PixelleVideoConfig::default(),
|
pixelle_video: PixelleVideoConfig::default(),
|
||||||
payment: PaymentConfig::default(),
|
payment: PaymentConfig::default(),
|
||||||
|
jimeng: JimengConfig::default(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2957,6 +2957,7 @@ mod tests {
|
|||||||
comfyui: Default::default(),
|
comfyui: Default::default(),
|
||||||
payment: Default::default(),
|
payment: Default::default(),
|
||||||
pixelle_video: Default::default(),
|
pixelle_video: Default::default(),
|
||||||
|
jimeng: Default::default(),
|
||||||
},
|
},
|
||||||
pool,
|
pool,
|
||||||
BuiltinKeys {
|
BuiltinKeys {
|
||||||
|
|||||||
@@ -414,6 +414,7 @@ mod tests {
|
|||||||
comfyui: Default::default(),
|
comfyui: Default::default(),
|
||||||
payment: Default::default(),
|
payment: Default::default(),
|
||||||
pixelle_video: Default::default(),
|
pixelle_video: Default::default(),
|
||||||
|
jimeng: Default::default(),
|
||||||
},
|
},
|
||||||
pool,
|
pool,
|
||||||
BuiltinKeys {
|
BuiltinKeys {
|
||||||
|
|||||||
@@ -390,6 +390,7 @@ mod tests {
|
|||||||
comfyui: Default::default(),
|
comfyui: Default::default(),
|
||||||
pixelle_video: Default::default(),
|
pixelle_video: Default::default(),
|
||||||
payment: Default::default(),
|
payment: Default::default(),
|
||||||
|
jimeng: Default::default(),
|
||||||
},
|
},
|
||||||
pool,
|
pool,
|
||||||
BuiltinKeys {
|
BuiltinKeys {
|
||||||
|
|||||||
@@ -1030,6 +1030,7 @@ mod tests {
|
|||||||
comfyui: Default::default(),
|
comfyui: Default::default(),
|
||||||
pixelle_video: Default::default(),
|
pixelle_video: Default::default(),
|
||||||
payment: Default::default(),
|
payment: Default::default(),
|
||||||
|
jimeng: Default::default(),
|
||||||
},
|
},
|
||||||
pool,
|
pool,
|
||||||
BuiltinKeys {
|
BuiltinKeys {
|
||||||
|
|||||||
+1
-1
@@ -1047,7 +1047,7 @@ mod tests {
|
|||||||
comfyui: Default::default(),
|
comfyui: Default::default(),
|
||||||
pixelle_video: Default::default(),
|
pixelle_video: Default::default(),
|
||||||
payment: Default::default(),
|
payment: Default::default(),
|
||||||
pixelle_video: Default::default(),
|
jimeng: Default::default(),
|
||||||
},
|
},
|
||||||
pool,
|
pool,
|
||||||
BuiltinKeys {
|
BuiltinKeys {
|
||||||
|
|||||||
@@ -128,6 +128,7 @@ mod tests {
|
|||||||
comfyui: ComfyUIConfig::default(),
|
comfyui: ComfyUIConfig::default(),
|
||||||
payment: Default::default(),
|
payment: Default::default(),
|
||||||
pixelle_video: Default::default(),
|
pixelle_video: Default::default(),
|
||||||
|
jimeng: Default::default(),
|
||||||
},
|
},
|
||||||
pool,
|
pool,
|
||||||
BuiltinKeys {
|
BuiltinKeys {
|
||||||
|
|||||||
@@ -1554,6 +1554,7 @@ mod tests {
|
|||||||
comfyui: Default::default(),
|
comfyui: Default::default(),
|
||||||
payment: Default::default(),
|
payment: Default::default(),
|
||||||
pixelle_video: Default::default(),
|
pixelle_video: Default::default(),
|
||||||
|
jimeng: Default::default(),
|
||||||
},
|
},
|
||||||
pool,
|
pool,
|
||||||
BuiltinKeys {
|
BuiltinKeys {
|
||||||
|
|||||||
@@ -582,6 +582,7 @@ mod tests {
|
|||||||
comfyui: Default::default(),
|
comfyui: Default::default(),
|
||||||
payment: Default::default(),
|
payment: Default::default(),
|
||||||
pixelle_video: Default::default(),
|
pixelle_video: Default::default(),
|
||||||
|
jimeng: Default::default(),
|
||||||
},
|
},
|
||||||
pool,
|
pool,
|
||||||
BuiltinKeys {
|
BuiltinKeys {
|
||||||
|
|||||||
@@ -2279,6 +2279,7 @@ mod tests {
|
|||||||
comfyui,
|
comfyui,
|
||||||
payment: Default::default(),
|
payment: Default::default(),
|
||||||
pixelle_video: Default::default(),
|
pixelle_video: Default::default(),
|
||||||
|
jimeng: Default::default(),
|
||||||
},
|
},
|
||||||
pool,
|
pool,
|
||||||
BuiltinKeys {
|
BuiltinKeys {
|
||||||
|
|||||||
@@ -2552,6 +2552,7 @@ mod tests {
|
|||||||
comfyui: ComfyUIConfig::default(),
|
comfyui: ComfyUIConfig::default(),
|
||||||
payment: Default::default(),
|
payment: Default::default(),
|
||||||
pixelle_video: Default::default(),
|
pixelle_video: Default::default(),
|
||||||
|
jimeng: Default::default(),
|
||||||
},
|
},
|
||||||
pool,
|
pool,
|
||||||
BuiltinKeys {
|
BuiltinKeys {
|
||||||
|
|||||||
@@ -962,6 +962,7 @@ mod tests {
|
|||||||
},
|
},
|
||||||
comfyui: ComfyUIConfig::default(),
|
comfyui: ComfyUIConfig::default(),
|
||||||
pixelle_video: Default::default(),
|
pixelle_video: Default::default(),
|
||||||
|
jimeng: Default::default(),
|
||||||
payment,
|
payment,
|
||||||
},
|
},
|
||||||
pool,
|
pool,
|
||||||
|
|||||||
@@ -2547,6 +2547,7 @@ mod tests {
|
|||||||
comfyui: Default::default(),
|
comfyui: Default::default(),
|
||||||
payment: Default::default(),
|
payment: Default::default(),
|
||||||
pixelle_video: Default::default(),
|
pixelle_video: Default::default(),
|
||||||
|
jimeng: Default::default(),
|
||||||
},
|
},
|
||||||
pool,
|
pool,
|
||||||
crate::services::builtin_keys::BuiltinKeys {
|
crate::services::builtin_keys::BuiltinKeys {
|
||||||
|
|||||||
@@ -2115,6 +2115,7 @@ mod tests {
|
|||||||
},
|
},
|
||||||
comfyui,
|
comfyui,
|
||||||
pixelle_video: Default::default(),
|
pixelle_video: Default::default(),
|
||||||
|
jimeng: Default::default(),
|
||||||
payment,
|
payment,
|
||||||
},
|
},
|
||||||
pool,
|
pool,
|
||||||
|
|||||||
@@ -698,6 +698,7 @@ mod tests {
|
|||||||
comfyui: ComfyUIConfig::default(),
|
comfyui: ComfyUIConfig::default(),
|
||||||
payment: Default::default(),
|
payment: Default::default(),
|
||||||
pixelle_video: Default::default(),
|
pixelle_video: Default::default(),
|
||||||
|
jimeng: Default::default(),
|
||||||
},
|
},
|
||||||
pool,
|
pool,
|
||||||
BuiltinKeys {
|
BuiltinKeys {
|
||||||
|
|||||||
Reference in New Issue
Block a user