AI:code review chat 部分的代码(qianwen)

This commit is contained in:
YunaiV 2024-04-09 00:10:36 +08:00
parent 29dc77fc0d
commit a44628e436
8 changed files with 18 additions and 2 deletions

View File

@ -11,6 +11,7 @@ public interface ErrorCodeConstants {
// ========== 模块 ai 错误码区间 [1-022-000-000 ~ 1-023-000-000) ========== // ========== 模块 ai 错误码区间 [1-022-000-000 ~ 1-023-000-000) ==========
// TODO @fansili1类注释不太对2中英文之间有个空格例如说 AI 模型
ErrorCode AI_MODULE_NOT_SUPPORTED = new ErrorCode(1_022_000_000, "AI模型暂不支持!"); ErrorCode AI_MODULE_NOT_SUPPORTED = new ErrorCode(1_022_000_000, "AI模型暂不支持!");
} }

View File

@ -2,6 +2,7 @@ package cn.iocoder.yudao.module.ai.enums;
import lombok.Getter; import lombok.Getter;
// TODO @fansili1类注释要加下2author time javadoc@author @since3@AllArgsConstructor 使用这个注解去掉构造方法4value 改成 model 字段然后注释都写下哈5message 改成 name然后注释都写下哈
/** /**
* author: fansili * author: fansili
* time: 2024/3/4 12:36 * time: 2024/3/4 12:36
@ -19,7 +20,9 @@ public enum AiModelEnum {
this.message = message; this.message = message;
} }
// TODO @fan
private String value; private String value;
private String message; private String message;
} }

View File

@ -26,6 +26,7 @@ import reactor.core.publisher.Flux;
import java.util.Scanner; import java.util.Scanner;
import java.util.function.Consumer; import java.util.function.Consumer;
// TODO @fansili有了 swagger 注释就不用类注释了
/** /**
* AI模块 * AI模块
* *

View File

@ -5,6 +5,7 @@ import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.NotNull; import jakarta.validation.constraints.NotNull;
import lombok.Data; import lombok.Data;
// TODO @fansili 1swagger 注释不太对2有了 swagger 注释就不用类注释了
/** /**
* ai 聊天 req * ai 聊天 req
* *

View File

@ -1,4 +1,4 @@
# open ai # open ai TODO @fansili??????????????
# openAI https://openai.com/ # openAI https://openai.com/
spring.ai.openai.api-key=${OPEN_AI_KEY} spring.ai.openai.api-key=${OPEN_AI_KEY}

View File

@ -9,6 +9,7 @@ import org.springframework.http.HttpStatusCode;
import org.springframework.http.ResponseEntity; import org.springframework.http.ResponseEntity;
import reactor.core.publisher.Flux; import reactor.core.publisher.Flux;
// TODO @fansili是不是挪到 api 包里按照 spring ai 的结构根目录只放 client options
/** /**
* 阿里 通义千问 * 阿里 通义千问
* *

View File

@ -29,7 +29,7 @@ import java.util.stream.Collectors;
* time: 2024/3/13 21:06 * time: 2024/3/13 21:06
*/ */
@Slf4j @Slf4j
public class QianWenChatClient implements ChatClient, StreamingChatClient { public class QianWenChatClient implements ChatClient, StreamingChatClient {
private QianWenApi qianWenApi; private QianWenApi qianWenApi;
@ -44,6 +44,7 @@ public class QianWenChatClient implements ChatClient, StreamingChatClient {
this.qianWenOptions = qianWenOptions; this.qianWenOptions = qianWenOptions;
} }
// TODO @fansili看看咋公用出来允许传入类似异常之类的参数
public final RetryTemplate retryTemplate = RetryTemplate.builder() public final RetryTemplate retryTemplate = RetryTemplate.builder()
// 最大重试次数 10 // 最大重试次数 10
.maxAttempts(10) .maxAttempts(10)

View File

@ -1,5 +1,13 @@
/** /**
* author: fansili * author: fansili
* time: 2024/3/12 20:29 * time: 2024/3/12 20:29
*
* 1. org.springframework.ai包括 chatimagemodelparserutil 部分
*
* 2. yudao.framework.models
* \qianwen 通义千问
* \yiyan 文心一言
* \xinghuo 星火
* \midjourney
*/ */
package cn.iocoder.yudao.framework.ai; package cn.iocoder.yudao.framework.ai;