add ai chat deepseek

This commit is contained in:
ran.shang
2025-07-07 10:51:42 +08:00
parent c6a46b62cc
commit cd3aaea259
10 changed files with 238 additions and 3 deletions

View File

@@ -0,0 +1,20 @@
package com.newyetai;
import com.newyetai.common.AlitaResult;
import com.newyetai.sdk.common.util.HttpUtils;
import com.newyetai.sdk.deepseek.service.DeepSeekProvider;
import com.newyetai.sdk.xf.model.ChatReq;
import com.newyetai.sdk.xf.model.MessageDTO;
import lombok.extern.slf4j.Slf4j;
import org.junit.jupiter.api.Test;
@Slf4j
public class DeepSeekTest {
@Test
public void chat(){
AlitaResult result = DeepSeekProvider.httpChat(ChatReq.builder().model("deepseek-chat").message(MessageDTO.builder().role("user").content("讲个故事").build()).build(), "");
log.info("{}", result);
}
}

View File

@@ -51,6 +51,7 @@ public class SparkTest {
.iatHostUrl("https://iat-api.xfyun.cn/v2/iat")
.ttsHostUrl("https://tts-api.xfyun.cn/v2/tts")
.otsHostUrl("https://ntrans.xfyun.cn/v2/ots")
.httpAPIPassword("EfqszvaEEoTnUfQRRcvr:ohEYAwzpIiUeWFvZAqEk")
.appId("83b8ddca")
.apiSecret("ZWE2MjkzY2VmZDkwM2EwZGJhNGRhOWJm")
.apiKey("e092f93e28ebe6d27f756bb2d884dcff")
@@ -185,7 +186,7 @@ public class SparkTest {
@Test
public void iat() throws IOException {
String file = "src/main/resources/iat/file.mp3";
String file = "src/main/resources/iat/cn.pcm";
try(InputStream is = new FileInputStream(file)){
AlitaResult<String> result = WebIATWS.execute(is, xfProperties);
log.info("{}", result);
@@ -239,4 +240,16 @@ public class SparkTest {
}
}
@Test
public void chat(){
ChatReq req = ChatReq.builder().message(MessageDTO.builder().role("system").content(
"你是一位专业的简历分析专家。目标任务:请根据我给出的信息,分析得出简历信息。不要自己填充json信息")
.role("user").content("我是大学生")
.build()).build();
AlitaResult<String> result = XfSparkProvider.httpChat(req, xfProperties.getHttpAPIPassword());
Assert.isTrue(result.getSuccess(), result.getMsg());
log.info("{}", result);
}
}