mirror of
https://github.com/ccmjga/zhilu-admin
synced 2026-03-14 05:33:42 +08:00
llm config fix
This commit is contained in:
@@ -12,6 +12,8 @@ public class LlmVm {
|
||||
|
||||
@NotEmpty(message = "模型名称不能为空") private String modelName;
|
||||
|
||||
@NotEmpty(message = "模型类型不能为空") private String type;
|
||||
|
||||
@NotEmpty(message = "apikey 不能为空") private String apiKey;
|
||||
|
||||
@NotEmpty(message = "url 不能为空") private String url;
|
||||
|
||||
@@ -26,7 +26,8 @@ public class LlmRepository extends AiLlmConfigDao {
|
||||
public Result<Record> pageFetchBy(PageRequestDto pageRequestDto, LlmQueryDto llmQueryDto) {
|
||||
return ctx()
|
||||
.select(
|
||||
AI_LLM_CONFIG.asterisk(), DSL.count().over().as("total_llm").convertFrom(Long::valueOf))
|
||||
AI_LLM_CONFIG.asterisk(),
|
||||
DSL.count().over().as("total_llm").convertFrom(Long::valueOf))
|
||||
.from(AI_LLM_CONFIG)
|
||||
.where(
|
||||
StringUtils.isNotEmpty(llmQueryDto.name())
|
||||
|
||||
@@ -18,6 +18,8 @@ import org.jooq.generated.mjga.tables.pojos.AiLlmConfig;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import static org.jooq.generated.mjga.Tables.AI_LLM_CONFIG;
|
||||
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
@Slf4j
|
||||
@@ -42,7 +44,11 @@ public class LlmService {
|
||||
if (records.isEmpty()) {
|
||||
return PageResponseDto.empty();
|
||||
}
|
||||
List<LlmVm> llmVms = records.into(LlmVm.class);
|
||||
List<LlmVm> llmVms = records.map((record) -> {
|
||||
LlmVm into = record.into(LlmVm.class);
|
||||
into.setType(record.get(AI_LLM_CONFIG.TYPE).getLiteral());
|
||||
return into;
|
||||
});
|
||||
Long totalLlm = records.get(0).getValue("total_llm", Long.class);
|
||||
return new PageResponseDto<>(totalLlm, llmVms);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user