feat(digital-human): 后端转发 llm_model 给 Pixelle

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
boos
2026-06-18 11:23:23 +08:00
parent 1598e6c758
commit 973396aac4
+29
View File
@@ -1661,13 +1661,32 @@ fn output_item_from_reference(value: &str) -> Option<Value> {
.next()
.unwrap_or("digital-human-output")
.to_string();
let proxied_url = pixelle_proxy_url_for_reference(trimmed);
Some(json!({
"url": trimmed,
"fileUrl": proxied_url,
"proxiedUrl": proxied_url,
"filename": filename,
"type": "output"
}))
}
fn pixelle_proxy_url_for_reference(value: &str) -> String {
let trimmed = value.trim();
if let Some(path) = trimmed.strip_prefix("/api/files/") {
return format!("/api/digital-human/pixelle/files/{path}");
}
if let Ok(url) = url::Url::parse(trimmed) {
if matches!(url.host_str(), Some("127.0.0.1") | Some("localhost"))
&& url.path().starts_with("/api/files/")
{
let path = url.path().trim_start_matches("/api/files/");
return format!("/api/digital-human/pixelle/files/{path}");
}
}
trimmed.to_string()
}
fn output_filename(item: &Value) -> Option<String> {
["filename", "fileName", "name", "file"]
.iter()
@@ -1814,6 +1833,7 @@ async fn archive_output(
"filename": filename,
"status": asset.status,
"remoteUrl": asset.remote_url,
"fileUrl": pixelle_proxy_url_for_reference(&remote_url),
"fileName": asset.file_name,
})),
Err(err) => {
@@ -1879,6 +1899,12 @@ async fn archive_output(
"kind": kind,
"filename": filename,
"status": asset.status,
"fileUrl": format!(
"{}/api/{}/workspace/assets/{}/file",
public_base_url(state),
if auth.user_id.is_some() { "user" } else { "" }.trim_matches('/'),
asset.public_id
).replace("/api//", "/api/"),
})),
Err(err) => {
tracing::warn!(%err, "failed to archive digital human output");
@@ -2079,6 +2105,9 @@ fn pixelle_request_body(state: &AppState, body: &Value) -> AppResult<(String, Va
if let Some(value) = optional_string(body, &["apiVideoWorkflow", "api_video_workflow"]) {
request_body["api_video_workflow"] = json!(value);
}
if let Some(value) = optional_string(body, &["llmModel", "llm_model"]) {
request_body["llm_model"] = json!(value);
}
if let Some(value) = reference_audio_url {
request_body["ref_audio"] = json!(value);
}