|
|
|
@@ -28,6 +28,8 @@ import org.springframework.data.domain.PageRequest; |
|
|
|
import org.springframework.stereotype.Service; |
|
|
|
|
|
|
|
import javax.annotation.Resource; |
|
|
|
import java.net.MalformedURLException; |
|
|
|
import java.net.URL; |
|
|
|
import java.util.ArrayList; |
|
|
|
import java.util.HashMap; |
|
|
|
import java.util.List; |
|
|
|
@@ -172,6 +174,23 @@ public class ServiceServiceImpl implements ServiceService { |
|
|
|
ServiceVersionVo serviceVersionVo = getServiceVersionVo(serviceVersion); |
|
|
|
com.ruoyi.platform.domain.Service service = serviceDao.getServiceById(serviceVersion.getServiceId()); |
|
|
|
serviceVersionVo.setServiceName(service.getServiceName()); |
|
|
|
// 拼接文档地址和gradio地址 |
|
|
|
if (StringUtils.isNotEmpty(serviceVersionVo.getUrl())) { |
|
|
|
try { |
|
|
|
URL url = new URL(serviceVersionVo.getUrl()); |
|
|
|
// 获取协议、主机、端口 |
|
|
|
String protocol = url.getProtocol(); |
|
|
|
String host = url.getHost(); |
|
|
|
int port = url.getPort(); |
|
|
|
String baseUrl = (port == -1 || port == url.getDefaultPort()) |
|
|
|
? protocol + "://" + host |
|
|
|
: protocol + "://" + host + ":" + port; |
|
|
|
serviceVersionVo.setDocPath(baseUrl + "/redoc"); |
|
|
|
serviceVersionVo.setPagePath(baseUrl + "/gradio"); |
|
|
|
} catch (MalformedURLException e) { |
|
|
|
throw new RuntimeException(e); |
|
|
|
} |
|
|
|
} |
|
|
|
return serviceVersionVo; |
|
|
|
} |
|
|
|
|
|
|
|
|