WARNING: THIS SITE IS A MIRROR OF GITHUB.COM / IT CANNOT LOGIN OR REGISTER ACCOUNTS / THE CONTENTS ARE PROVIDED AS-IS / THIS SITE ASSUMES NO RESPONSIBILITY FOR ANY DISPLAYED CONTENT OR LINKS / IF YOU FOUND SOMETHING MAY NOT GOOD FOR EVERYONE, CONTACT ADMIN AT ilovescratch@foxmail.com
Skip to content

[Question] DashScopeChatModel使用call方法高频超时问题 #3331

@smile-shark

Description

@smile-shark

Question

现在只要是使用到了call方法来进行接收,那么必然会出现这个超时的问题,DashScopeApi使用RestClientFactory构造RestClient也没有办法手动的设置超时时间,在使用某些类时,比如FactCheckingEvaluator评估器,其中内置使用call方法调用,虽然可以重写这个方法,但是还是不希望重复造轮子

2025-12-04T10:47:07.101+08:00 WARN 5068 --- [ main] o.s.a.r.a.SpringAiRetryAutoConfiguration : Retry error. Retry count: 1, Exception: I/O error on POST request for "https://dashscope.aliyuncs.com/api/v1/services/aigc/text-generation/generation": timeout

org.springframework.web.client.ResourceAccessException: I/O error on POST request for "https://dashscope.aliyuncs.com/api/v1/services/aigc/text-generation/generation": timeout
at org.springframework.web.client.DefaultRestClient$DefaultRequestBodyUriSpec.createResourceAccessException(DefaultRestClient.java:586) ~[spring-web-6.1.21.jar:6.1.21]
at org.springframework.web.client.DefaultRestClient$DefaultRequestBodyUriSpec.exchangeInternal(DefaultRestClient.java:500) ~[spring-web-6.1.21.jar:6.1.21]
at org.springframework.web.client.DefaultRestClient$DefaultRequestBodyUriSpec.retrieve(DefaultRestClient.java:456) ~[spring-web-6.1.21.jar:6.1.21]
at com.alibaba.cloud.ai.dashscope.api.DashScopeApi.chatCompletionEntity(DashScopeApi.java:1666) ~[spring-ai-alibaba-core-1.0.0.4.jar:1.0.0.4]

我尝试别人的建议添加了以下配置:
spring:
http:
client:
read-timeout: 60s
并且在代码中做了耗时统计:
long l = System.currentTimeMillis();
try {
EvaluationResponse evaluate = factCheckingEvaluator.evaluate(evaluationRequest);
System.out.println("evaluate = " + evaluate);
} catch (Exception e) {
System.out.println(e.getMessage());
}
System.out.println("耗时:" + (System.currentTimeMillis() - l));
最后结果还是不尽人意:
I/O error on POST request for "https://dashscope.aliyuncs.com/api/v1/services/aigc/text-generation/generation": timeout
耗时:10138

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions