|
@@ -9,6 +9,7 @@ import com.tzld.longarticle.recommend.server.util.MapBuilder;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
import okhttp3.*;
|
|
import okhttp3.*;
|
|
|
import org.apache.http.util.TextUtils;
|
|
import org.apache.http.util.TextUtils;
|
|
|
|
|
+import org.springframework.beans.factory.annotation.Value;
|
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
|
|
import javax.annotation.PostConstruct;
|
|
import javax.annotation.PostConstruct;
|
|
@@ -22,6 +23,9 @@ public class DeepSeekApiService {
|
|
|
|
|
|
|
|
private OkHttpClient client;
|
|
private OkHttpClient client;
|
|
|
|
|
|
|
|
|
|
+ @Value("${deepseek.default.model:deepseek-v4-flash}")
|
|
|
|
|
+ private String defaultModel;
|
|
|
|
|
+
|
|
|
@PostConstruct
|
|
@PostConstruct
|
|
|
public void init() {
|
|
public void init() {
|
|
|
client = new OkHttpClient().newBuilder()
|
|
client = new OkHttpClient().newBuilder()
|
|
@@ -48,7 +52,7 @@ public class DeepSeekApiService {
|
|
|
|
|
|
|
|
Map<Object, Object> bodyParam = MapBuilder
|
|
Map<Object, Object> bodyParam = MapBuilder
|
|
|
.builder()
|
|
.builder()
|
|
|
- .put("model", Optional.ofNullable(model).orElse("deepseek-chat"))
|
|
|
|
|
|
|
+ .put("model", Optional.ofNullable(model).orElse(defaultModel))
|
|
|
.put("temperature", Optional.ofNullable(temperature).orElse(0.3))
|
|
.put("temperature", Optional.ofNullable(temperature).orElse(0.3))
|
|
|
.put("messages", jsonArray)
|
|
.put("messages", jsonArray)
|
|
|
.build();
|
|
.build();
|