integrate official Tripo async models
This commit is contained in:
1 parent
a022162382
commit
962eef26e5
11 files changed
+160
-20
No files matched your search
+14
-3
@@ -85,12 +85,18 @@ public class AsyncProviderClient {
|
|||||||
Map<String,Object> row = jdbc.queryForMap("SELECT code, base_url, credential_ciphertext FROM model_providers WHERE id=? AND status='active' AND deleted_at IS NULL", id);
|
Map<String,Object> row = jdbc.queryForMap("SELECT code, base_url, credential_ciphertext FROM model_providers WHERE id=? AND status='active' AND deleted_at IS NULL", id);
|
||||||
String ciphertext = row.get("credential_ciphertext") == null ? "" : String.valueOf(row.get("credential_ciphertext"));
|
String ciphertext = row.get("credential_ciphertext") == null ? "" : String.valueOf(row.get("credential_ciphertext"));
|
||||||
String key = ciphertext.isBlank() ? "" : cipher.decrypt(ciphertext);
|
String key = ciphertext.isBlank() ? "" : cipher.decrypt(ciphertext);
|
||||||
if (key.isBlank()) throw new ApiException("PROVIDER_NOT_CONFIGURED", "异步渠道尚未配置 API Key", 503);
|
|
||||||
String code = String.valueOf(row.get("code"));
|
String code = String.valueOf(row.get("code"));
|
||||||
List<String> keys = new ArrayList<>();
|
List<String> keys = new ArrayList<>();
|
||||||
keys.add(key);
|
if (!key.isBlank()) keys.add(key);
|
||||||
addEnvironmentKeys(keys, code);
|
addEnvironmentKeys(keys, code);
|
||||||
addEnvironmentKeys(keys, id);
|
addEnvironmentKeys(keys, id);
|
||||||
|
// Tripo's official API key may be supplied through the server secret
|
||||||
|
// environment so it never has to be committed or exposed in SQL.
|
||||||
|
if (key.isBlank() && isTripo(code, String.valueOf(row.get("base_url")))) {
|
||||||
|
addEnvironmentKeys(keys, "TRIPO_API_KEY");
|
||||||
|
addEnvironmentKeys(keys, "MOYI_TRIPO_API_KEY");
|
||||||
|
}
|
||||||
|
if (keys.isEmpty()) throw new ApiException("PROVIDER_NOT_CONFIGURED", "异步渠道尚未配置 API Key", 503);
|
||||||
return new Provider(code, String.valueOf(row.get("base_url")), keys.stream().distinct().toList());
|
return new Provider(code, String.valueOf(row.get("base_url")), keys.stream().distinct().toList());
|
||||||
} catch (EmptyResultDataAccessException exception) { throw new ApiException("PROVIDER_NOT_CONFIGURED", "异步渠道不存在或已停用", 503); }
|
} catch (EmptyResultDataAccessException exception) { throw new ApiException("PROVIDER_NOT_CONFIGURED", "异步渠道不存在或已停用", 503); }
|
||||||
}
|
}
|
||||||
@@ -100,10 +106,15 @@ public class AsyncProviderClient {
|
|||||||
private String encode(String value) { return java.net.URLEncoder.encode(value, java.nio.charset.StandardCharsets.UTF_8); }
|
private String encode(String value) { return java.net.URLEncoder.encode(value, java.nio.charset.StandardCharsets.UTF_8); }
|
||||||
private String write(Object value) throws JsonProcessingException { return mapper.writeValueAsString(value == null ? Map.of() : value); }
|
private String write(Object value) throws JsonProcessingException { return mapper.writeValueAsString(value == null ? Map.of() : value); }
|
||||||
private void addEnvironmentKeys(List<String> keys, String alias) {
|
private void addEnvironmentKeys(List<String> keys, String alias) {
|
||||||
String name = "MOYI_UPSTREAM_API_KEYS_" + alias.toUpperCase(java.util.Locale.ROOT).replace('-', '_');
|
String name = alias.endsWith("_API_KEY") ? alias : "MOYI_UPSTREAM_API_KEYS_" + alias.toUpperCase(java.util.Locale.ROOT).replace('-', '_');
|
||||||
String configured = environment.getProperty(name);
|
String configured = environment.getProperty(name);
|
||||||
if (configured != null && !configured.isBlank()) for (String value : configured.split("\\|")) if (!value.isBlank()) keys.add(value.trim());
|
if (configured != null && !configured.isBlank()) for (String value : configured.split("\\|")) if (!value.isBlank()) keys.add(value.trim());
|
||||||
}
|
}
|
||||||
|
private boolean isTripo(String code, String baseUrl) {
|
||||||
|
String normalizedCode = code == null ? "" : code.toLowerCase(java.util.Locale.ROOT);
|
||||||
|
String normalizedUrl = baseUrl == null ? "" : baseUrl.toLowerCase(java.util.Locale.ROOT);
|
||||||
|
return normalizedCode.contains("tripo") || normalizedUrl.contains("tripo3d");
|
||||||
|
}
|
||||||
private record Provider(String code, String baseUrl, List<String> apiKeys, AtomicInteger cursor) {
|
private record Provider(String code, String baseUrl, List<String> apiKeys, AtomicInteger cursor) {
|
||||||
private Provider(String code, String baseUrl, List<String> apiKeys) { this(code, baseUrl, apiKeys, new AtomicInteger()); }
|
private Provider(String code, String baseUrl, List<String> apiKeys) { this(code, baseUrl, apiKeys, new AtomicInteger()); }
|
||||||
private String nextApiKey() { return apiKeys.get(Math.floorMod(cursor.getAndIncrement(), apiKeys.size())); }
|
private String nextApiKey() { return apiKeys.get(Math.floorMod(cursor.getAndIncrement(), apiKeys.size())); }
|
||||||
|
|||||||
@@ -230,12 +230,27 @@ public class AsyncTaskService {
|
|||||||
|
|
||||||
private Map<String,Object> result(Map<String,Object> response) {
|
private Map<String,Object> result(Map<String,Object> response) {
|
||||||
Object raw = response.get("output");
|
Object raw = response.get("output");
|
||||||
if (raw == null && response.get("data") instanceof Map<?,?> data) raw = data.get("output");
|
Map<?,?> data = response.get("data") instanceof Map<?,?> value ? value : null;
|
||||||
if (raw instanceof Map<?,?> map) { Map<String,Object> value = new LinkedHashMap<>(); map.forEach((k,v)->value.put(String.valueOf(k),v)); return value; }
|
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);
|
if (raw instanceof String value && !value.isBlank()) return Map.of("url", value);
|
||||||
return null;
|
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 String writeJson(Object value) { try { return objectMapper.writeValueAsString(value); } catch (JsonProcessingException exception) { return "{}"; } }
|
||||||
|
|
||||||
private BigDecimal taskCharge(Map<String,Object> model) {
|
private BigDecimal taskCharge(Map<String,Object> model) {
|
||||||
|
|||||||
+109
@@ -0,0 +1,109 @@
|
|||||||
|
-- Tripo's current official international API is openapi.tripo3d.com.
|
||||||
|
-- The API key is intentionally supplied outside migrations through the
|
||||||
|
-- encrypted provider credential or TRIPO_API_KEY in the deployment secret.
|
||||||
|
UPDATE model_providers
|
||||||
|
SET base_url = 'https://openapi.tripo3d.com',
|
||||||
|
name = 'Tripo 官方',
|
||||||
|
description = 'Tripo 官方异步 3D 生成 API。',
|
||||||
|
updated_at = now()
|
||||||
|
WHERE id = 'provider-vast'
|
||||||
|
AND code = 'vast-tripo'
|
||||||
|
AND deleted_at IS NULL;
|
||||||
|
|
||||||
|
DO $$
|
||||||
|
DECLARE
|
||||||
|
item record;
|
||||||
|
provider_id_value varchar(64);
|
||||||
|
provider_status_value varchar(16);
|
||||||
|
logical_id_value varchar(64);
|
||||||
|
route_status_value varchar(16);
|
||||||
|
tripo_price jsonb := jsonb_build_object(
|
||||||
|
'price', 1.44,
|
||||||
|
'unit', 'CNY / task',
|
||||||
|
'upstreamCredits', 20,
|
||||||
|
'exchangeRate', 7.2,
|
||||||
|
'priceSource', 'Tripo 官方 API 定价',
|
||||||
|
'pricingNote', 'H 系列文生 3D,标准贴图;未加平台服务费'
|
||||||
|
);
|
||||||
|
BEGIN
|
||||||
|
SELECT id, status INTO provider_id_value, provider_status_value
|
||||||
|
FROM model_providers
|
||||||
|
WHERE id = 'provider-vast' AND code = 'vast-tripo' AND deleted_at IS NULL;
|
||||||
|
|
||||||
|
IF provider_id_value IS NULL THEN
|
||||||
|
RETURN;
|
||||||
|
END IF;
|
||||||
|
|
||||||
|
FOR item IN
|
||||||
|
SELECT * FROM (VALUES
|
||||||
|
('tripo-v3', 'Tripo H v3.1 文生 3D', 'v3.1-20260211'),
|
||||||
|
('tripo-h-v3-0', 'Tripo H v3.0 文生 3D', 'v3.0-20250812'),
|
||||||
|
('tripo-h-v2-5', 'Tripo H v2.5 文生 3D', 'v2.5-20250123')
|
||||||
|
) AS models(model_key_value, public_name_value, upstream_model_value)
|
||||||
|
LOOP
|
||||||
|
INSERT INTO model_definitions (
|
||||||
|
id, model_key, public_name, vendor_name, model_type, call_mode,
|
||||||
|
description, input_types, output_types, status
|
||||||
|
)
|
||||||
|
SELECT 'tripo-def-' || replace(item.model_key_value, '.', '-') || '-' || substr(md5(item.model_key_value), 1, 8),
|
||||||
|
item.model_key_value, item.public_name_value, 'Tripo', '3d', 'async',
|
||||||
|
'Tripo 官方 H 系列异步文生 3D 模型。',
|
||||||
|
'["text"]'::jsonb, '["model", "thumbnail"]'::jsonb, 'active'
|
||||||
|
WHERE NOT EXISTS (
|
||||||
|
SELECT 1 FROM model_definitions d
|
||||||
|
WHERE d.model_key = item.model_key_value AND d.deleted_at IS NULL
|
||||||
|
);
|
||||||
|
|
||||||
|
SELECT d.id INTO logical_id_value
|
||||||
|
FROM model_definitions d
|
||||||
|
WHERE d.model_key = item.model_key_value AND d.deleted_at IS NULL
|
||||||
|
ORDER BY d.created_at
|
||||||
|
LIMIT 1;
|
||||||
|
|
||||||
|
route_status_value := CASE WHEN provider_status_value = 'active' THEN 'active' ELSE 'disabled' END;
|
||||||
|
INSERT INTO model_catalog (
|
||||||
|
id, provider_id, model_key, source_label, public_name, upstream_model,
|
||||||
|
model_type, call_mode, description, input_types, output_types,
|
||||||
|
capabilities, pricing, priority, max_concurrency, logical_model_id, status
|
||||||
|
)
|
||||||
|
SELECT 'tripo-route-' || replace(item.model_key_value, '.', '-') || '-' || substr(md5(item.upstream_model_value), 1, 8),
|
||||||
|
provider_id_value, item.model_key_value, 'Tripo 官方', item.public_name_value,
|
||||||
|
item.upstream_model_value, '3d', 'async',
|
||||||
|
'Tripo 官方 H 系列异步文生 3D 模型。',
|
||||||
|
'["text"]'::jsonb, '["model", "thumbnail"]'::jsonb,
|
||||||
|
'{"taskPolling":true,"formats":["glb","obj","fbx"]}'::jsonb,
|
||||||
|
tripo_price, 100, 1, logical_id_value, route_status_value
|
||||||
|
WHERE NOT EXISTS (
|
||||||
|
SELECT 1 FROM model_catalog m
|
||||||
|
WHERE m.logical_model_id = logical_id_value
|
||||||
|
AND m.provider_id = provider_id_value
|
||||||
|
AND m.upstream_model = item.upstream_model_value
|
||||||
|
AND m.deleted_at IS NULL
|
||||||
|
);
|
||||||
|
|
||||||
|
UPDATE model_catalog
|
||||||
|
SET source_label = 'Tripo 官方',
|
||||||
|
public_name = item.public_name_value,
|
||||||
|
description = 'Tripo 官方 H 系列异步文生 3D 模型。',
|
||||||
|
input_types = '["text"]'::jsonb,
|
||||||
|
output_types = '["model", "thumbnail"]'::jsonb,
|
||||||
|
capabilities = '{"taskPolling":true,"formats":["glb","obj","fbx"]}'::jsonb,
|
||||||
|
pricing = tripo_price,
|
||||||
|
priority = 100,
|
||||||
|
max_concurrency = 1,
|
||||||
|
status = route_status_value,
|
||||||
|
updated_at = now()
|
||||||
|
WHERE provider_id = provider_id_value
|
||||||
|
AND upstream_model = item.upstream_model_value
|
||||||
|
AND deleted_at IS NULL;
|
||||||
|
END LOOP;
|
||||||
|
END $$;
|
||||||
|
|
||||||
|
-- Keep the existing logical model's manufacturer and public metadata aligned
|
||||||
|
-- even when an earlier deployment created it before V16.
|
||||||
|
UPDATE model_definitions
|
||||||
|
SET vendor_name = 'Tripo',
|
||||||
|
public_name = CASE WHEN model_key = 'tripo-v3' THEN 'Tripo H v3.1 文生 3D' ELSE public_name END,
|
||||||
|
updated_at = now()
|
||||||
|
WHERE model_key IN ('tripo-v3', 'tripo-h-v3-0', 'tripo-h-v2-5')
|
||||||
|
AND deleted_at IS NULL;
|
||||||
@@ -96,6 +96,6 @@ SDK 不直接暴露给 MOYI 用户。后续如果上游从 HTTP API 切换为 SD
|
|||||||
|
|
||||||
Mock 目录使用内存仓库,重启会重置,适合原型与接口联调;`migrations/002_catalog_keys.sql` 已准备 PostgreSQL 表结构,后续接持久化仓库时保持 API 不变。
|
Mock 目录使用内存仓库,重启会重置,适合原型与接口联调;`migrations/002_catalog_keys.sql` 已准备 PostgreSQL 表结构,后续接持久化仓库时保持 API 不变。
|
||||||
|
|
||||||
Tripo Provider Adapter 已按官方 v3 文档实现:服务端从 `TRIPO_API_KEY` 读取密钥,调用 `POST /generation/text-to-model` 创建异步任务,再通过 `GET /tasks/{task_id}` 查询状态、进度、消耗额度和模型下载地址。适配器不会把上游密钥返回给用户端。
|
Tripo Provider Adapter 已按官方 v3 文档实现:服务端从加密渠道凭据或 `TRIPO_API_KEY` 读取密钥,调用 `POST /generation/text-to-model` 创建异步任务,再通过 `GET /tasks/{task_id}` 查询状态、进度、消耗额度和模型下载地址。适配器不会把上游密钥返回给用户端;多个环境变量 Key 可用 `|` 分隔并按轮询方式选择。
|
||||||
|
|
||||||
2026-08-25 已完成首次真实文生 3D 验收:使用 `v3.1-20260211` 和 standard 质量生成低面数木质凳子,任务状态为 `success`、进度 100%,Tripo 记录消耗 20.0 积分,并返回 GLB 模型与 WebP 预览地址。验收记录不保存 API Key 和带签名的临时下载 URL。
|
2026-08-25 已完成首次真实文生 3D 验收:使用 `v3.1-20260211` 和 standard 质量生成低面数木质凳子,任务状态为 `success`、进度 100%,Tripo 记录消耗 20.0 积分,并返回 GLB 模型与 WebP 预览地址。验收记录不保存 API Key 和带签名的临时下载 URL。
|
||||||
@@ -183,7 +183,8 @@ sudo nano .env.cloud
|
|||||||
| HTTPS | `MOYI_DOMAIN` | 已预填 `moyi.soulofmodel.com`;证书另放 certs |
|
| HTTPS | `MOYI_DOMAIN` | 已预填 `moyi.soulofmodel.com`;证书另放 certs |
|
||||||
| 容量 | `DB_POOL_*`、`GATEWAY_*`、`TASK_*`、`JAVA_OPTS` | 先用测试默认值,不代表已压测容量 |
|
| 容量 | `DB_POOL_*`、`GATEWAY_*`、`TASK_*`、`JAVA_OPTS` | 先用测试默认值,不代表已压测容量 |
|
||||||
| 供应商 | `DEEPSEEK_*`、`KIMI_*`、`ZHIPU_*` | 首次可空,在管理端配置更直观;环境密钥优先级更高 |
|
| 供应商 | `DEEPSEEK_*`、`KIMI_*`、`ZHIPU_*` | 首次可空,在管理端配置更直观;环境密钥优先级更高 |
|
||||||
| 后置 | `OSS_*`、`TRIPO_API_KEY`、`VOLCENGINE_API_KEY` | 预留,不注入本次 Java 服务,留空 |
|
| 可选 | `TRIPO_API_KEY` | Tripo 官方异步 3D 执行器密钥;也可在管理端渠道中保存加密凭据,多个 Key 用 `|` 分隔 |
|
||||||
|
| 后置 | `OSS_*`、`VOLCENGINE_API_KEY` | 其他后处理或视频供应商的预留项,按对应执行器启用 |
|
||||||
|
|
||||||
密码包含 `$`、`#` 或空格时用单引号包住,例如 `MOYI_REDIS_PASSWORD='实际密码'`。若密码本身包含单引号,按 Compose dotenv 转义规则处理。**不要 `source .env.cloud`,不要把完整 `docker compose config` 输出发到聊天**,其中可能含真实密钥。使用 `deploy.py check` 只输出检查结论。
|
密码包含 `$`、`#` 或空格时用单引号包住,例如 `MOYI_REDIS_PASSWORD='实际密码'`。若密码本身包含单引号,按 Compose dotenv 转义规则处理。**不要 `source .env.cloud`,不要把完整 `docker compose config` 输出发到聊天**,其中可能含真实密钥。使用 `deploy.py check` 只输出检查结论。
|
||||||
|
|
||||||
|
|||||||
@@ -156,14 +156,14 @@ MOYI 用户对外使用的统一 API Base URL 为 `https://moyi.soulofmodel.com/
|
|||||||
|
|
||||||
## Tripo 官方
|
## Tripo 官方
|
||||||
|
|
||||||
国际站官方文档:[General](https://platform.tripo3d.ai/docs/general)、[Authentication](https://platform.tripo3d.ai/docs/quick-start)、[Generation](https://platform.tripo3d.ai/docs/generation)。
|
官方文档:[Tripo API 文档](https://developers.tripo3d.com/zh/docs)、[API Key](https://developers.tripo3d.com/zh/keys)、[定价](https://developers.tripo3d.com/zh/pricing)。
|
||||||
|
|
||||||
- Java 执行器使用 Tripo V3 API Base URL:`https://openapi.tripo3d.ai/v3`。
|
- Java 执行器使用 Tripo V3 API Base URL:`https://openapi.tripo3d.com/v3`,提交 `POST /generation/text-to-model`,轮询 `GET /tasks/{task_id}`。
|
||||||
- 使用 HTTP Bearer API Key;创建任务为 `POST /generation/text-to-model`,查询为 `GET /tasks/{task_id}`。
|
- 当前发布 H 系列 `v3.1-20260211`、`v3.0-20250812`、`v2.5-20250123` 三个异步文生 3D 模型;执行器会保留 Tripo 返回的任务状态和结果链接。
|
||||||
- 文生 3D 请求使用 `type=text_to_model`,版本放在 `model_version`,不能按 OpenAI 聊天请求直接转发。
|
- 现有适配器发送标准贴图参数(`texture=true`、`pbr=true`),按官方定价折算为每任务 20 credits,即默认 `¥1.44 / task`(按 1 USD = 7.2 CNY;管理员可以在模型与分组中调整售价)。
|
||||||
- 当前官方生成文档列出的版本包括 `P1-20260311`、`Turbo-v1.0-20250506`、`v3.1-20260211`、`v3.0-20250812`、`v2.5-20250123` 等,实际选型需结合账号权限及价格。
|
|
||||||
- 若 Key 来自国内 `platform.tripo3d.com`,使用其对应文档与端点;不能假定 `.ai` 和 `.com` 凭据互通。
|
- 若 Key 来自国内 `platform.tripo3d.com`,使用其对应文档与端点;不能假定 `.ai` 和 `.com` 凭据互通。
|
||||||
- 建议渠道 Code `tripo-official`、名称 `Tripo 官方`、来源“官方供应商”、协议 HTTP、凭据类型 Bearer Token。配置真实 Key 后,先用一个低成本模型创建任务并轮询到终态,再把该分组发布给用户。
|
- 管理端已有 `vast-tripo` / `Tripo 官方` 渠道。可以在渠道管理中保存加密后的 Bearer Token,也可以在服务器 `.env.cloud` 中设置 `TRIPO_API_KEY`;环境变量只作为未配置数据库凭据时的安全回退,并支持后续轮换多个 Key(使用 `|` 分隔的上游 Key 列表时按轮询选择)。
|
||||||
|
- 配置真实 Key 后,先用一个低成本模型创建任务并轮询到终态,再把该分组发布给用户。不要把 Key 写入代码、SQL 迁移、Git 或聊天记录。
|
||||||
- Java 异步执行器已接入 Tripo(`provider-vast`)和 Seedance(`provider-bytedance`)的创建、轮询、状态持久化、失败处理和结果链接;未匹配这两个适配器的异步渠道仍会明确显示为“执行器待接入”,不会伪装成可用。
|
- Java 异步执行器已接入 Tripo(`provider-vast`)和 Seedance(`provider-bytedance`)的创建、轮询、状态持久化、失败处理和结果链接;未匹配这两个适配器的异步渠道仍会明确显示为“执行器待接入”,不会伪装成可用。
|
||||||
|
|
||||||
## MOYI 联调顺序
|
## MOYI 联调顺序
|
||||||
|
|||||||
@@ -73,8 +73,8 @@ KIMI_BASE_URL=https://api.moonshot.ai/v1
|
|||||||
ZHIPU_API_KEY=
|
ZHIPU_API_KEY=
|
||||||
ZHIPU_BASE_URL=https://open.bigmodel.cn/api/paas/v4
|
ZHIPU_BASE_URL=https://open.bigmodel.cn/api/paas/v4
|
||||||
|
|
||||||
# RESERVED ONLY: Java Tripo/Seedance + OSS are NOT yet implemented.
|
# Optional official async provider credentials. Keep secrets out of Git.
|
||||||
# Leave these secrets empty; Compose intentionally does not inject them yet.
|
# Tripo is read by the async executor; multiple keys may be separated by |.
|
||||||
TRIPO_API_KEY=
|
TRIPO_API_KEY=
|
||||||
VOLCENGINE_API_KEY=
|
VOLCENGINE_API_KEY=
|
||||||
OSS_REGION=cn-beijing
|
OSS_REGION=cn-beijing
|
||||||
|
|||||||
@@ -33,6 +33,7 @@ OSS_ACCESS_KEY_ID=
|
|||||||
OSS_ACCESS_KEY_SECRET=
|
OSS_ACCESS_KEY_SECRET=
|
||||||
|
|
||||||
# Provider credentials: only injected into the API container.
|
# Provider credentials: only injected into the API container.
|
||||||
|
# Tripo supports one key or a | separated rotation list.
|
||||||
TRIPO_API_KEY=
|
TRIPO_API_KEY=
|
||||||
DEEPSEEK_API_KEY=
|
DEEPSEEK_API_KEY=
|
||||||
KIMI_API_KEY=
|
KIMI_API_KEY=
|
||||||
|
|||||||
@@ -43,6 +43,7 @@ services:
|
|||||||
MOYI_SMS_ACCESS_KEY_SECRET: ${MOYI_SMS_ACCESS_KEY_SECRET:-}
|
MOYI_SMS_ACCESS_KEY_SECRET: ${MOYI_SMS_ACCESS_KEY_SECRET:-}
|
||||||
MOYI_SMS_SIGN_NAME: ${MOYI_SMS_SIGN_NAME:-}
|
MOYI_SMS_SIGN_NAME: ${MOYI_SMS_SIGN_NAME:-}
|
||||||
MOYI_SMS_TEMPLATE_CODE: ${MOYI_SMS_TEMPLATE_CODE:-}
|
MOYI_SMS_TEMPLATE_CODE: ${MOYI_SMS_TEMPLATE_CODE:-}
|
||||||
|
TRIPO_API_KEY: ${TRIPO_API_KEY:-}
|
||||||
GATEWAY_REQUESTS_PER_MINUTE: ${GATEWAY_REQUESTS_PER_MINUTE:-60}
|
GATEWAY_REQUESTS_PER_MINUTE: ${GATEWAY_REQUESTS_PER_MINUTE:-60}
|
||||||
GATEWAY_READS_PER_MINUTE: ${GATEWAY_READS_PER_MINUTE:-300}
|
GATEWAY_READS_PER_MINUTE: ${GATEWAY_READS_PER_MINUTE:-300}
|
||||||
GATEWAY_DEFAULT_MODEL_CONCURRENCY: ${GATEWAY_DEFAULT_MODEL_CONCURRENCY:-4}
|
GATEWAY_DEFAULT_MODEL_CONCURRENCY: ${GATEWAY_DEFAULT_MODEL_CONCURRENCY:-4}
|
||||||
|
|||||||
@@ -219,7 +219,7 @@ export interface AsyncTaskResult {
|
|||||||
updated_at?: string
|
updated_at?: string
|
||||||
createdAt?: string
|
createdAt?: string
|
||||||
completedAt?: string
|
completedAt?: string
|
||||||
result?: { format: string; url: string }
|
result?: { format?: string; url?: string; modelUrl?: string; previewUrl?: string; videoUrl?: string; creditsConsumed?: number; [key: string]: unknown }
|
||||||
output?: { modelUrl?: string; previewUrl?: string; videoUrl?: string }
|
output?: { modelUrl?: string; previewUrl?: string; videoUrl?: string }
|
||||||
creditsConsumed?: number
|
creditsConsumed?: number
|
||||||
error?: { code?: number; message?: string }
|
error?: { code?: number; message?: string }
|
||||||
|
|||||||
@@ -352,8 +352,10 @@ async function runModel() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function mapAsyncTask(task: AsyncTaskResult, model: ModelItem, taskPrompt?: string): TaskItem {
|
function mapAsyncTask(task: AsyncTaskResult, model: ModelItem, taskPrompt?: string): TaskItem {
|
||||||
const modelUrl = task.output?.modelUrl || (task.provider ? task.result?.url : undefined)
|
const modelUrl = task.output?.modelUrl || task.result?.modelUrl || (task.provider ? task.result?.url : undefined)
|
||||||
const videoUrl = task.output?.videoUrl
|
const videoUrl = task.output?.videoUrl || task.result?.videoUrl
|
||||||
|
const previewUrl = task.output?.previewUrl || task.result?.previewUrl
|
||||||
|
const creditsConsumed = task.creditsConsumed ?? task.result?.creditsConsumed
|
||||||
const statusMap: Record<AsyncTaskResult['status'], TaskStatus> = {
|
const statusMap: Record<AsyncTaskResult['status'], TaskStatus> = {
|
||||||
queued: '排队中',
|
queued: '排队中',
|
||||||
running: '执行中',
|
running: '执行中',
|
||||||
@@ -375,8 +377,8 @@ function mapAsyncTask(task: AsyncTaskResult, model: ModelItem, taskPrompt?: stri
|
|||||||
prompt: taskPrompt,
|
prompt: taskPrompt,
|
||||||
modelUrl,
|
modelUrl,
|
||||||
videoUrl,
|
videoUrl,
|
||||||
previewUrl: task.output?.previewUrl,
|
previewUrl,
|
||||||
creditsConsumed: task.creditsConsumed,
|
creditsConsumed,
|
||||||
remote: true,
|
remote: true,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in new issue
Block a user