

解决了,模型手动下载下来,方式如下:

模型下载不下来的话,可以手动下载
@Configuration
public class ModelConfig {
// 配置使用本地模型而不是远程URL
@Bean
public TransformersEmbeddingModel transformersEmbeddingModel() {
TransformersEmbeddingModel model = new TransformersEmbeddingModel();
// 使用本地文件路径替代远程URL
model.setModelResource("model.onnx");
return model;
}
}
@SpringBootApplication(exclude = {OpenAiEmbeddingAutoConfiguration.class})
public class Client2Application {
public static void main(String[] args) {
// 加载.env文件
Dotenv dotenv = Dotenv.configure().ignoreIfMissing().load();
// 把.env文件中的变量设置到环境变量中
dotenv.entries().forEach(entry -> System.setProperty(entry.getKey(), entry.getValue()));
SpringApplication.run(Client2Application.class, args);
}
}不加的话
exclude = {OpenAiEmbeddingAutoConfiguration.class}会有这个问题
