Commit 8503878e by renyizhao

模型列表icon问题

parent 38869e0a
...@@ -122,10 +122,7 @@ public class AppAiModelController { ...@@ -122,10 +122,7 @@ public class AppAiModelController {
vo.setEndpoints(endpoints); vo.setEndpoints(endpoints);
} }
// vendor 名称:如果模型没配 icon,用 model_name 推断 // vendor 名称匹配(不主动推断 icon,New API 没配就保持 null)
if (StrUtil.isBlank(vo.getIcon())) {
vo.setIcon(resolveIconByName(vo.getModelName(), vendors));
}
if (StrUtil.isBlank(vo.getVendorName())) { if (StrUtil.isBlank(vo.getVendorName())) {
vo.setVendorName(resolveVendorName(vo.getModelName(), vendors)); vo.setVendorName(resolveVendorName(vo.getModelName(), vendors));
} }
...@@ -242,10 +239,7 @@ public class AppAiModelController { ...@@ -242,10 +239,7 @@ public class AppAiModelController {
vo.setGroupRatio(groupRatio); vo.setGroupRatio(groupRatio);
// icon & vendor 推断 // vendor 名称匹配(不主动推断 icon,New API 没配就保持 null)
if (StrUtil.isBlank(vo.getIcon())) {
vo.setIcon(resolveIconByName(modelName, vendors));
}
vo.setVendorName(resolveVendorName(modelName, vendors)); vo.setVendorName(resolveVendorName(modelName, vendors));
result.add(vo); result.add(vo);
...@@ -264,6 +258,7 @@ public class AppAiModelController { ...@@ -264,6 +258,7 @@ public class AppAiModelController {
return BUSINESS_RATIO; return BUSINESS_RATIO;
} }
Object defaultRatio = groupRatioMap.get("default"); Object defaultRatio = groupRatioMap.get("default");
log.info("[resolveGroupRatio] pricing.group_ratio.default={}", defaultRatio);
if (defaultRatio == null) { if (defaultRatio == null) {
return BUSINESS_RATIO; return BUSINESS_RATIO;
} }
......
package com.luhu.computility.module.apihub.framework.security.config;
import com.luhu.computility.framework.security.config.AuthorizeRequestsCustomizer;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
import org.springframework.security.config.annotation.web.configurers.AuthorizeHttpRequestsConfigurer;
/**
* Apihub 模块的 Security 配置
*/
@Configuration(proxyBeanMethods = false, value = "apihubSecurityConfiguration")
public class SecurityConfiguration {
@Bean("apihubAuthorizeRequestsCustomizer")
public AuthorizeRequestsCustomizer authorizeRequestsCustomizer() {
return new AuthorizeRequestsCustomizer() {
@Override
public void customize(AuthorizeHttpRequestsConfigurer<HttpSecurity>.AuthorizationManagerRequestMatcherRegistry registry) {
// APP 端 AI 模型与定价接口:未登录也可访问(按游客价格展示)
// 注:URL 实际为 /app-api/app/ai/xxx(prefix=/app-api,controller RequestMapping=/app/ai)
registry.requestMatchers(buildAppApi("/app/ai/pricing")).permitAll();
registry.requestMatchers(buildAppApi("/app/ai/models")).permitAll();
registry.requestMatchers(buildAppApi("/app/ai/models-with-pricing")).permitAll();
}
};
}
}
...@@ -388,11 +388,14 @@ public class NewApiClient { ...@@ -388,11 +388,14 @@ public class NewApiClient {
if (data instanceof Map) { if (data instanceof Map) {
result.setData((Map<String, Object>) data); result.setData((Map<String, Object>) data);
} else { } else {
// data 是其他类型(List 等),原样返回,调用方自行处理 // data 是 List/Array 等(如 New API /api/pricing 的模型定价列表),
Map<String, Object> wrapper = new HashMap<>(); // 整个响应体(含 group_ratio、vendors、supported_endpoint 等顶层字段)作为 data 返回,
wrapper.put("data", data); // 调用方从 root.get("data") 拿列表,从 root.get("group_ratio") 拿分组倍率等
result.setData(wrapper); result.setData(root);
} }
} else {
// 响应里没有 data 字段(如 /api/user/self),直接返回整个 body
result.setData(root);
} }
return result; return result;
} catch (Exception e) { } catch (Exception e) {
......
...@@ -169,8 +169,7 @@ public class AiGeneratedFileServiceImpl implements AiGeneratedFileService { ...@@ -169,8 +169,7 @@ public class AiGeneratedFileServiceImpl implements AiGeneratedFileService {
} }
} catch (Exception e) { } catch (Exception e) {
aiGeneratedFileDO.setStatus(AiGeneratedFileStatus.FAILED.getValue()); aiGeneratedFileDO.setStatus(AiGeneratedFileStatus.FAILED.getValue());
//task.setErrorMsg(e.getMessage()); log.error("上传失败,任务ID:{},原文件URL:{}", aiGeneratedFileDO.getId(), aiGeneratedFileDO.getOriginalUrl(), e);
log.error("上传失败,任务ID:{},错误:{}", aiGeneratedFileDO.getId(), e.getMessage(), e);
} finally { } finally {
aiGeneratedFileMapper.updateById(aiGeneratedFileDO); aiGeneratedFileMapper.updateById(aiGeneratedFileDO);
} }
...@@ -185,10 +184,19 @@ public class AiGeneratedFileServiceImpl implements AiGeneratedFileService { ...@@ -185,10 +184,19 @@ public class AiGeneratedFileServiceImpl implements AiGeneratedFileService {
private int batchSize; private int batchSize;
private String getFileNameFromUrl(String url) { private String getFileNameFromUrl(String url) {
return url.substring(url.lastIndexOf("/") + 1); // 去掉 query string,只保留路径部分,避免 `?` `&` 等字符被当作文件名/扩展名
String path = url;
int queryIdx = url.indexOf("?");
if (queryIdx != -1) {
path = url.substring(0, queryIdx);
}
return path.substring(path.lastIndexOf("/") + 1);
} }
private String getFileExtension(String fileName) { private String getFileExtension(String fileName) {
if (fileName == null) {
return ".tmp";
}
int idx = fileName.lastIndexOf("."); int idx = fileName.lastIndexOf(".");
return (idx != -1) ? fileName.substring(idx) : ".tmp"; return (idx != -1) ? fileName.substring(idx) : ".tmp";
} }
......
...@@ -246,6 +246,7 @@ computility: ...@@ -246,6 +246,7 @@ computility:
permit-all_urls: permit-all_urls:
- /admin-api/mp/open/** # 微信公众号开放平台,微信回调接口,不需要登录 - /admin-api/mp/open/** # 微信公众号开放平台,微信回调接口,不需要登录
- /app-api/api/v1/** #普惠算力平台首页的接口,不需要登录 - /app-api/api/v1/** #普惠算力平台首页的接口,不需要登录
- /app-api/app/ai/** # AI 模型与定价接口(未登录可按游客价格展示)
websocket: websocket:
enable: true # websocket的开关 enable: true # websocket的开关
path: /infra/ws # 路径 path: /infra/ws # 路径
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment