From 2fb603207ce0a07dc758b1e6ea242cff333f6d7f Mon Sep 17 00:00:00 2001 From: Angular2guy Date: Sun, 7 Jul 2024 11:56:43 +0200 Subject: [PATCH] fix: start problem --- .../adapter/config/ApplicationConfig.java | 14 ------- .../adapter/config/FunctionConfig.java | 37 +++++++++++++++++++ 2 files changed, 37 insertions(+), 14 deletions(-) create mode 100644 backend/src/main/java/ch/xxx/aidoclibchat/adapter/config/FunctionConfig.java diff --git a/backend/src/main/java/ch/xxx/aidoclibchat/adapter/config/ApplicationConfig.java b/backend/src/main/java/ch/xxx/aidoclibchat/adapter/config/ApplicationConfig.java index 0e486cc..dd8c2e1 100644 --- a/backend/src/main/java/ch/xxx/aidoclibchat/adapter/config/ApplicationConfig.java +++ b/backend/src/main/java/ch/xxx/aidoclibchat/adapter/config/ApplicationConfig.java @@ -15,8 +15,6 @@ */ package ch.xxx.aidoclibchat.adapter.config; -import java.util.function.Function; - import org.apache.hc.client5.http.config.RequestConfig; import org.apache.hc.client5.http.impl.classic.CloseableHttpClient; import org.apache.hc.client5.http.impl.classic.HttpClientBuilder; @@ -27,17 +25,10 @@ import org.springframework.scheduling.annotation.EnableAsync; import org.springframework.web.client.RestClient; -import ch.xxx.aidoclibchat.domain.client.OpenLibraryClient; - @Configuration @EnableAsync public class ApplicationConfig { - private final OpenLibraryClient openLibraryClient; - - public ApplicationConfig(OpenLibraryClient openLibraryClient) { - this.openLibraryClient = openLibraryClient; - } // @Primary // @Profile("ollama") @@ -46,11 +37,6 @@ public ApplicationConfig(OpenLibraryClient openLibraryClient) { // return new TransformersEmbeddingClient(); // } - @Bean - public Function openLibraryClient() { - return this.openLibraryClient::apply; - } - @Bean public RestClient createRestClient() { RequestConfig requestConfig = RequestConfig.custom().setResponseTimeout(Timeout.ofMilliseconds(5000)).build(); diff --git a/backend/src/main/java/ch/xxx/aidoclibchat/adapter/config/FunctionConfig.java b/backend/src/main/java/ch/xxx/aidoclibchat/adapter/config/FunctionConfig.java new file mode 100644 index 0000000..b323b06 --- /dev/null +++ b/backend/src/main/java/ch/xxx/aidoclibchat/adapter/config/FunctionConfig.java @@ -0,0 +1,37 @@ +/** + * Copyright 2023 Sven Loesekann + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + */ +package ch.xxx.aidoclibchat.adapter.config; + +import java.util.function.Function; + +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; + +import ch.xxx.aidoclibchat.domain.client.OpenLibraryClient; + +@Configuration +public class FunctionConfig { + private final OpenLibraryClient openLibraryClient; + + public FunctionConfig(OpenLibraryClient openLibraryClient) { + this.openLibraryClient = openLibraryClient; + } + + @Bean + public Function openLibraryClient() { + return this.openLibraryClient::apply; + } +}