Skip to content

Commit

Permalink
fix: start problem
Browse files Browse the repository at this point in the history
  • Loading branch information
Angular2Guy committed Jul 7, 2024
1 parent 4737eb3 commit 2fb6032
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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")
Expand All @@ -46,11 +37,6 @@ public ApplicationConfig(OpenLibraryClient openLibraryClient) {
// return new TransformersEmbeddingClient();
// }

@Bean
public Function<OpenLibraryClient.Request, OpenLibraryClient.Response> openLibraryClient() {
return this.openLibraryClient::apply;
}

@Bean
public RestClient createRestClient() {
RequestConfig requestConfig = RequestConfig.custom().setResponseTimeout(Timeout.ofMilliseconds(5000)).build();
Expand Down
Original file line number Diff line number Diff line change
@@ -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.Request, OpenLibraryClient.Response> openLibraryClient() {
return this.openLibraryClient::apply;
}
}

0 comments on commit 2fb6032

Please sign in to comment.