fix: expose implemented async relay executors

This commit is contained in:
wlx committed 2026-09-30 12:50:27 +08:00
1 parent d8e05beb13
commit ea9069e332
2 files changed
+34 -5

No files matched your search

@@ -517,11 +517,15 @@ public class CatalogService {
model.put("status", resultSet.getString("status"));
String providerCode = resultSet.getString("provider_code");
String providerProtocol = resultSet.getString("provider_protocol");
// Only adapters that are implemented and verified are published as
// executable. Relay catalog rows stay visibly pending until their
// provider endpoint has been configured and tested; protocol alone is
// not proof that an image/video/audio task API exists.
boolean asyncExecutor = List.of("provider-mock", "provider-vast", "provider-bytedance").contains(resultSet.getString("provider_id"));
// Keep the catalog state aligned with the real async adapters. The
// OpenAI-compatible adapter handles image, video and speech tasks for
// relay providers; it does not claim support for arbitrary async
// model types. Provider-specific adapters cover Tripo 3D and
// Seedance. This prevents a relay route from being shown as
// "异步执行器待接入" when the execution path is already implemented,
// while unsupported task types remain visibly pending.
boolean asyncExecutor = asyncExecutorReady(
resultSet.getString("provider_id"), providerProtocol, resultSet.getString("model_type"));
model.put("executionReady", !"async".equals(resultSet.getString("call_mode")) || asyncExecutor);
model.put("billingReady", billingReady(pricing, resultSet.getString("call_mode"), resultSet.getString("provider_id")));
// Keep the internal route UUID for permission storage and expose a
@@ -542,6 +546,12 @@ public class CatalogService {
return amount != null;
}
static boolean asyncExecutorReady(String providerId, String providerProtocol, String modelType) {
if (List.of("provider-mock", "provider-vast", "provider-bytedance").contains(providerId)) return true;
if (!"openai-compatible".equalsIgnoreCase(providerProtocol)) return false;
return List.of("image", "video", "audio").contains(String.valueOf(modelType).toLowerCase(java.util.Locale.ROOT));
}
private boolean billingReady(Map<String,Object> pricing, String mode, String providerId) {
if ("provider-mock".equals(providerId)) return true;
if (pricing == null) return false;