Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
phsl
/
api
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
8503878e
authored
Jun 08, 2026
by
renyizhao
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
模型列表icon问题
parent
38869e0a
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
53 additions
and
15 deletions
+53
-15
computility-module-apihub/computility-module-apihub-biz/src/main/java/com/luhu/computility/module/apihub/controller/app/aimodel/AppAiModelController.java
+3
-8
computility-module-apihub/computility-module-apihub-biz/src/main/java/com/luhu/computility/module/apihub/framework/security/config/SecurityConfiguration.java
+31
-0
computility-module-apihub/computility-module-apihub-biz/src/main/java/com/luhu/computility/module/apihub/service/newapi/NewApiClient.java
+7
-4
computility-module-external/src/main/java/com/luhu/computility/module/external/service/file/AiGeneratedFileServiceImpl.java
+11
-3
computility-server/src/main/resources/application.yaml
+1
-0
No files found.
computility-module-apihub/computility-module-apihub-biz/src/main/java/com/luhu/computility/module/apihub/controller/app/aimodel/AppAiModelController.java
View file @
8503878e
...
...
@@ -122,10 +122,7 @@ public class AppAiModelController {
vo
.
setEndpoints
(
endpoints
);
}
// vendor 名称:如果模型没配 icon,用 model_name 推断
if
(
StrUtil
.
isBlank
(
vo
.
getIcon
()))
{
vo
.
setIcon
(
resolveIconByName
(
vo
.
getModelName
(),
vendors
));
}
// vendor 名称匹配(不主动推断 icon,New API 没配就保持 null)
if
(
StrUtil
.
isBlank
(
vo
.
getVendorName
()))
{
vo
.
setVendorName
(
resolveVendorName
(
vo
.
getModelName
(),
vendors
));
}
...
...
@@ -242,10 +239,7 @@ public class AppAiModelController {
vo
.
setGroupRatio
(
groupRatio
);
// icon & vendor 推断
if
(
StrUtil
.
isBlank
(
vo
.
getIcon
()))
{
vo
.
setIcon
(
resolveIconByName
(
modelName
,
vendors
));
}
// vendor 名称匹配(不主动推断 icon,New API 没配就保持 null)
vo
.
setVendorName
(
resolveVendorName
(
modelName
,
vendors
));
result
.
add
(
vo
);
...
...
@@ -264,6 +258,7 @@ public class AppAiModelController {
return
BUSINESS_RATIO
;
}
Object
defaultRatio
=
groupRatioMap
.
get
(
"default"
);
log
.
info
(
"[resolveGroupRatio] pricing.group_ratio.default={}"
,
defaultRatio
);
if
(
defaultRatio
==
null
)
{
return
BUSINESS_RATIO
;
}
...
...
computility-module-apihub/computility-module-apihub-biz/src/main/java/com/luhu/computility/module/apihub/framework/security/config/SecurityConfiguration.java
0 → 100644
View file @
8503878e
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
();
}
};
}
}
computility-module-apihub/computility-module-apihub-biz/src/main/java/com/luhu/computility/module/apihub/service/newapi/NewApiClient.java
View file @
8503878e
...
...
@@ -388,11 +388,14 @@ public class NewApiClient {
if
(
data
instanceof
Map
)
{
result
.
setData
((
Map
<
String
,
Object
>)
data
);
}
else
{
// data 是
其他类型(List 等),原样返回,调用方自行处理
Map
<
String
,
Object
>
wrapper
=
new
HashMap
<>();
wrapper
.
put
(
"data"
,
data
);
result
.
setData
(
wrapper
);
// data 是
List/Array 等(如 New API /api/pricing 的模型定价列表),
// 整个响应体(含 group_ratio、vendors、supported_endpoint 等顶层字段)作为 data 返回,
// 调用方从 root.get("data") 拿列表,从 root.get("group_ratio") 拿分组倍率等
result
.
setData
(
root
);
}
}
else
{
// 响应里没有 data 字段(如 /api/user/self),直接返回整个 body
result
.
setData
(
root
);
}
return
result
;
}
catch
(
Exception
e
)
{
...
...
computility-module-external/src/main/java/com/luhu/computility/module/external/service/file/AiGeneratedFileServiceImpl.java
View file @
8503878e
...
...
@@ -169,8 +169,7 @@ public class AiGeneratedFileServiceImpl implements AiGeneratedFileService {
}
}
catch
(
Exception
e
)
{
aiGeneratedFileDO
.
setStatus
(
AiGeneratedFileStatus
.
FAILED
.
getValue
());
//task.setErrorMsg(e.getMessage());
log
.
error
(
"上传失败,任务ID:{},错误:{}"
,
aiGeneratedFileDO
.
getId
(),
e
.
getMessage
(),
e
);
log
.
error
(
"上传失败,任务ID:{},原文件URL:{}"
,
aiGeneratedFileDO
.
getId
(),
aiGeneratedFileDO
.
getOriginalUrl
(),
e
);
}
finally
{
aiGeneratedFileMapper
.
updateById
(
aiGeneratedFileDO
);
}
...
...
@@ -185,10 +184,19 @@ public class AiGeneratedFileServiceImpl implements AiGeneratedFileService {
private
int
batchSize
;
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
)
{
if
(
fileName
==
null
)
{
return
".tmp"
;
}
int
idx
=
fileName
.
lastIndexOf
(
"."
);
return
(
idx
!=
-
1
)
?
fileName
.
substring
(
idx
)
:
".tmp"
;
}
...
...
computility-server/src/main/resources/application.yaml
View file @
8503878e
...
...
@@ -246,6 +246,7 @@ computility:
permit-all_urls
:
-
/admin-api/mp/open/**
# 微信公众号开放平台,微信回调接口,不需要登录
-
/app-api/api/v1/**
#普惠算力平台首页的接口,不需要登录
-
/app-api/app/ai/**
# AI 模型与定价接口(未登录可按游客价格展示)
websocket
:
enable
:
true
# websocket的开关
path
:
/infra/ws
# 路径
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment