Skip to content

Commit

Permalink
feat: add client
Browse files Browse the repository at this point in the history
  • Loading branch information
Angular2Guy committed Jul 7, 2024
1 parent 55f71a8 commit a6033b1
Show file tree
Hide file tree
Showing 3 changed files with 61 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
/**
* 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.client;

import java.util.List;

import org.springframework.stereotype.Component;
import org.springframework.web.client.RestClient;

import ch.xxx.aidoclibchat.domain.model.dto.GithubClient;

@Component
public class GithubRestClient implements GithubClient {
private final RestClient restClient;

public GithubRestClient(RestClient restClient) {
this.restClient = restClient;
}

public List<String> readSourceFile(String baseUrl, String url) {
var result = this.restClient.get().uri("{baseUrl}{url}", baseUrl, url).retrieve().body(String.class);
return result.lines().toList();
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
/**
* 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.domain.model.dto;

import java.util.List;

public interface GithubClient {
public static final String GITHUB_BASE_URL = "https://raw.githubusercontent.com";

List<String> readSourceFile(String baseUrl, String url);
}
7 changes: 6 additions & 1 deletion backend/src/main/resources/application-ollama.properties
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,9 @@ spring.ai.ollama.chat.model=stable-beluga:13b
#spring.ai.ollama.chat.options.num-thread=8
#spring.ai.ollama.chat.options.keep_alive=1s

#spring.ai.ollama.embedding.options.model=mxbai-embed-large:335m #test with Spring AI 1.0
#spring.ai.ollama.embedding.options.model=mxbai-embed-large:335m #test with Spring AI 1.0

# generate code
#spring.ai.ollama.chat.model=granite-code:20b
#spring.ai.ollama.chat.options.num-thread=8
#spring.ai.ollama.chat.options.keep_alive=1s

0 comments on commit a6033b1

Please sign in to comment.