-
Notifications
You must be signed in to change notification settings - Fork 206
新增北向接口 #324
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
CodeCasterX
merged 27 commits into
ModelEngine-Group:1.2.x
from
Msquittto:main-feature-north-interface
Jul 18, 2025
Merged
新增北向接口 #324
Changes from all commits
Commits
Show all changes
27 commits
Select commit
Hold shift + click to select a range
14c296e
[app-platform] 新增apikey-service
7bf8808
[app-platform] 新增apikey-auth-default插件
4967590
[app-platform] 新增apikey-auth-oms插件
20e19e7
[app-platform] 修改apikey-service pom文件
803ef2b
[app-platform] 修改apikey插件 pom文件
9668a84
[app-platform] 修改apikey-auth-default插件application文件
d47a382
[app-platform] 新增NorthFilter
8e35f4a
[app-platform] 修改LoginFilter mismatch条件
da9c27b
[app-platform] 更新已有北向接口请求前缀
8993e42
[app-platform] 新增用户反馈相关的北向接口
5e83d1d
[app-platform] 新增会话历史相关的北向接口
ff3f8d5
[app-platform] 修改会话历史相关的北向接口groupName
b89315c
[app-platform] OmsApikeyAuthService修改ssl解码问题
08e5741
[app-platform] 修复北向对话接口参数转换问题
04b0f20
[app-platform] 修复北向查询应用列表参数问题
1ef85ea
[app-platform] 修复北向删除会话参数名
498b114
[app-platform] 去除北向会话接口参数默认值
689c69e
[app-platform] 修复换行符问题
0b04efa
[app-platform] 检视意见修改
61cb98b
[app-platform] 新增北向查询应用列表测试用例
fecfaed
[app-platform] 检视意见修改
27e5a53
[app-platform] 修改北向接口前缀
6a8db0c
[app-platform] 修改http请求过滤器匹配前缀
96dd0d7
[app-platform] 修改common目录下插件的pom文件,提取公共依赖插件
eb0a241
[app-platform] 移除apikey-auth非默认插件
5c30468
[app-platform] 检视意见修改
19df9aa
[app-platform] 检视意见修改
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
82 changes: 82 additions & 0 deletions
82
...plugin/src/main/java/modelengine/fit/jober/aipp/northbound/AippLogServiceAdapterImpl.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
/* | ||
* Copyright (c) 2025 Huawei Technologies Co., Ltd. All rights reserved. | ||
* This file is a part of the ModelEngine Project. | ||
* Licensed under the MIT License. See License.txt in the project root for license information. | ||
*/ | ||
|
||
package modelengine.fit.jober.aipp.northbound; | ||
|
||
import modelengine.fit.jane.common.entity.OperationContext; | ||
import modelengine.fit.jober.aipp.dto.aipplog.AippInstLogData; | ||
import modelengine.fit.jober.aipp.dto.aipplog.AippInstLogDataDto; | ||
import modelengine.fit.jober.aipp.genericable.adapter.AippLogServiceAdapter; | ||
import modelengine.fit.jober.aipp.service.AippLogService; | ||
import modelengine.fitframework.annotation.Component; | ||
|
||
import java.util.List; | ||
|
||
/** | ||
* {@link AippLogServiceAdapter} 的适配器类的实现类。 | ||
* | ||
* @author 陈潇文 | ||
* @since 2025-07-08 | ||
*/ | ||
@Component | ||
public class AippLogServiceAdapterImpl implements AippLogServiceAdapter { | ||
private final AippLogService aippLogService; | ||
|
||
/** | ||
* 用 aipp 实例历史记录服务接口的 {@link AippLogService} 构造 {@link AippLogServiceAdapterImpl}。 | ||
* | ||
* @param aippLogService 表示 aipp 实例历史记录服务接口的 {@link AippLogService}。 | ||
*/ | ||
public AippLogServiceAdapterImpl(AippLogService aippLogService) { | ||
this.aippLogService = aippLogService; | ||
} | ||
|
||
@Override | ||
public List<AippInstLogData> queryChatRecentChatLog(String chatId, String appId, OperationContext context) { | ||
List<AippInstLogDataDto> logDataDtoList = this.aippLogService.queryChatRecentChatLog(chatId, appId, context); | ||
return logDataDtoList.stream() | ||
.map(dto -> AippInstLogData.builder() | ||
.aippId(dto.getAippId()) | ||
.version(dto.getVersion()) | ||
.instanceId(dto.getInstanceId()) | ||
.status(dto.getStatus()) | ||
.appName(dto.getAppName()) | ||
.appIcon(dto.getAppIcon()) | ||
.createAt(dto.getCreateAt()) | ||
.question(this.convertQuestion(dto.getQuestion())) | ||
.instanceLogBodies(this.convertLogBodies(dto.getInstanceLogBodies())) | ||
.build()) | ||
.toList(); | ||
} | ||
|
||
private AippInstLogData.AippInstLogBody convertBody(AippInstLogDataDto.AippInstanceLogBody dtoBody) { | ||
if (dtoBody == null) { | ||
return null; | ||
} | ||
return AippInstLogData.AippInstLogBody.builder() | ||
.logId(dtoBody.getLogId()) | ||
.logData(dtoBody.getLogData()) | ||
.logType(dtoBody.getLogType()) | ||
.createAt(dtoBody.getCreateAt()) | ||
.createUserAccount(dtoBody.getCreateUserAccount()) | ||
.build(); | ||
} | ||
|
||
private AippInstLogData.AippInstLogBody convertQuestion(AippInstLogDataDto.AippInstanceLogBody question) { | ||
if (question == null) { | ||
return null; | ||
} | ||
return this.convertBody(question); | ||
} | ||
|
||
private List<AippInstLogData.AippInstLogBody> convertLogBodies( | ||
List<AippInstLogDataDto.AippInstanceLogBody> logBodies) { | ||
if (logBodies == null) { | ||
return null; | ||
} | ||
return logBodies.stream().map(this::convertBody).toList(); | ||
} | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
67 changes: 67 additions & 0 deletions
67
...in/src/test/java/modelengine/fit/jober/aipp/northbound/AppChatServiceAdapterImplTest.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
/* | ||
* Copyright (c) 2025 Huawei Technologies Co., Ltd. All rights reserved. | ||
* This file is a part of the ModelEngine Project. | ||
* Licensed under the MIT License. See License.txt in the project root for license information. | ||
*/ | ||
|
||
package modelengine.fit.jober.aipp.northbound; | ||
|
||
import static org.mockito.ArgumentMatchers.any; | ||
import static org.mockito.ArgumentMatchers.anyBoolean; | ||
import static org.mockito.Mockito.mock; | ||
import static org.mockito.Mockito.when; | ||
|
||
import modelengine.fit.jane.common.entity.OperationContext; | ||
import modelengine.fit.jober.aipp.dto.chat.ChatRequest; | ||
import modelengine.fit.jober.aipp.dto.chat.CreateAppChatRequest; | ||
import modelengine.fit.jober.aipp.service.AppChatService; | ||
import modelengine.fitframework.flowable.Choir; | ||
|
||
import org.junit.jupiter.api.Assertions; | ||
import org.junit.jupiter.api.DisplayName; | ||
import org.junit.jupiter.api.Test; | ||
|
||
import java.util.HashMap; | ||
import java.util.Map; | ||
|
||
/** | ||
* {@link AppChatServiceAdapterImpl} 的单元测试。 | ||
* | ||
* @author 陈潇文 | ||
* @since 2025-07-15 | ||
*/ | ||
public class AppChatServiceAdapterImplTest { | ||
private final AppChatService appChatService = mock(AppChatService.class); | ||
private final AppChatServiceAdapterImpl appChatServiceAdapter = | ||
new AppChatServiceAdapterImpl(appChatService); | ||
|
||
@Test | ||
@DisplayName("测试对话") | ||
void shouldOkWhenTestChat() { | ||
String appId = "appId"; | ||
ChatRequest params = ChatRequest.builder().chatId("chatId").question("q").build(); | ||
Map<String, Object> userContext = new HashMap<>(); | ||
userContext.put("a", "aaa"); | ||
ChatRequest.Context context = ChatRequest.Context.builder() | ||
.atChatId("atChatId") | ||
.atAppId("atAppId") | ||
.useMemory(true) | ||
.dimension("dimension") | ||
.dimensionId("dimensionId") | ||
.userContext(userContext) | ||
.build(); | ||
params.setContext(context); | ||
OperationContext operationContext = new OperationContext(); | ||
boolean isDebug = true; | ||
when(this.appChatService.chat(any(CreateAppChatRequest.class), | ||
any(OperationContext.class), | ||
anyBoolean())).thenReturn(mock(Choir.class)); | ||
// when | ||
Choir<Object> objectChoir = Assertions.assertDoesNotThrow(() -> this.appChatServiceAdapter.chat(appId, | ||
params, | ||
operationContext, | ||
isDebug)); | ||
// then | ||
Assertions.assertNotNull(objectChoir); | ||
} | ||
} |
52 changes: 52 additions & 0 deletions
52
...ipp-genericable/src/main/java/modelengine/fit/jober/aipp/dto/aipplog/AippInstLogData.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
/*--------------------------------------------------------------------------------------------- | ||
* Copyright (c) 2025 Huawei Technologies Co., Ltd. All rights reserved. | ||
* This file is a part of the ModelEngine Project. | ||
* Licensed under the MIT License. See License.txt in the project root for license information. | ||
*--------------------------------------------------------------------------------------------*/ | ||
|
||
package modelengine.fit.jober.aipp.dto.aipplog; | ||
|
||
import lombok.AllArgsConstructor; | ||
import lombok.Builder; | ||
import lombok.Data; | ||
import lombok.NoArgsConstructor; | ||
|
||
import java.time.LocalDateTime; | ||
import java.util.List; | ||
|
||
/** | ||
* aipp 实例历史记录数据。 | ||
* | ||
* @author 陈潇文 | ||
* @since 2025-07-16 | ||
*/ | ||
@AllArgsConstructor | ||
@Data | ||
@Builder | ||
@NoArgsConstructor | ||
public class AippInstLogData { | ||
private String aippId; | ||
private String version; | ||
private String instanceId; | ||
private String status; | ||
private String appName; | ||
private String appIcon; | ||
private LocalDateTime createAt; | ||
private AippInstLogBody question; | ||
private List<AippInstLogBody> instanceLogBodies; | ||
|
||
/** | ||
* 转换实例日志为实例日志体。 | ||
*/ | ||
@AllArgsConstructor | ||
@Data | ||
@Builder | ||
@NoArgsConstructor | ||
public static class AippInstLogBody { | ||
private long logId; | ||
private String logData; | ||
private String logType; | ||
private LocalDateTime createAt; | ||
private String createUserAccount; | ||
} | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.