chore: initialize qiming workspace repository
This commit is contained in:
@@ -0,0 +1,112 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<parent>
|
||||
<artifactId>app-platform-log</artifactId>
|
||||
<groupId>com.xspaceagi</groupId>
|
||||
<version>1.0.0-SNAPSHOT</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<artifactId>app-platform-log-api</artifactId>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-web</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.xspaceagi</groupId>
|
||||
<artifactId>app-platform-log-application</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.xspaceagi</groupId>
|
||||
<artifactId>system-domain</artifactId>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
<plugins>
|
||||
<!-- 打包插件 -->
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-assembly-plugin</artifactId>
|
||||
<version>2.4</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>make-assembly</id>
|
||||
<phase>package</phase>
|
||||
<goals>
|
||||
<goal>single</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
<configuration>
|
||||
<descriptors>
|
||||
<!-- 打包配置:必须在对应目录下创建repack.xml的打包配置文件 -->
|
||||
<descriptor>src/main/resources/assemblies/repack.xml</descriptor>
|
||||
</descriptors>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<!-- install插件,定制在mvn install过程使用哪个jar包安装到本地 -->
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-install-plugin</artifactId>
|
||||
<version>2.5.2</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>install-file</id>
|
||||
<goals>
|
||||
<goal>install-file</goal>
|
||||
</goals>
|
||||
<phase>install</phase>
|
||||
</execution>
|
||||
</executions>
|
||||
<configuration>
|
||||
<!-- install配置,指定将哪个目录下的jar包install为这个工程的jar -->
|
||||
<file>${project.build.directory}/${project.build.finalName}-repack.jar</file>
|
||||
<!--
|
||||
install配置,指定将install的jar打包使用的pom.xml文件,
|
||||
即其他依赖这个jar包的工程按照哪个pom.xml文件来解析依赖
|
||||
-->
|
||||
<pomFile>src/main/resources/install-pom.xml</pomFile>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<!-- deploy插件,定制在mvn deploy过程使用哪个jar包发布到仓库 -->
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-deploy-plugin</artifactId>
|
||||
<version>2.8.2</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>deploy-file</id>
|
||||
<goals>
|
||||
<goal>deploy-file</goal>
|
||||
</goals>
|
||||
<!-- 跳过默认的发布包 -->
|
||||
<phase>none</phase>
|
||||
</execution>
|
||||
</executions>
|
||||
<configuration>
|
||||
<!-- deploy配置,指定将哪个目录下的jar包发布为这个工程的jar -->
|
||||
<file>${project.build.directory}/${project.build.finalName}-repack.jar</file>
|
||||
<!-- 发布地址 -->
|
||||
<url>http://local-maven.space.com/nexus/content/repositories/snapshots/</url>
|
||||
<repositoryId>nexus-snapshots</repositoryId>
|
||||
<groupId>${project.groupId}</groupId>
|
||||
<artifactId>${project.artifactId}</artifactId>
|
||||
<version>${project.version}</version>
|
||||
<packaging>jar</packaging>
|
||||
<!--
|
||||
deploy配置,指定将deploy的jar打包使用的pom.xml文件,
|
||||
即其他依赖这个jar包的工程按照哪个pom.xml文件来解析依赖
|
||||
-->
|
||||
<pomFile>src/main/resources/install-pom.xml</pomFile>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
|
||||
|
||||
|
||||
|
||||
</project>
|
||||
@@ -0,0 +1,94 @@
|
||||
package com.xspaceagi.log.api.convert;
|
||||
|
||||
import com.xspaceagi.domain.model.AgentLogModel;
|
||||
import com.xspaceagi.domain.model.valueobj.AgentLogEntry;
|
||||
import com.xspaceagi.domain.model.valueobj.AgentLogSearchParams;
|
||||
import com.xspaceagi.log.sdk.reponse.AgentLogModelResponse;
|
||||
import com.xspaceagi.log.sdk.request.AgentLogEntryRequest;
|
||||
import com.xspaceagi.log.sdk.request.AgentLogSearchParamsRequest;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
@Slf4j
|
||||
@Service
|
||||
public class AgentLogEntryConvert {
|
||||
|
||||
public AgentLogEntry convertFrom(AgentLogEntryRequest request) {
|
||||
AgentLogEntry agentLogEntry = AgentLogEntry.builder()
|
||||
.requestId(request.getRequestId())
|
||||
.messageId(request.getMessageId())
|
||||
.conversationId(request.getConversationId())
|
||||
.agentId(request.getAgentId())
|
||||
.userUid(request.getUserUid())
|
||||
.tenantId(request.getTenantId())
|
||||
.spaceId(request.getSpaceId())
|
||||
.userInput(request.getUserInput())
|
||||
.output(request.getOutput())
|
||||
.executeResult(request.getExecuteResult())
|
||||
.inputToken(request.getInputToken())
|
||||
.outputToken(request.getOutputToken())
|
||||
.requestStartTime(request.getRequestStartTime())
|
||||
.requestEndTime(request.getRequestEndTime())
|
||||
.elapsedTimeMs(request.getElapsedTimeMs())
|
||||
.nodeType(request.getNodeType())
|
||||
.status(request.getStatus())
|
||||
.nodeName(request.getNodeName())
|
||||
.createdAt(LocalDateTime.now())
|
||||
.updatedAt(LocalDateTime.now())
|
||||
.userId(request.getUserId())
|
||||
.userName(request.getUserName())
|
||||
.build();
|
||||
return agentLogEntry;
|
||||
|
||||
}
|
||||
|
||||
public AgentLogSearchParams convertFrom(AgentLogSearchParamsRequest request) {
|
||||
AgentLogSearchParams agentLogSearchParams = AgentLogSearchParams.builder()
|
||||
.requestId(request.getRequestId())
|
||||
.conversationId(request.getConversationId())
|
||||
.messageId(request.getMessageId())
|
||||
.agentId(request.getAgentId())
|
||||
.userUid(request.getUserUid())
|
||||
.userInput(request.getUserInput())
|
||||
.output(request.getOutput())
|
||||
.startTime(request.getStartTime())
|
||||
.endTime(request.getEndTime())
|
||||
.tenantId(request.getTenantId())
|
||||
.spaceId(request.getSpaceId())
|
||||
.build();
|
||||
return agentLogSearchParams;
|
||||
|
||||
}
|
||||
|
||||
public AgentLogModelResponse convertTo(AgentLogModel agentLogModel) {
|
||||
AgentLogModelResponse agentLogModelResponse = AgentLogModelResponse.builder()
|
||||
.requestId(agentLogModel.getRequestId())
|
||||
.messageId(agentLogModel.getMessageId())
|
||||
.agentId(agentLogModel.getAgentId())
|
||||
.conversationId(agentLogModel.getConversationId())
|
||||
.userUid(agentLogModel.getUserUid())
|
||||
.tenantId(agentLogModel.getTenantId())
|
||||
.spaceId(agentLogModel.getSpaceId())
|
||||
.userInput(agentLogModel.getUserInput())
|
||||
.output(agentLogModel.getOutput())
|
||||
.executeResult(agentLogModel.getExecuteResult())
|
||||
.inputToken(agentLogModel.getInputToken())
|
||||
.outputToken(agentLogModel.getOutputToken())
|
||||
.requestStartTime(agentLogModel.getRequestStartTime())
|
||||
.requestEndTime(agentLogModel.getRequestEndTime())
|
||||
.elapsedTimeMs(agentLogModel.getElapsedTimeMs())
|
||||
.nodeType(agentLogModel.getNodeType())
|
||||
.status(agentLogModel.getStatus())
|
||||
.nodeName(agentLogModel.getNodeName())
|
||||
.createdAt(agentLogModel.getCreatedAt())
|
||||
.updatedAt(agentLogModel.getUpdatedAt())
|
||||
.userId(agentLogModel.getUserId())
|
||||
.userName(agentLogModel.getUserName())
|
||||
.build();
|
||||
return agentLogModelResponse;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,54 @@
|
||||
package com.xspaceagi.log.api.service;
|
||||
|
||||
import com.xspaceagi.log.api.convert.AgentLogEntryConvert;
|
||||
import com.xspaceagi.system.domain.log.LogRecordPrint;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.xspaceagi.domain.adaptor.impl.LogHttpClientAdapter;
|
||||
import com.xspaceagi.domain.model.AgentLogModel;
|
||||
import com.xspaceagi.domain.model.valueobj.AgentLogSearchParams;
|
||||
import com.xspaceagi.domain.service.ILogPlatformDomainService;
|
||||
import com.xspaceagi.log.sdk.reponse.AgentLogModelResponse;
|
||||
import com.xspaceagi.log.sdk.request.AgentLogEntryRequest;
|
||||
import com.xspaceagi.log.sdk.request.AgentLogSearchParamsRequest;
|
||||
import com.xspaceagi.log.sdk.service.LogPlatformRpcService;
|
||||
import com.xspaceagi.system.spec.utils.ValidateUtil;
|
||||
|
||||
import jakarta.annotation.Resource;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
@Slf4j
|
||||
@Service
|
||||
public class LogPlatformRpcServiceImpl implements LogPlatformRpcService {
|
||||
|
||||
@Resource
|
||||
private AgentLogEntryConvert agentLogEntryConvert;
|
||||
|
||||
@Resource
|
||||
private LogHttpClientAdapter logHttpClientAdapter;
|
||||
|
||||
@Resource
|
||||
private ILogPlatformDomainService logPlatformDomainService;
|
||||
|
||||
@LogRecordPrint(content = "[智能体日志]-新增日志")
|
||||
@Override
|
||||
public boolean addLog(AgentLogEntryRequest logEntryRequest) {
|
||||
log.info("Adding agent log, requestId: {}", logEntryRequest.getRequestId());
|
||||
// 校验必填参数
|
||||
ValidateUtil.validate(logEntryRequest);
|
||||
|
||||
var agentLogEntry = agentLogEntryConvert.convertFrom(logEntryRequest);
|
||||
return logHttpClientAdapter.addAgentLog(agentLogEntry);
|
||||
}
|
||||
|
||||
@LogRecordPrint(content = "[智能体日志]-搜索日志")
|
||||
@Override
|
||||
public IPage<AgentLogModelResponse> searchAgentLogs(AgentLogSearchParamsRequest searchParams, Long current,
|
||||
Long pageSize) {
|
||||
|
||||
AgentLogSearchParams agentLogSearchParams = agentLogEntryConvert.convertFrom(searchParams);
|
||||
IPage<AgentLogModel> result = logPlatformDomainService.searchAgentLogs(agentLogSearchParams, current, pageSize);
|
||||
return result.convert(agentLogEntryConvert::convertTo);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
<assembly xmlns="http://maven.apache.org/ASSEMBLY/2.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/ASSEMBLY/2.0.0 http://maven.apache.org/xsd/assembly-2.0.0.xsd">
|
||||
<id>repack</id>
|
||||
<formats>
|
||||
<format>jar</format>
|
||||
</formats>
|
||||
|
||||
<includeBaseDirectory>false</includeBaseDirectory>
|
||||
<dependencySets>
|
||||
<dependencySet>
|
||||
<!--
|
||||
重新打包需要包含的jar包,这个过程会解压所有的jar包并按照jar的规则重新组合成一个jar包
|
||||
这里需要包含当前这个工程 ,格式是{groupId}:{artifactId}
|
||||
-->
|
||||
<includes>
|
||||
<!-- 包含项目自己 -->
|
||||
<include>com.xspaceagi:app-platform-log-api</include>
|
||||
<include>com.xspaceagi:app-platform-log-application</include>
|
||||
<include>com.xspaceagi:app-platform-log-domain</include>
|
||||
<include>com.xspaceagi:app-platform-log-infra</include>
|
||||
<include>com.xspaceagi:app-platform-log-spec</include>
|
||||
</includes>
|
||||
<!-- 打包结果目录:/ 表示target/ -->
|
||||
<outputDirectory>/</outputDirectory>
|
||||
<!-- 是否解压依赖 -->
|
||||
<unpack>true</unpack>
|
||||
<!-- 打包的scope -->
|
||||
<!-- <scope>system</scope>-->
|
||||
</dependencySet>
|
||||
</dependencySets>
|
||||
</assembly>
|
||||
@@ -0,0 +1,20 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<parent>
|
||||
<artifactId>app-platform-log-api</artifactId>
|
||||
<groupId>com.xspaceagi</groupId>
|
||||
<version>1.0.0-SNAPSHOT</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<artifactId>app-platform-log-api</artifactId>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-web</artifactId>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
</project>
|
||||
Reference in New Issue
Block a user