integrate official Tripo async models

This commit is contained in:
wlx committed 2026-09-27 16:45:36 +08:00
1 parent a022162382
commit 962eef26e5
11 files changed
+160 -20

No files matched your search

@@ -230,12 +230,27 @@ public class AsyncTaskService {
private Map<String,Object> result(Map<String,Object> response) {
Object raw = response.get("output");
if (raw == null && response.get("data") instanceof Map<?,?> data) raw = data.get("output");
if (raw instanceof Map<?,?> map) { Map<String,Object> value = new LinkedHashMap<>(); map.forEach((k,v)->value.put(String.valueOf(k),v)); return value; }
Map<?,?> data = response.get("data") instanceof Map<?,?> value ? value : null;
if (raw == null && data != null) raw = data.get("output");
if (raw instanceof Map<?,?> map) {
Map<String,Object> value = new LinkedHashMap<>();
map.forEach((k,v)->value.put(String.valueOf(k),v));
copyAlias(value, "model_url", "modelUrl");
copyAlias(value, "rendered_image_url", "previewUrl");
copyAlias(value, "video_url", "videoUrl");
if (value.get("url") == null && value.get("modelUrl") != null) value.put("url", value.get("modelUrl"));
if (value.get("url") == null && value.get("videoUrl") != null) value.put("url", value.get("videoUrl"));
if (data != null && data.get("credits_consumed") != null) value.put("creditsConsumed", data.get("credits_consumed"));
return value;
}
if (raw instanceof String value && !value.isBlank()) return Map.of("url", value);
return null;
}
private void copyAlias(Map<String,Object> value, String source, String target) {
if (value.get(target) == null && value.get(source) != null) value.put(target, value.get(source));
}
private String writeJson(Object value) { try { return objectMapper.writeValueAsString(value); } catch (JsonProcessingException exception) { return "{}"; } }
private BigDecimal taskCharge(Map<String,Object> model) {