llm config fix

This commit is contained in:
Chuck1sn
2025-05-25 18:17:50 +08:00
parent b6f72942ad
commit 402c421370
8 changed files with 42 additions and 2 deletions

View File

@@ -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;

View File

@@ -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())

View File

@@ -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);
}