add ai chat deepseek
This commit is contained in:
20
src/test/java/com/newyetai/DeepSeekTest.java
Normal file
20
src/test/java/com/newyetai/DeepSeekTest.java
Normal 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);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user