Skip to content

Commit 86e7995

Browse files
committed
feat:新增超时时间ofSeconds配置项
1 parent 102ed79 commit 86e7995

File tree

3 files changed

+4
-1
lines changed

3 files changed

+4
-1
lines changed

src/main/java/com/ashin/client/GptClient.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ public void init() {
3939
for (String apiKey : gptConfig.getApiKey()) {
4040
apiKey = apiKey.trim();
4141
if (!apiKey.isEmpty()) {
42-
openAiServiceList.add(new OpenAiService(apiKey, Duration.ofSeconds(1000)));
42+
openAiServiceList.add(new OpenAiService(apiKey, Duration.ofSeconds(gptConfig.getOfSeconds())));
4343
log.info("apiKey为 {} 的账号初始化成功", apiKey);
4444
}
4545
}

src/main/java/com/ashin/config/GptConfig.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,4 +21,5 @@ public class GptConfig {
2121
private Double temperature;
2222
private List<String> basicPrompt;
2323
private List<String> apiKey;
24+
private Long ofSeconds;
2425
}

src/main/resources/application.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@ gpt:
1414
maxToken: 2048
1515
# 信息熵 越高回答越随机(Higher values like 0.8 will make the output more random, while lower values like 0.2 will make it more focused and deterministic.---via OPENAI)
1616
temperature: 0.5
17+
# 最大请求时间 超时自动中断请求
18+
ofSeconds: 10000
1719
# 基础提问 支持多个提问 可用来设定人格(对应api中的system角色)
1820
basicPrompt:
1921
- "用中文回答我的问题"

0 commit comments

Comments
 (0)