mirror of
https://gitee.com/huangge1199_admin/vue-pro.git
synced 2024-11-30 03:01:53 +08:00
修改 client 构造方法,制定传入 QianWenOptions
This commit is contained in:
parent
7a785b1ec0
commit
6415422f7d
@ -34,15 +34,15 @@ public class QianWenChatClient implements ChatClient, StreamingChatClient {
|
|||||||
|
|
||||||
private QianWenApi qianWenApi;
|
private QianWenApi qianWenApi;
|
||||||
|
|
||||||
private ChatOptions chatOptions;
|
private QianWenOptions qianWenOptions;
|
||||||
|
|
||||||
public QianWenChatClient(QianWenApi qianWenApi) {
|
public QianWenChatClient(QianWenApi qianWenApi) {
|
||||||
this.qianWenApi = qianWenApi;
|
this.qianWenApi = qianWenApi;
|
||||||
}
|
}
|
||||||
|
|
||||||
public QianWenChatClient(QianWenApi qianWenApi, ChatOptions chatOptions) {
|
public QianWenChatClient(QianWenApi qianWenApi, QianWenOptions qianWenOptions) {
|
||||||
this.qianWenApi = qianWenApi;
|
this.qianWenApi = qianWenApi;
|
||||||
this.chatOptions = chatOptions;
|
this.qianWenOptions = qianWenOptions;
|
||||||
}
|
}
|
||||||
|
|
||||||
public final RetryTemplate retryTemplate = RetryTemplate.builder()
|
public final RetryTemplate retryTemplate = RetryTemplate.builder()
|
||||||
@ -81,11 +81,11 @@ public class QianWenChatClient implements ChatClient, StreamingChatClient {
|
|||||||
|
|
||||||
private CompletionsRequest createRequest(Prompt prompt, boolean stream) {
|
private CompletionsRequest createRequest(Prompt prompt, boolean stream) {
|
||||||
// 两个都为null 则没有配置文件
|
// 两个都为null 则没有配置文件
|
||||||
if (chatOptions == null && prompt.getOptions() == null) {
|
if (qianWenOptions == null && prompt.getOptions() == null) {
|
||||||
throw new ChatException("ChatOptions 未配置参数!");
|
throw new ChatException("ChatOptions 未配置参数!");
|
||||||
}
|
}
|
||||||
// 优先使用 Prompt 里面的 ChatOptions
|
// 优先使用 Prompt 里面的 ChatOptions
|
||||||
ChatOptions options = chatOptions;
|
ChatOptions options = qianWenOptions;
|
||||||
if (prompt.getOptions() != null) {
|
if (prompt.getOptions() != null) {
|
||||||
options = (ChatOptions) prompt.getOptions();
|
options = (ChatOptions) prompt.getOptions();
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user