fix: sync rust api-server runtime and bindings
This commit is contained in:
@@ -15,6 +15,9 @@ pub struct AppConfig {
|
||||
pub bind_host: String,
|
||||
pub bind_port: u16,
|
||||
pub log_filter: String,
|
||||
pub admin_username: Option<String>,
|
||||
pub admin_password: Option<String>,
|
||||
pub admin_token_ttl_seconds: u64,
|
||||
pub internal_api_secret: Option<String>,
|
||||
pub jwt_issuer: String,
|
||||
pub jwt_secret: String,
|
||||
@@ -78,6 +81,13 @@ pub struct AppConfig {
|
||||
pub dashscope_base_url: String,
|
||||
pub dashscope_api_key: Option<String>,
|
||||
pub dashscope_image_request_timeout_ms: u64,
|
||||
pub ark_character_video_base_url: String,
|
||||
pub ark_character_video_api_key: Option<String>,
|
||||
pub ark_character_video_request_timeout_ms: u64,
|
||||
pub ark_character_video_model: String,
|
||||
pub character_animation_ffmpeg_path: String,
|
||||
pub character_animation_ffprobe_path: String,
|
||||
pub character_animation_frame_extract_timeout_ms: u64,
|
||||
pub slow_request_threshold_ms: u64,
|
||||
}
|
||||
|
||||
@@ -87,6 +97,9 @@ impl Default for AppConfig {
|
||||
bind_host: "127.0.0.1".to_string(),
|
||||
bind_port: 3000,
|
||||
log_filter: "info,tower_http=info".to_string(),
|
||||
admin_username: None,
|
||||
admin_password: None,
|
||||
admin_token_ttl_seconds: 4 * 60 * 60,
|
||||
internal_api_secret: Some(DEFAULT_INTERNAL_API_SECRET.to_string()),
|
||||
jwt_issuer: "https://auth.genarrative.local".to_string(),
|
||||
jwt_secret: "genarrative-dev-secret".to_string(),
|
||||
@@ -151,6 +164,13 @@ impl Default for AppConfig {
|
||||
dashscope_base_url: "https://dashscope.aliyuncs.com/api/v1".to_string(),
|
||||
dashscope_api_key: None,
|
||||
dashscope_image_request_timeout_ms: 150_000,
|
||||
ark_character_video_base_url: DEFAULT_ARK_BASE_URL.to_string(),
|
||||
ark_character_video_api_key: None,
|
||||
ark_character_video_request_timeout_ms: 420_000,
|
||||
ark_character_video_model: "doubao-seedance-2-0-fast-260128".to_string(),
|
||||
character_animation_ffmpeg_path: "ffmpeg".to_string(),
|
||||
character_animation_ffprobe_path: "ffprobe".to_string(),
|
||||
character_animation_frame_extract_timeout_ms: 120_000,
|
||||
slow_request_threshold_ms: 1_000,
|
||||
}
|
||||
}
|
||||
@@ -182,6 +202,14 @@ impl AppConfig {
|
||||
config.log_filter = log_filter;
|
||||
}
|
||||
|
||||
config.admin_username = read_first_non_empty_env(&["GENARRATIVE_ADMIN_USERNAME"]);
|
||||
config.admin_password = read_first_non_empty_env(&["GENARRATIVE_ADMIN_PASSWORD"]);
|
||||
if let Some(admin_token_ttl_seconds) =
|
||||
read_first_duration_seconds_env(&["GENARRATIVE_ADMIN_TOKEN_TTL_SECONDS"])
|
||||
{
|
||||
config.admin_token_ttl_seconds = admin_token_ttl_seconds;
|
||||
}
|
||||
|
||||
config.internal_api_secret = read_first_non_empty_env(&["GENARRATIVE_INTERNAL_API_SECRET"]);
|
||||
|
||||
if let Some(jwt_issuer) =
|
||||
@@ -430,6 +458,56 @@ impl AppConfig {
|
||||
config.dashscope_image_request_timeout_ms = dashscope_image_request_timeout_ms;
|
||||
}
|
||||
|
||||
if let Some(ark_character_video_base_url) = read_first_non_empty_env(&[
|
||||
"ARK_CHARACTER_VIDEO_BASE_URL",
|
||||
"ARK_BASE_URL",
|
||||
"GENARRATIVE_LLM_BASE_URL",
|
||||
"LLM_BASE_URL",
|
||||
]) {
|
||||
config.ark_character_video_base_url = ark_character_video_base_url;
|
||||
}
|
||||
|
||||
config.ark_character_video_api_key = read_first_non_empty_env(&[
|
||||
"ARK_CHARACTER_VIDEO_API_KEY",
|
||||
"ARK_API_KEY",
|
||||
"GENARRATIVE_LLM_API_KEY",
|
||||
"LLM_API_KEY",
|
||||
]);
|
||||
|
||||
if let Some(ark_character_video_request_timeout_ms) = read_first_positive_u64_env(&[
|
||||
"ARK_CHARACTER_VIDEO_REQUEST_TIMEOUT_MS",
|
||||
"DASHSCOPE_CHARACTER_VIDEO_REQUEST_TIMEOUT_MS",
|
||||
]) {
|
||||
config.ark_character_video_request_timeout_ms =
|
||||
ark_character_video_request_timeout_ms;
|
||||
}
|
||||
|
||||
if let Some(ark_character_video_model) = read_first_non_empty_env(&[
|
||||
"ARK_CHARACTER_VIDEO_MODEL",
|
||||
"DASHSCOPE_CHARACTER_VIDEO_MODEL",
|
||||
]) {
|
||||
config.ark_character_video_model = ark_character_video_model;
|
||||
}
|
||||
|
||||
if let Some(character_animation_ffmpeg_path) =
|
||||
read_first_non_empty_env(&["CHARACTER_ANIMATION_FFMPEG_PATH"])
|
||||
{
|
||||
config.character_animation_ffmpeg_path = character_animation_ffmpeg_path;
|
||||
}
|
||||
|
||||
if let Some(character_animation_ffprobe_path) =
|
||||
read_first_non_empty_env(&["CHARACTER_ANIMATION_FFPROBE_PATH"])
|
||||
{
|
||||
config.character_animation_ffprobe_path = character_animation_ffprobe_path;
|
||||
}
|
||||
|
||||
if let Some(character_animation_frame_extract_timeout_ms) = read_first_positive_u64_env(&[
|
||||
"CHARACTER_ANIMATION_FRAME_EXTRACT_TIMEOUT_MS",
|
||||
]) {
|
||||
config.character_animation_frame_extract_timeout_ms =
|
||||
character_animation_frame_extract_timeout_ms;
|
||||
}
|
||||
|
||||
if let Some(slow_request_threshold_ms) =
|
||||
read_first_positive_u64_env(&["GENARRATIVE_SLOW_REQUEST_THRESHOLD_MS"])
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user