基于spring ai实现dashscope,openpi的chat client
This commit is contained in:
parent
91914407ec
commit
9b90abf8e8
@ -40,7 +40,7 @@ public class AiChatModelService {
|
||||
|
||||
private final AiModelClientFactory aiModelClientFactory;
|
||||
|
||||
public ChatResponse chatMessage(String scenarioCode, Object params){
|
||||
public ChatResponse chatMessage(String scenarioCode, Object prompt){
|
||||
AiScenarioConfigEntity scenarioConfig = aiScenarioConfigService.getOneByScenarioCode(scenarioCode);
|
||||
log.info("scenarioConfig:{}", scenarioConfig);
|
||||
|
||||
@ -53,8 +53,7 @@ public class AiChatModelService {
|
||||
ChatModel chatModel = client.createChatModel(modelConfig).orElseThrow(() -> new CommonException(ResultCodeEnum.AI_MODEL_NOT_FOUND));
|
||||
|
||||
Optional<ChatOptions> options = client.createChatOptions(BeanUtil.beanToMap(scenarioConfig));
|
||||
Prompt prompt = new Prompt(params.toString(), options.orElse(null));
|
||||
return chatModel.call(prompt);
|
||||
return chatModel.call(new Prompt(prompt.toString(), options.orElse(null)));
|
||||
}
|
||||
|
||||
public Flux<ChatResponse> chatStream(String scenarioCode, Object params){
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user