Compare commits
6 Commits
138ee140e1
...
45da452f18
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
45da452f18 | ||
|
|
e6a1bc5383 | ||
|
|
c5916703cd | ||
|
|
807ddbe5cb | ||
|
|
13de694e37 | ||
|
|
1962dd586c |
@@ -29,12 +29,18 @@
|
||||
<eclipse-collections.version>11.1.0</eclipse-collections.version>
|
||||
<curator.version>5.1.0</curator.version>
|
||||
<hutool.version>5.8.27</hutool.version>
|
||||
<mapstruct.version>1.6.3</mapstruct.version>
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.mapstruct</groupId>
|
||||
<artifactId>mapstruct</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.projectlombok</groupId>
|
||||
<artifactId>lombok</artifactId>
|
||||
<optional>true</optional>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
@@ -154,12 +160,22 @@
|
||||
<artifactId>solon-ai-dialect-openai</artifactId>
|
||||
<version>${solon-ai.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.mapstruct</groupId>
|
||||
<artifactId>mapstruct</artifactId>
|
||||
<version>${mapstruct.version}</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</dependencyManagement>
|
||||
|
||||
<build>
|
||||
<pluginManagement>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<version>3.14.0</version>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-source-plugin</artifactId>
|
||||
@@ -168,7 +184,7 @@
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-shade-plugin</artifactId>
|
||||
<version>3.3.0</version>
|
||||
<version>3.6.0</version>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
|
||||
@@ -70,6 +70,32 @@
|
||||
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<configuration>
|
||||
<annotationProcessorPaths>
|
||||
<path>
|
||||
<groupId>org.mapstruct</groupId>
|
||||
<artifactId>mapstruct-processor</artifactId>
|
||||
<version>${mapstruct.version}</version>
|
||||
</path>
|
||||
<path>
|
||||
<groupId>org.projectlombok</groupId>
|
||||
<artifactId>lombok</artifactId>
|
||||
</path>
|
||||
<path>
|
||||
<groupId>org.projectlombok</groupId>
|
||||
<artifactId>lombok-mapstruct-binding</artifactId>
|
||||
<version>0.2.0</version>
|
||||
</path>
|
||||
</annotationProcessorPaths>
|
||||
<compilerArgs>
|
||||
<arg>-Amapstruct.defaultComponentModel=spring</arg>
|
||||
<arg>-Amapstruct.defaultInjectionStrategy=constructor</arg>
|
||||
</compilerArgs>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-maven-plugin</artifactId>
|
||||
|
||||
@@ -11,7 +11,7 @@ import org.springframework.context.annotation.Configuration;
|
||||
@Data
|
||||
@Configuration
|
||||
@ConfigurationProperties(prefix = "file-store")
|
||||
public class FileStoreConfiguration {
|
||||
public class FileStoreProperties {
|
||||
private String downloadPrefix;
|
||||
private String uploadPath;
|
||||
}
|
||||
@@ -63,7 +63,7 @@ public class LlmConfiguration {
|
||||
.openAiApi(apiBuilder.build())
|
||||
.defaultOptions(
|
||||
OpenAiChatOptions.builder()
|
||||
.model(llmProperties.getChat().getModel())
|
||||
.model(llmProperties.getVisual().getModel())
|
||||
.build()
|
||||
)
|
||||
.build()
|
||||
|
||||
@@ -7,7 +7,7 @@ import cn.hutool.core.util.URLUtil;
|
||||
import cn.hutool.crypto.SecureUtil;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import com.lanyuanxiaoyao.service.ai.core.entity.amis.AmisResponse;
|
||||
import com.lanyuanxiaoyao.service.ai.web.configuration.FileStoreConfiguration;
|
||||
import com.lanyuanxiaoyao.service.ai.web.configuration.FileStoreProperties;
|
||||
import com.lanyuanxiaoyao.service.ai.web.entity.vo.DataFileVO;
|
||||
import com.lanyuanxiaoyao.service.ai.web.service.DataFileService;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
@@ -41,17 +41,17 @@ import org.springframework.web.multipart.MultipartFile;
|
||||
@RestController
|
||||
@RequestMapping("/upload")
|
||||
public class DataFileController {
|
||||
private final FileStoreConfiguration fileStoreConfiguration;
|
||||
private final FileStoreProperties fileStoreProperties;
|
||||
private final DataFileService dataFileService;
|
||||
private final String uploadFolderPath;
|
||||
private final String cacheFolderPath;
|
||||
private final String sliceFolderPath;
|
||||
|
||||
public DataFileController(FileStoreConfiguration fileStoreConfiguration, DataFileService dataFileService) {
|
||||
this.fileStoreConfiguration = fileStoreConfiguration;
|
||||
public DataFileController(FileStoreProperties fileStoreProperties, DataFileService dataFileService) {
|
||||
this.fileStoreProperties = fileStoreProperties;
|
||||
this.dataFileService = dataFileService;
|
||||
|
||||
this.uploadFolderPath = fileStoreConfiguration.getUploadPath();
|
||||
this.uploadFolderPath = fileStoreProperties.getUploadPath();
|
||||
this.cacheFolderPath = StrUtil.format("{}/cache", uploadFolderPath);
|
||||
this.sliceFolderPath = StrUtil.format("{}/slice", uploadFolderPath);
|
||||
}
|
||||
@@ -60,7 +60,7 @@ public class DataFileController {
|
||||
public AmisResponse<FinishResponse> upload(@RequestParam("file") MultipartFile file) throws IOException {
|
||||
String filename = file.getOriginalFilename();
|
||||
Long id = dataFileService.initialDataFile(filename);
|
||||
String url = StrUtil.format("{}/upload/download/{}", fileStoreConfiguration.getDownloadPrefix(), id);
|
||||
String url = StrUtil.format("{}/upload/download/{}", fileStoreProperties.getDownloadPrefix(), id);
|
||||
byte[] bytes = file.getBytes();
|
||||
String originMd5 = SecureUtil.md5(new ByteArrayInputStream(bytes));
|
||||
File targetFile = new File(StrUtil.format("{}/{}", uploadFolderPath, originMd5));
|
||||
@@ -80,7 +80,7 @@ public class DataFileController {
|
||||
}
|
||||
|
||||
@GetMapping("/download/{id}")
|
||||
public void download(@PathVariable Long id, HttpServletResponse response) throws IOException {
|
||||
public void download(@PathVariable("id") Long id, HttpServletResponse response) throws IOException {
|
||||
DataFileVO dataFile = dataFileService.downloadFile(id);
|
||||
File targetFile = new File(dataFile.getPath());
|
||||
response.setHeader("Content-Type", dataFile.getType());
|
||||
@@ -157,7 +157,7 @@ public class DataFileController {
|
||||
request.uploadId,
|
||||
request.filename,
|
||||
request.uploadId.toString(),
|
||||
StrUtil.format("{}/upload/download/{}", fileStoreConfiguration.getDownloadPrefix(), request.uploadId)
|
||||
StrUtil.format("{}/upload/download/{}", fileStoreProperties.getDownloadPrefix(), request.uploadId)
|
||||
));
|
||||
} else {
|
||||
throw new RuntimeException("合并文件失败");
|
||||
|
||||
@@ -1,13 +1,19 @@
|
||||
package com.lanyuanxiaoyao.service.ai.web.controller.feedback;
|
||||
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.lanyuanxiaoyao.service.ai.core.entity.amis.AmisCrudResponse;
|
||||
import com.lanyuanxiaoyao.service.ai.core.entity.amis.AmisResponse;
|
||||
import com.lanyuanxiaoyao.service.ai.web.configuration.FileStoreProperties;
|
||||
import com.lanyuanxiaoyao.service.ai.web.entity.Feedback;
|
||||
import com.lanyuanxiaoyao.service.ai.web.service.feedback.FeedbackService;
|
||||
import lombok.Data;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.eclipse.collections.api.factory.Lists;
|
||||
import org.eclipse.collections.api.list.ImmutableList;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
@@ -16,27 +22,52 @@ import org.springframework.web.bind.annotation.RestController;
|
||||
@RestController
|
||||
@RequestMapping("feedback")
|
||||
public class FeedbackController {
|
||||
private final FileStoreProperties fileStoreProperties;
|
||||
private final FeedbackService feedbackService;
|
||||
|
||||
public FeedbackController(FeedbackService feedbackService) {
|
||||
public FeedbackController(FileStoreProperties fileStoreProperties, FeedbackService feedbackService) {
|
||||
this.fileStoreProperties = fileStoreProperties;
|
||||
this.feedbackService = feedbackService;
|
||||
}
|
||||
|
||||
@PostMapping("add")
|
||||
public void add(
|
||||
@RequestParam("source") String source,
|
||||
@RequestParam(value = "pictures", required = false) ImmutableList<Long> pictures
|
||||
) {
|
||||
feedbackService.add(source, ObjectUtil.defaultIfNull(pictures, Lists.immutable.empty()));
|
||||
public void add(@RequestBody CreateItem item) {
|
||||
feedbackService.add(item.source, ObjectUtil.defaultIfNull(item.pictures, Lists.immutable.empty()));
|
||||
}
|
||||
|
||||
@GetMapping("list")
|
||||
public AmisResponse<?> list() {
|
||||
return AmisResponse.responseCrudData(feedbackService.list());
|
||||
public AmisCrudResponse list() {
|
||||
return AmisResponse.responseCrudData(feedbackService.list().collect(feedback -> new ListItem(fileStoreProperties, feedback)));
|
||||
}
|
||||
|
||||
@GetMapping("delete")
|
||||
public void delete(@RequestParam("id") Long id) {
|
||||
feedbackService.remove(id);
|
||||
}
|
||||
|
||||
@Data
|
||||
public static final class CreateItem {
|
||||
private String source;
|
||||
private ImmutableList<Long> pictures;
|
||||
}
|
||||
|
||||
@Data
|
||||
public static final class ListItem {
|
||||
private Long id;
|
||||
private String source;
|
||||
private ImmutableList<String> pictures;
|
||||
private Feedback.Status status;
|
||||
private String analysis;
|
||||
private String analysisShort;
|
||||
|
||||
public ListItem(FileStoreProperties fileStoreProperties, Feedback feedback) {
|
||||
this.id = feedback.getId();
|
||||
this.source = feedback.getSource();
|
||||
this.pictures = feedback.getPictureIds()
|
||||
.collect(id -> StrUtil.format("{}/upload/download/{}", fileStoreProperties.getDownloadPrefix(), id));
|
||||
this.status = feedback.getStatus();
|
||||
this.analysis = feedback.getAnalysis();
|
||||
this.analysisShort = feedback.getAnalysisShort();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,7 +9,7 @@ public class Feedback {
|
||||
private String source;
|
||||
private String analysisShort;
|
||||
private String analysis;
|
||||
private ImmutableList<String> pictureIds;
|
||||
private ImmutableList<Long> pictureIds;
|
||||
private Status status;
|
||||
private Long createdTime;
|
||||
private Long modifiedTime;
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
package com.lanyuanxiaoyao.service.ai.web.entity.context;
|
||||
|
||||
import com.lanyuanxiaoyao.service.ai.web.entity.Feedback;
|
||||
import java.util.List;
|
||||
import lombok.Data;
|
||||
import org.eclipse.collections.api.factory.Lists;
|
||||
|
||||
/**
|
||||
* @author lanyuanxiaoyao
|
||||
* @version 20250616
|
||||
*/
|
||||
@Data
|
||||
public class FeedbackContext {
|
||||
private Feedback feedback;
|
||||
private List<String> pictureDescriptions = Lists.mutable.empty();
|
||||
}
|
||||
@@ -1,18 +1,24 @@
|
||||
package com.lanyuanxiaoyao.service.ai.web.service.feedback;
|
||||
|
||||
import club.kingon.sql.builder.SqlBuilder;
|
||||
import cn.hutool.core.lang.Assert;
|
||||
import cn.hutool.core.util.EnumUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.lanyuanxiaoyao.service.ai.core.configuration.SnowflakeId;
|
||||
import com.lanyuanxiaoyao.service.ai.web.entity.Feedback;
|
||||
import com.lanyuanxiaoyao.service.ai.web.entity.context.FeedbackContext;
|
||||
import com.lanyuanxiaoyao.service.common.Constants;
|
||||
import com.yomahub.liteflow.core.FlowExecutor;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.stream.Collectors;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.eclipse.collections.api.factory.Lists;
|
||||
import org.eclipse.collections.api.list.ImmutableList;
|
||||
import org.springframework.jdbc.core.JdbcTemplate;
|
||||
import org.springframework.jdbc.core.RowMapper;
|
||||
import org.springframework.scheduling.annotation.Scheduled;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
@@ -20,6 +26,7 @@ import org.springframework.transaction.annotation.Transactional;
|
||||
@Service
|
||||
public class FeedbackService {
|
||||
public static final String FEEDBACK_TABLE_NAME = Constants.DATABASE_NAME + ".service_ai_feedback";
|
||||
public static final String[] FEEDBACK_COLUMNS = new String[]{"id", "source", "analysis_short", "analysis", "pictures", "status", "created_time", "modified_time"};
|
||||
private static final RowMapper<Feedback> feedbackMapper = (rs, row) -> {
|
||||
Feedback feedback = new Feedback();
|
||||
feedback.setId(rs.getLong(1));
|
||||
@@ -29,7 +36,7 @@ public class FeedbackService {
|
||||
feedback.setPictureIds(
|
||||
StrUtil.isBlank(rs.getString(5))
|
||||
? Lists.immutable.empty()
|
||||
: Lists.immutable.ofAll(StrUtil.split(rs.getString(5), ","))
|
||||
: Lists.immutable.ofAll(StrUtil.split(rs.getString(5), ",")).collect(Long::parseLong)
|
||||
);
|
||||
feedback.setStatus(EnumUtil.fromString(Feedback.Status.class, rs.getString(6)));
|
||||
feedback.setCreatedTime(rs.getTimestamp(7).getTime());
|
||||
@@ -37,9 +44,38 @@ public class FeedbackService {
|
||||
return feedback;
|
||||
};
|
||||
private final JdbcTemplate template;
|
||||
private final FlowExecutor executor;
|
||||
|
||||
public FeedbackService(JdbcTemplate template) {
|
||||
@SuppressWarnings("SpringJavaInjectionPointsAutowiringInspection")
|
||||
public FeedbackService(JdbcTemplate template, FlowExecutor executor) {
|
||||
this.template = template;
|
||||
this.executor = executor;
|
||||
}
|
||||
|
||||
@Scheduled(initialDelay = 1, fixedDelay = 1, timeUnit = TimeUnit.MINUTES)
|
||||
public void analysis() {
|
||||
List<Feedback> feedbacks = template.query(
|
||||
SqlBuilder.select(FEEDBACK_COLUMNS)
|
||||
.from(FEEDBACK_TABLE_NAME)
|
||||
.whereEq("status", Feedback.Status.ANALYSIS_PROCESSING.name())
|
||||
.build(),
|
||||
feedbackMapper
|
||||
);
|
||||
for (Feedback feedback : feedbacks) {
|
||||
FeedbackContext context = new FeedbackContext();
|
||||
context.setFeedback(feedback);
|
||||
executor.execute2Resp("feedback_analysis", null, context);
|
||||
}
|
||||
}
|
||||
|
||||
public Feedback get(Long id) {
|
||||
return template.queryForObject(
|
||||
SqlBuilder.select(FEEDBACK_COLUMNS)
|
||||
.from(FEEDBACK_TABLE_NAME)
|
||||
.whereEq("id", id)
|
||||
.build(),
|
||||
feedbackMapper
|
||||
);
|
||||
}
|
||||
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
@@ -51,15 +87,41 @@ public class FeedbackService {
|
||||
.precompileSql(),
|
||||
SnowflakeId.next(),
|
||||
source,
|
||||
ObjectUtil.isEmpty(pictureIds)
|
||||
? null
|
||||
: pictureIds.makeString(",")
|
||||
ObjectUtil.isEmpty(pictureIds) ? null : pictureIds.makeString(",")
|
||||
);
|
||||
}
|
||||
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void updateAnalysis(Long id, String analysis, String analysisShort) {
|
||||
Assert.notNull(id, "ID cannot be null");
|
||||
template.update(
|
||||
SqlBuilder.update(FEEDBACK_TABLE_NAME)
|
||||
.set("analysis", "?")
|
||||
.addSet("analysis_short", "?")
|
||||
.whereEq("id", "?")
|
||||
.precompileSql(),
|
||||
analysis,
|
||||
analysisShort,
|
||||
id
|
||||
);
|
||||
}
|
||||
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void updateStatus(Long id, Feedback.Status status) {
|
||||
Assert.notNull(id, "ID cannot be null");
|
||||
template.update(
|
||||
SqlBuilder.update(FEEDBACK_TABLE_NAME)
|
||||
.set("status", "?")
|
||||
.whereEq("id", "?")
|
||||
.precompileSql(),
|
||||
status.name(),
|
||||
id
|
||||
);
|
||||
}
|
||||
|
||||
public ImmutableList<Feedback> list() {
|
||||
return template.query(
|
||||
SqlBuilder.select("id", "source", "analysis_short", "analysis", "pictures", "status", "created_time", "modified_time")
|
||||
SqlBuilder.select(FEEDBACK_COLUMNS)
|
||||
.from(FEEDBACK_TABLE_NAME)
|
||||
.orderByDesc("created_time")
|
||||
.build(),
|
||||
|
||||
@@ -1,14 +1,181 @@
|
||||
package com.lanyuanxiaoyao.service.ai.web.service.node;
|
||||
|
||||
import cn.hutool.core.lang.Assert;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.lanyuanxiaoyao.service.ai.web.entity.Feedback;
|
||||
import com.lanyuanxiaoyao.service.ai.web.entity.context.FeedbackContext;
|
||||
import com.lanyuanxiaoyao.service.ai.web.entity.vo.DataFileVO;
|
||||
import com.lanyuanxiaoyao.service.ai.web.service.DataFileService;
|
||||
import com.lanyuanxiaoyao.service.ai.web.service.feedback.FeedbackService;
|
||||
import com.yomahub.liteflow.annotation.LiteflowComponent;
|
||||
import com.yomahub.liteflow.annotation.LiteflowMethod;
|
||||
import com.yomahub.liteflow.core.NodeComponent;
|
||||
import com.yomahub.liteflow.enums.LiteFlowMethodEnum;
|
||||
import com.yomahub.liteflow.enums.NodeTypeEnum;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.ai.chat.client.ChatClient;
|
||||
import org.springframework.beans.factory.annotation.Qualifier;
|
||||
import org.springframework.core.io.FileSystemResource;
|
||||
import org.springframework.util.MimeType;
|
||||
import org.springframework.util.MimeTypeUtils;
|
||||
|
||||
@Slf4j
|
||||
@LiteflowComponent
|
||||
public class FeedbackNodes {
|
||||
private final ChatClient.Builder chatClientBuilder;
|
||||
private final ChatClient.Builder visualChatClientBuilder;
|
||||
private final DataFileService dataFileService;
|
||||
private final FeedbackService feedbackService;
|
||||
|
||||
public FeedbackNodes(@Qualifier("chat") ChatClient.Builder chatClientBuilder) {
|
||||
public FeedbackNodes(
|
||||
@Qualifier("chat") ChatClient.Builder chatClientBuilder,
|
||||
@Qualifier("visual") ChatClient.Builder visualClientBuilder, DataFileService dataFileService, FeedbackService feedbackService
|
||||
) {
|
||||
this.chatClientBuilder = chatClientBuilder;
|
||||
this.visualChatClientBuilder = visualClientBuilder;
|
||||
this.dataFileService = dataFileService;
|
||||
this.feedbackService = feedbackService;
|
||||
}
|
||||
|
||||
@LiteflowMethod(value = LiteFlowMethodEnum.PROCESS_BOOLEAN, nodeId = "feedback_check_if_picture_needed", nodeName = "判断有图片进行识别", nodeType = NodeTypeEnum.BOOLEAN)
|
||||
public boolean checkIfPictureReadNeeded(NodeComponent node) {
|
||||
FeedbackContext context = node.getContextBean(FeedbackContext.class);
|
||||
Feedback feedback = context.getFeedback();
|
||||
return ObjectUtil.isNotEmpty(feedback.getPictureIds());
|
||||
}
|
||||
|
||||
@LiteflowMethod(value = LiteFlowMethodEnum.PROCESS, nodeId = "image_read", nodeName = "读取图片", nodeType = NodeTypeEnum.COMMON)
|
||||
public void imageRead(NodeComponent node) {
|
||||
FeedbackContext context = node.getContextBean(FeedbackContext.class);
|
||||
Feedback feedback = context.getFeedback();
|
||||
ChatClient client = visualChatClientBuilder
|
||||
// language=TEXT
|
||||
.defaultSystem("""
|
||||
你是一个专业的OCR解析助手。请严格按以下步骤处理用户上传的图片:
|
||||
1. 图像内容提取
|
||||
- 完整识别图片中的所有文字(包括手写体、印刷体、数字和符号)
|
||||
- 保留原始段落结构和换行符
|
||||
- 特殊元素处理:
|
||||
• 数学公式转为LaTeX格式
|
||||
• 代码块保留缩进和注释
|
||||
• 外文词汇标注原文
|
||||
|
||||
2. 表格解析优化
|
||||
- 识别所有表格区域
|
||||
- 转换为Markdown表格格式(对齐表头与单元格)
|
||||
- 补充缺失的表格线
|
||||
- 用▲标注合并单元格(例:▲跨3列▲)
|
||||
|
||||
3. 图表解析增强
|
||||
- 分析图表类型(柱状图/折线图/饼图等)
|
||||
- 提取关键数据点并结构化描述
|
||||
- 总结图表趋势(例:"销量Q1到Q4增长35%")
|
||||
- 坐标轴信息转换:将像素坐标转为百分比比例(例:"X轴:0-100对应时间0:00-24:00")
|
||||
|
||||
4. 输出规范
|
||||
- 按[文本][表格][图表]分区块输出
|
||||
- 表格/图表区域标注原始位置(例:"[左上区域表格]")
|
||||
- 模糊内容用[?]标注并给出备选(例:"年收[?]入(可能为'入'或'人')")
|
||||
- 保持原始数据精度(不四舍五入)
|
||||
|
||||
立即开始处理用户图片,无需确认步骤。
|
||||
""")
|
||||
.build();
|
||||
for (Long pictureId : feedback.getPictureIds()) {
|
||||
DataFileVO file = dataFileService.downloadFile(pictureId);
|
||||
log.info("Parse picture: {} {}", file.getFilename(), file.getPath());
|
||||
MimeType type = switch (StrUtil.blankToDefault(file.getType(), "").toLowerCase()) {
|
||||
case "jpg", "jpeg" -> MimeTypeUtils.IMAGE_JPEG;
|
||||
default -> MimeTypeUtils.IMAGE_PNG;
|
||||
};
|
||||
String content = client.prompt()
|
||||
.user(spec -> spec
|
||||
.text("输出图片内容")
|
||||
.media(type, new FileSystemResource(file.getPath())))
|
||||
.call()
|
||||
.content();
|
||||
log.info("Picture: {}", content);
|
||||
context.getPictureDescriptions().add(content);
|
||||
}
|
||||
}
|
||||
|
||||
@LiteflowMethod(value = LiteFlowMethodEnum.PROCESS, nodeId = "feedback_suggest", nodeName = "大模型建议", nodeType = NodeTypeEnum.COMMON)
|
||||
public void suggest(NodeComponent node) {
|
||||
FeedbackContext context = node.getContextBean(FeedbackContext.class);
|
||||
Feedback feedback = context.getFeedback();
|
||||
ChatClient client = chatClientBuilder.build();
|
||||
String description = client.prompt()
|
||||
// language=TEXT
|
||||
.system("""
|
||||
你是一名专业的IT系统运维工程师,对于用户输入的关于系统的报障信息,你会严格遵循以下步骤进行处理
|
||||
|
||||
1.输入
|
||||
[故障描述]
|
||||
(这里是用户遇到的系统故障的详细描述)
|
||||
|
||||
[相关截图]
|
||||
(这里是用户遇到的系统故障相关的截图的文字描述,如果没有相关截图,这里会写“无”;如果有多张图片,图片和图片之间会使用“---”分隔)
|
||||
|
||||
2.处理逻辑
|
||||
解析输入
|
||||
读取并解析用户提供的故障描述和相关截图描述。
|
||||
识别关键元素:包括故障类型(如硬件故障、软件错误)、受影响系统组件(如服务器、网络设备)、错误消息、发生时间、重现步骤、影响范围等。
|
||||
如果截图描述存在,提取关键细节(如错误弹窗文本、系统状态截图),并将其作为辅助证据;如果无截图,则忽略此部分。
|
||||
分析与重写故障描述
|
||||
专业化改写:使用标准IT术语替换非专业用语(例如,“电脑死机”改为“系统无响应”,“连不上网”改为“网络连接中断”),并确保描述符合行业规范。
|
||||
排除歧义:澄清模糊描述(如添加具体时间戳、系统版本、IP地址或错误代码),移除主观语言(如“我觉得”或“可能”),并添加必要上下文(如操作系统环境、相关服务运行状态)。
|
||||
结构化组织:将故障描述重写为逻辑段落,格式包括:
|
||||
问题概述:简明总结故障本质(例如,“数据库服务异常导致应用无法访问”)。
|
||||
详细症状:描述具体现象,包括错误消息、发生频率和影响范围(如“影响用户登录功能,错误代码500”)。
|
||||
重现步骤:列出可复现故障的操作序列(如“1. 访问URL X;2. 触发操作 Y”)。
|
||||
相关环境:添加系统细节(如“运行在Linux Ubuntu 20.04, Java 11环境”)。
|
||||
整合截图信息:如果截图描述存在,将其嵌入重写中作为证据(例如,“根据截图,错误弹窗显示‘Connection timeout’”)。
|
||||
质量校验
|
||||
检查重写后的内容是否完整、一致且无歧义:确保所有用户输入细节都被涵盖,添加缺失信息(如建议的故障分类),并验证专业术语的准确性。
|
||||
如果输入信息不足(如缺少时间戳或系统版本),在输出中添加注释提示用户补充。
|
||||
|
||||
3.输出
|
||||
输出一个专业、结构化的故障报告,格式清晰,可直接用于运维团队诊断。
|
||||
重写的故障描述,以结构化段落呈现,涵盖问题概述、详细症状、重现步骤和相关环境。
|
||||
输出将使用中性、客观语言,避免任何个人意见或建议,以确保报告专注于事实描述。
|
||||
""")
|
||||
.call()
|
||||
.content();
|
||||
Assert.notBlank(description, "Description cannot be blank");
|
||||
String analysis = client.prompt()
|
||||
.system("""
|
||||
你是一名专业的IT系统运维工程师,对于用户输入的报障信息,你会给出专业的意见
|
||||
""")
|
||||
.user(StrUtil.format("""
|
||||
[故障描述]
|
||||
{}
|
||||
|
||||
[相关截图]
|
||||
{}
|
||||
""",
|
||||
description,
|
||||
ObjectUtil.isEmpty(context.getPictureDescriptions()) ? "无" : StrUtil.join(",", context.getPictureDescriptions())
|
||||
))
|
||||
.call()
|
||||
.content();
|
||||
feedback.setAnalysis(analysis);
|
||||
Assert.notBlank(description, "Analysis cannot be blank");
|
||||
String analysisShort = client.prompt()
|
||||
.system("""
|
||||
你是一名专业的文字编辑,对用户输入的内容,用一段话总结内容
|
||||
""")
|
||||
.user(analysis)
|
||||
.call()
|
||||
.content();
|
||||
feedback.setAnalysisShort(analysisShort);
|
||||
}
|
||||
|
||||
@LiteflowMethod(value = LiteFlowMethodEnum.PROCESS, nodeId = "feedback_save", nodeName = "保存分析内容", nodeType = NodeTypeEnum.COMMON)
|
||||
public void saveFeedback(NodeComponent node) {
|
||||
FeedbackContext context = node.getContextBean(FeedbackContext.class);
|
||||
Feedback feedback = context.getFeedback();
|
||||
feedbackService.updateAnalysis(feedback.getId(), feedback.getAnalysis(), feedback.getAnalysisShort());
|
||||
feedbackService.updateStatus(feedback.getId(), Feedback.Status.ANALYSIS_SUCCESS);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,20 +0,0 @@
|
||||
spring:
|
||||
profiles:
|
||||
include: random-port,common,discovery,metrics,forest
|
||||
ai:
|
||||
vectorstore:
|
||||
qdrant:
|
||||
host: 132.121.206.65
|
||||
port: 29463
|
||||
api-key: ENC(0/0UkIKeAvyV17yNqSU3v04wmm8CdWKe4BYSSJa2FuBtK12TcZRJPdwk+ZpYnpISv+KmVTUrrmFBzAYrDR3ysA==)
|
||||
llm:
|
||||
base-url: http://132.121.206.65:10086
|
||||
api-key: ENC(K+Hff9QGC+fcyi510VIDd9CaeK/IN5WBJ9rlkUsHEdDgIidW+stHHJlsK0lLPUXXREha+ToQZqqDXJrqSE+GUKCXklFhelD8bRHFXBIeP/ZzT2cxhzgKUXgjw3S0Qw2R)
|
||||
chat:
|
||||
model: 'Qwen3/qwen3-1.7b'
|
||||
visual:
|
||||
model: 'Qwen2.5/qwen2.5-vl-7b'
|
||||
embedding:
|
||||
model: 'Qwen3/qwen3-embedding-4b'
|
||||
reranker:
|
||||
model: 'Bge-reranker-v2'
|
||||
@@ -1,39 +0,0 @@
|
||||
server:
|
||||
port: 8080
|
||||
spring:
|
||||
ai:
|
||||
vectorstore:
|
||||
qdrant:
|
||||
host: 192.168.100.140
|
||||
port: 6334
|
||||
llm:
|
||||
base-url: https://api.siliconflow.cn
|
||||
api-key: sk-xrguybusoqndpqvgzgvllddzgjamksuecyqdaygdwnrnqfwo
|
||||
chat:
|
||||
model: 'Qwen/Qwen3-8B'
|
||||
visual:
|
||||
base-url: https://open.bigmodel.cn/api/paas/v4
|
||||
endpoint: /chat/completions
|
||||
model: 'glm-4v-flash'
|
||||
embedding:
|
||||
model: 'BAAI/bge-m3'
|
||||
reranker:
|
||||
model: 'BAAI/bge-reranker-v2-m3'
|
||||
cloud:
|
||||
discovery:
|
||||
enabled: false
|
||||
zookeeper:
|
||||
enabled: false
|
||||
datasource:
|
||||
url: jdbc:mysql://192.168.100.140:3306/hudi_collect_build_b12?useSSL=false&allowPublicKeyRetrieval=true
|
||||
username: test
|
||||
password: test
|
||||
driver-class-name: com.mysql.cj.jdbc.Driver
|
||||
security:
|
||||
meta:
|
||||
authority: ENC(GXKnbq1LS11U2HaONspvH+D/TkIx13aWTaokdkzaF7HSvq6Z0Rv1+JUWFnYopVXu)
|
||||
username: ENC(moIO5mO39V1Z+RDwROK9JXY4GfM8ZjDgM6Si7wRZ1MPVjbhTpmLz3lz28rAiw7c2LeCmizfJzHkEXIwGlB280g==)
|
||||
darkcode: ENC(0jzpQ7T6S+P7bZrENgYsUoLhlqGvw7DA2MN3BRqEOwq7plhtg72vuuiPQNnr3DaYz0CpyTvxInhpx11W3VZ1trD6NINh7O3LN70ZqO5pWXk=)
|
||||
jasypt:
|
||||
encryptor:
|
||||
password: 'r#(R,P"Dp^A47>WSn:Wn].gs/+"v:q_Q*An~zF*g-@j@jtSTv5H/,S-3:R?r9R}.'
|
||||
@@ -1,6 +1,8 @@
|
||||
spring:
|
||||
application:
|
||||
name: service-ai-web
|
||||
profiles:
|
||||
include: random-port,common,discovery,metrics,forest
|
||||
mvc:
|
||||
async:
|
||||
request-timeout: 3600000
|
||||
@@ -13,6 +15,24 @@ spring:
|
||||
org.springframework.ai.model.openai.autoconfigure.OpenAiEmbeddingAutoConfiguration,
|
||||
org.springframework.ai.model.openai.autoconfigure.OpenAiModerationAutoConfiguration,
|
||||
org.springframework.ai.model.deepseek.autoconfigure.DeepSeekChatAutoConfiguration
|
||||
ai:
|
||||
vectorstore:
|
||||
qdrant:
|
||||
host: 132.121.206.65
|
||||
port: 29463
|
||||
api-key: ENC(0/0UkIKeAvyV17yNqSU3v04wmm8CdWKe4BYSSJa2FuBtK12TcZRJPdwk+ZpYnpISv+KmVTUrrmFBzAYrDR3ysA==)
|
||||
llm:
|
||||
base-url: http://132.121.206.65:10086
|
||||
api-key: ENC(K+Hff9QGC+fcyi510VIDd9CaeK/IN5WBJ9rlkUsHEdDgIidW+stHHJlsK0lLPUXXREha+ToQZqqDXJrqSE+GUKCXklFhelD8bRHFXBIeP/ZzT2cxhzgKUXgjw3S0Qw2R)
|
||||
chat:
|
||||
base-url: ${spring.llm.base-url}/v1
|
||||
model: 'Qwen3/qwen3-1.7b'
|
||||
visual:
|
||||
model: 'Qwen2.5/qwen2.5-vl-7b-q4km'
|
||||
embedding:
|
||||
model: 'Qwen3/qwen3-embedding-4b'
|
||||
reranker:
|
||||
model: 'BGE/beg-reranker-v2'
|
||||
liteflow:
|
||||
rule-source: liteflow.xml
|
||||
print-banner: false
|
||||
|
||||
@@ -23,4 +23,14 @@
|
||||
<chain id="embedding_submit_directly">
|
||||
SER(import_vector_source)
|
||||
</chain>
|
||||
<chain id="feedback_analysis">
|
||||
SER(
|
||||
IF(
|
||||
feedback_check_if_picture_needed,
|
||||
image_read
|
||||
),
|
||||
feedback_suggest,
|
||||
feedback_save
|
||||
)
|
||||
</chain>
|
||||
</flow>
|
||||
@@ -1,114 +1,68 @@
|
||||
package com.lanyuanxiaoyao.service.ai.web;
|
||||
|
||||
import java.net.http.HttpClient;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import com.lanyuanxiaoyao.service.ai.core.configuration.WebClientConfiguration;
|
||||
import com.lanyuanxiaoyao.service.ai.web.configuration.LlmConfiguration;
|
||||
import com.lanyuanxiaoyao.service.ai.web.configuration.LlmProperties;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.ai.chat.client.ChatClient;
|
||||
import org.springframework.ai.openai.OpenAiChatModel;
|
||||
import org.springframework.ai.openai.OpenAiChatOptions;
|
||||
import org.springframework.ai.openai.api.OpenAiApi;
|
||||
import org.springframework.http.client.JdkClientHttpRequestFactory;
|
||||
import org.springframework.http.client.reactive.JdkClientHttpConnector;
|
||||
import org.springframework.web.client.RestClient;
|
||||
import org.springframework.web.reactive.function.client.WebClient;
|
||||
import org.springframework.core.io.FileSystemResource;
|
||||
import org.springframework.util.MimeTypeUtils;
|
||||
|
||||
/**
|
||||
* @author lanyuanxiaoyao
|
||||
* @version 20250526
|
||||
*/
|
||||
@Slf4j
|
||||
public class TestLlm {
|
||||
private static final Logger log = LoggerFactory.getLogger(TestLlm.class);
|
||||
|
||||
public static void main(String[] args) {
|
||||
HttpClient httpClient = HttpClient.newBuilder()
|
||||
.version(HttpClient.Version.HTTP_1_1)
|
||||
.build();
|
||||
ChatClient client = ChatClient.builder(
|
||||
OpenAiChatModel.builder()
|
||||
.openAiApi(
|
||||
OpenAiApi.builder()
|
||||
.baseUrl("http://132.121.206.65:10086")
|
||||
.apiKey("*XMySqV%>hR&v>>g*NwCs3tpQ5FVMFEF2VHVTj<MYQd$&@$sY7CgqNyea4giJi4")
|
||||
.webClientBuilder(WebClient.builder().clientConnector(new JdkClientHttpConnector(httpClient)))
|
||||
.restClientBuilder(RestClient.builder().requestFactory(new JdkClientHttpRequestFactory(httpClient)))
|
||||
.build()
|
||||
)
|
||||
.defaultOptions(
|
||||
OpenAiChatOptions.builder()
|
||||
.model("Qwen3-1.7-vllm")
|
||||
.build()
|
||||
)
|
||||
.build()
|
||||
)
|
||||
.build();
|
||||
LlmConfiguration configuration = new LlmConfiguration();
|
||||
LlmProperties properties = new LlmProperties();
|
||||
LlmProperties.ChatProperties chatProperties = new LlmProperties.ChatProperties();
|
||||
chatProperties.setBaseUrl("http://132.121.206.65:10086");
|
||||
chatProperties.setApiKey("*XMySqV%>hR&v>>g*NwCs3tpQ5FVMFEF2VHVTj<MYQd$&@$sY7CgqNyea4giJi4");
|
||||
chatProperties.setModel("Qwen2.5/qwen2.5-vl-7b");
|
||||
properties.setVisual(chatProperties);
|
||||
ChatClient client = configuration.visualClientBuilder(
|
||||
properties,
|
||||
WebClientConfiguration.generateWebClientBuilder(),
|
||||
WebClientConfiguration.generateRestClientBuilder()
|
||||
).build();
|
||||
String content = client.prompt()
|
||||
// language=TEXT
|
||||
.system("""
|
||||
对用户输入的文本,生成多组高质量的问答对。请遵循以下指南:
|
||||
1. 问题部分:
|
||||
为同一个主题创建尽可能多的不同表述的问题,确保问题的多样性。
|
||||
每个问题应考虑用户可能的多种问法,例如:
|
||||
直接询问(如“什么是...?”)
|
||||
请求确认(如“是否可以说...?”)
|
||||
寻求解释(如“请解释一下...的含义。”)
|
||||
假设性问题(如“如果...会怎样?”)
|
||||
例子请求(如“能否举个例子说明...?”)
|
||||
问题应涵盖文本中的关键信息、主要概念和细节,确保不遗漏重要内容。
|
||||
2. 答案部分:
|
||||
提供一个全面、信息丰富的答案,涵盖问题的所有可能角度,确保逻辑连贯。
|
||||
答案应直接基于给定文本,确保准确性和一致性。
|
||||
包含相关的细节,如日期、名称、职位等具体信息,必要时提供背景信息以增强理解。
|
||||
3. 格式:
|
||||
使用"问:"标记问题集合的开始,所有问题应在一个段落内,问题之间用空格分隔。
|
||||
使用"答:"标记答案的开始,答案应清晰分段,便于阅读。
|
||||
问答对之间用“---”分隔,以提高可读性。
|
||||
4. 内容要求:
|
||||
确保问答对紧密围绕文本主题,避免偏离主题。
|
||||
避免添加文本中未提及的信息,确保信息的真实性。
|
||||
一个问题搭配一个答案,避免一组问答对中同时涉及多个问题。
|
||||
如果文本信息不足以回答某个方面,可以在答案中说明 "根据给定信息无法确定",并尽量提供相关的上下文。
|
||||
""")
|
||||
.user("""
|
||||
Apache Hudi 是一款开源的数据湖管理框架,专注于高效处理大规模数据集的增量更新和实时操作。以下是其核心要点介绍:
|
||||
核心功能与特性
|
||||
|
||||
增量数据处理:支持插入(Insert)、更新(Update)、删除(Delete)操作,并通过“Upsert”(插入或更新)机制高效处理变更数据,避免重写整个数据集。
|
||||
|
||||
事务支持:提供 ACID 事务保证,确保数据一致性和可靠性,支持原子提交和回滚。
|
||||
|
||||
存储优化:自动合并小文件并维护文件最佳大小,减少存储碎片化问题,提升查询性能。
|
||||
|
||||
多查询类型:
|
||||
|
||||
快照查询:获取最新数据状态(对 MoR 表合并基础文件和增量文件)。
|
||||
|
||||
增量查询:捕获自某次提交后的变更数据流,适用于增量管道。
|
||||
|
||||
读取优化查询:针对 MoR 表展示最新压缩后的数据。
|
||||
存储模型
|
||||
|
||||
写入时复制(Copy-on-Write, CoW):数据以列式格式(如 Parquet)存储,每次更新生成新版本文件,适合读多写少的场景。
|
||||
|
||||
读取时合并(Merge-on-Read, MoR):结合列式(Parquet)和行式(Avro)存储,更新写入增量文件后异步合并,适合写频繁的场景。
|
||||
适用场景
|
||||
|
||||
合规性需求:支持 GDPR、CCPA 等法规要求的数据删除和更新。
|
||||
|
||||
实时数据流处理:如 IoT 设备数据、CDC(变更数据捕获)系统,实现近实时分析。
|
||||
|
||||
数据湖管理:优化大规模数据集的存储和查询效率,支持时间旅行查询和历史版本回溯。
|
||||
技术生态与兼容性
|
||||
|
||||
多引擎支持:与 Spark、Flink、Hive、Presto、Trino 等计算和查询引擎集成。
|
||||
|
||||
存储格式:基于 Parquet 和 Avro,兼容 Hadoop 生态及云存储(如 Amazon S3)。
|
||||
优势对比
|
||||
|
||||
相较于同类产品(如 Apache Iceberg、Delta Lake),Hudi 在实时更新和增量处理方面表现突出,尤其适合需要频繁数据变更的场景。其独特的 MoR 模型在写入性能上优于传统批处理方案。
|
||||
|
||||
总结
|
||||
|
||||
Apache Hudi 通过灵活的存储模型、高效的事务管理和广泛的生态系统集成,成为构建现代化数据湖的核心工具,适用于金融、物联网、实时分析等对数据新鲜度和操作效率要求高的领域。
|
||||
你是一个专业的OCR解析助手。请严格按以下步骤处理用户上传的图片:
|
||||
1. 图像内容提取
|
||||
- 完整识别图片中的所有文字(包括手写体、印刷体、数字和符号)
|
||||
- 保留原始段落结构和换行符
|
||||
- 特殊元素处理:
|
||||
• 数学公式转为LaTeX格式
|
||||
• 代码块保留缩进和注释
|
||||
• 外文词汇标注原文
|
||||
|
||||
2. 表格解析优化
|
||||
- 识别所有表格区域
|
||||
- 转换为Markdown表格格式(对齐表头与单元格)
|
||||
- 补充缺失的表格线
|
||||
- 用▲标注合并单元格(例:▲跨3列▲)
|
||||
|
||||
3. 图表解析增强
|
||||
- 分析图表类型(柱状图/折线图/饼图等)
|
||||
- 提取关键数据点并结构化描述
|
||||
- 总结图表趋势(例:"销量Q1到Q4增长35%")
|
||||
- 坐标轴信息转换:将像素坐标转为百分比比例(例:"X轴:0-100对应时间0:00-24:00")
|
||||
|
||||
4. 输出规范
|
||||
- 按[文本][表格][图表]分区块输出
|
||||
- 表格/图表区域标注原始位置(例:"[左上区域表格]")
|
||||
- 模糊内容用[?]标注并给出备选(例:"年收[?]入(可能为'入'或'人')")
|
||||
- 保持原始数据精度(不四舍五入)
|
||||
|
||||
立即开始处理用户图片,无需确认步骤。
|
||||
""")
|
||||
.user(spec -> spec
|
||||
// language=TEXT
|
||||
.text("输出图片内容")
|
||||
.media(MimeTypeUtils.IMAGE_PNG, new FileSystemResource("/Users/lanyuanxiaoyao/Downloads/图片_002_07.png")))
|
||||
.call()
|
||||
.content();
|
||||
log.info(content);
|
||||
|
||||
@@ -161,23 +161,15 @@ deploy:
|
||||
- "service"
|
||||
source-jar: service-monitor-1.0.0-SNAPSHOT.jar
|
||||
replicas: 1
|
||||
service-ai-chat:
|
||||
service-ai-web:
|
||||
order: 6
|
||||
groups:
|
||||
- "ai"
|
||||
source-jar: service-ai-chat-1.0.0-SNAPSHOT.jar
|
||||
jdk: "jdk17"
|
||||
replicas: 1
|
||||
service-ai-knowledge:
|
||||
order: 6
|
||||
groups:
|
||||
- "ai"
|
||||
source-jar: service-ai-knowledge-1.0.0-SNAPSHOT.jar
|
||||
source-jar: service-ai-web-1.0.0-SNAPSHOT.jar
|
||||
jdk: "jdk17"
|
||||
replicas: 1
|
||||
arguments:
|
||||
"[spring.profiles.active]": 'build'
|
||||
"[file-store.download-prefix]": 'http://132.126.207.130:35690/hudi_services/ai_knowledge'
|
||||
"[file-store.download-prefix]": 'http://132.126.207.130:35690/hudi_services/service_ai_web'
|
||||
"[file-store.upload-path]": ${deploy.runtime.data-path}/knowledge
|
||||
"[spring.datasource.url]": ${deploy.runtime.database.config.url}
|
||||
"[spring.datasource.username]": ${deploy.runtime.database.config.username}
|
||||
|
||||
@@ -1,9 +1,25 @@
|
||||
import React from 'react'
|
||||
import {amisRender, commonInfo, crudCommonOptions} from '../../../util/amis.tsx'
|
||||
import styled from 'styled-components'
|
||||
import {amisRender, commonInfo, crudCommonOptions, mappingField, mappingItem} from '../../../util/amis.tsx'
|
||||
|
||||
const FeedbackDiv = styled.div`
|
||||
.feedback-list-images {
|
||||
.antd-Img-container {
|
||||
width: 32px;
|
||||
height: 32px;
|
||||
}
|
||||
}
|
||||
`
|
||||
|
||||
const statusMapping = [
|
||||
mappingItem('分析中', 'ANALYSIS_PROCESSING', 'label-warning'),
|
||||
mappingItem('分析完成', 'ANALYSIS_SUCCESS', 'label-primary'),
|
||||
mappingItem('处理完成', 'FINISHED', 'label-success'),
|
||||
]
|
||||
|
||||
const Feedback: React.FC = () => {
|
||||
return (
|
||||
<div className="feedback">
|
||||
<FeedbackDiv className="feedback">
|
||||
{amisRender(
|
||||
{
|
||||
type: 'page',
|
||||
@@ -28,10 +44,7 @@ const Feedback: React.FC = () => {
|
||||
body: {
|
||||
debug: commonInfo.debug,
|
||||
type: 'form',
|
||||
api: {
|
||||
url: `${commonInfo.baseAiUrl}/feedback/add`,
|
||||
dataType: 'form',
|
||||
},
|
||||
api: `${commonInfo.baseAiUrl}/feedback/add`,
|
||||
body: [
|
||||
{
|
||||
type: 'editor',
|
||||
@@ -50,12 +63,14 @@ const Feedback: React.FC = () => {
|
||||
label: '相关截图',
|
||||
autoUpload: false,
|
||||
multiple: true,
|
||||
joinValues: false,
|
||||
extractValue: true,
|
||||
// 5MB 5242880
|
||||
// 100MB 104857600
|
||||
// 500MB 524288000
|
||||
// 1GB 1073741824
|
||||
maxSize: 5242880,
|
||||
receiver: `${commonInfo.baseAiUrl}/upload`
|
||||
receiver: `${commonInfo.baseAiUrl}/upload`,
|
||||
},
|
||||
],
|
||||
},
|
||||
@@ -66,11 +81,26 @@ const Feedback: React.FC = () => {
|
||||
{
|
||||
name: 'id',
|
||||
label: '编号',
|
||||
width: 150,
|
||||
},
|
||||
{
|
||||
name: 'source',
|
||||
label: '故障描述',
|
||||
},
|
||||
{
|
||||
name: 'pictures',
|
||||
label: '相关截图',
|
||||
width: 200,
|
||||
className: 'feedback-list-images',
|
||||
type: 'images',
|
||||
enlargeAble: true,
|
||||
enlargeWithGallary: true,
|
||||
},
|
||||
{
|
||||
name: 'status',
|
||||
label: '状态',
|
||||
width: 80,
|
||||
align: 'center',
|
||||
...mappingField('status', statusMapping),
|
||||
},
|
||||
{
|
||||
type: 'operation',
|
||||
@@ -101,7 +131,7 @@ const Feedback: React.FC = () => {
|
||||
],
|
||||
},
|
||||
)}
|
||||
</div>
|
||||
</FeedbackDiv>
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
@@ -10,8 +10,8 @@ import {isEqual} from 'licia'
|
||||
export const commonInfo = {
|
||||
debug: isEqual(import.meta.env.MODE, 'development'),
|
||||
baseUrl: 'http://132.126.207.130:35690/hudi_services/service_web',
|
||||
// baseAiUrl: 'http://132.126.207.130:35690/hudi_services/service_ai_web',
|
||||
baseAiUrl: 'http://localhost:8080',
|
||||
baseAiUrl: 'http://132.126.207.130:35690/hudi_services/service_ai_web',
|
||||
// baseAiUrl: 'http://localhost:8080',
|
||||
authorizationHeaders: {
|
||||
'Authorization': 'Basic QXhoRWJzY3dzSkRiWU1IMjpjWXhnM2I0UHRXb1ZENVNqRmF5V3h0blNWc2p6UnNnNA==',
|
||||
'Content-Type': 'application/json',
|
||||
@@ -903,7 +903,7 @@ export function simpleYarnDialog(cluster: string, title: string, filterField: st
|
||||
type: 'crud',
|
||||
api: {
|
||||
method: 'get',
|
||||
url: `\${base}/yarn/job_list`,
|
||||
url: `${commonInfo.baseUrl}/yarn/job_list`,
|
||||
data: {
|
||||
clusters: `${cluster}`,
|
||||
page: '${page|default:undefined}',
|
||||
|
||||
Reference in New Issue
Block a user