Task 4.1: 包名统一重构 - 重命名 41 个 Java 文件的包名 - 更新所有 import 语句 - 恢复枚举类(FaultCategory、DiagnosisStatus、SourceType) - 更新测试类的 import 重构范围: - domain/entity: 3 个实体类 - domain/model: 2 个数据类 - domain/enums: 3 个枚举类 - repository: 3 个接口 - service/session: 2 个类(接口 + 实现) - config: 9 个配置类 - controller: 2 个控制器 - agent/tool: 4 个工具类 - client: 1 个客户端 - Main.java: 主类 验证结果: - 编译成功,无错误 - 所有测试通过 (27/27) - ApiDocumentRepositoryTest: 7/7 ✅ - CaseLibraryRepositoryTest: 6/6 ✅ - DiagnosisRecordRepositoryTest: 6/6 ✅ - RedisSessionManagerTest: 8/8 ✅ Progress: 21/33 tasks completed (64%)
41 lines
1.3 KiB
Java
41 lines
1.3 KiB
Java
package com.superbiz.agent.config;
|
|
|
|
import okhttp3.OkHttpClient;
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
import org.springframework.context.annotation.Bean;
|
|
import org.springframework.context.annotation.Configuration;
|
|
import org.springframework.http.client.OkHttp3ClientHttpRequestFactory;
|
|
import org.springframework.web.client.RestClient;
|
|
|
|
import java.time.Duration;
|
|
|
|
/**
|
|
* DashScope API 配置
|
|
* 用于配置超时时间等参数
|
|
*/
|
|
@Configuration
|
|
public class DashScopeConfig {
|
|
|
|
@Value("${spring.ai.dashscope.chat.options.timeout:180000}")
|
|
private long timeout;
|
|
|
|
/**
|
|
* 配置 RestClient.Builder,设置超时时间
|
|
* Spring AI 会自动使用这个 Bean
|
|
*/
|
|
@Bean
|
|
public RestClient.Builder restClientBuilder() {
|
|
// 创建自定义的 OkHttpClient,设置超时时间
|
|
OkHttpClient okHttpClient = new OkHttpClient.Builder()
|
|
.connectTimeout(Duration.ofMillis(timeout))
|
|
.readTimeout(Duration.ofMillis(timeout))
|
|
.writeTimeout(Duration.ofMillis(timeout))
|
|
.callTimeout(Duration.ofMillis(timeout))
|
|
.build();
|
|
|
|
// 创建 RestClient.Builder 并配置 OkHttpClient
|
|
return RestClient.builder()
|
|
.requestFactory(new OkHttp3ClientHttpRequestFactory(okHttpClient));
|
|
}
|
|
}
|