File tree Expand file tree Collapse file tree 4 files changed +32
-10
lines changed Expand file tree Collapse file tree 4 files changed +32
-10
lines changed Original file line number Diff line number Diff line change 12
12
*/
13
13
package ch .xxx .aidoclibchat .adapter .client ;
14
14
15
- import java .util .List ;
15
+ import java .util .Arrays ;
16
16
17
17
import org .springframework .stereotype .Component ;
18
18
import org .springframework .web .client .RestClient ;
19
19
20
20
import ch .xxx .aidoclibchat .domain .model .dto .GithubClient ;
21
+ import ch .xxx .aidoclibchat .domain .model .dto .GithubSource ;
21
22
22
23
@ Component
23
24
public class GithubRestClient implements GithubClient {
24
25
private final RestClient restClient ;
25
-
26
+
26
27
public GithubRestClient (RestClient restClient ) {
27
28
this .restClient = restClient ;
28
29
}
29
-
30
- public List < String > readSourceFile (String baseUrl , String url ) {
30
+
31
+ public GithubSource readSourceFile (String baseUrl , String url ) {
31
32
var result = this .restClient .get ().uri ("{baseUrl}{url}" , baseUrl , url ).retrieve ().body (String .class );
32
- return result .lines ().toList ();
33
+ var sourceName = Arrays .asList (url .split ("/" )).reversed ().get (0 ).split ("." )[0 ].trim ();
34
+ var resultLines = result .lines ().toList ();
35
+ var sourcePackage = resultLines .stream ().filter (myLine -> myLine .contains ("package" )).findFirst ().orElseThrow ()
36
+ .split (" " )[1 ].split (";" )[0 ].trim ();
37
+ return new GithubSource (sourceName , sourcePackage , resultLines );
33
38
}
34
39
}
Original file line number Diff line number Diff line change 12
12
*/
13
13
package ch .xxx .aidoclibchat .domain .model .dto ;
14
14
15
- import java .util .List ;
16
-
17
15
public interface GithubClient {
18
16
public static final String GITHUB_BASE_URL = "https://raw.githubusercontent.com" ;
19
17
20
- List < String > readSourceFile (String baseUrl , String url );
18
+ GithubSource readSourceFile (String baseUrl , String url );
21
19
}
Original file line number Diff line number Diff line change
1
+ /**
2
+ * Copyright 2023 Sven Loesekann
3
+ Licensed under the Apache License, Version 2.0 (the "License");
4
+ you may not use this file except in compliance with the License.
5
+ You may obtain a copy of the License at
6
+ http://www.apache.org/licenses/LICENSE-2.0
7
+ Unless required by applicable law or agreed to in writing, software
8
+ distributed under the License is distributed on an "AS IS" BASIS,
9
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10
+ See the License for the specific language governing permissions and
11
+ limitations under the License.
12
+ */
13
+ package ch .xxx .aidoclibchat .domain .model .dto ;
14
+
15
+ import java .util .List ;
16
+
17
+ public record GithubSource (String sourceName , String sourcePackage , List <String > lines ) {
18
+
19
+ }
Original file line number Diff line number Diff line change @@ -13,7 +13,7 @@ spring.liquibase.change-log=classpath:/dbchangelog/db.changelog-master-ollama.xm
13
13
# falcon model config free production use
14
14
# spring.ai.ollama.chat.model=falcon:40b
15
15
# beluga model config only for non production/commercial use
16
- spring.ai.ollama.chat.model =stable-beluga:13b
16
+ # spring.ai.ollama.chat.model=stable-beluga:13b
17
17
18
18
# function calling
19
19
# spring.ai.ollama.chat.model=mixtral:8x7b-text-v0.1-q6_K
@@ -26,6 +26,6 @@ spring.ai.ollama.chat.model=stable-beluga:13b
26
26
# spring.ai.ollama.embedding.options.model=mxbai-embed-large:335m #test with Spring AI 1.0
27
27
28
28
# generate code
29
- # spring.ai.ollama.chat.model=granite-code:20b
29
+ spring.ai.ollama.chat.model =granite-code:20b
30
30
# spring.ai.ollama.chat.options.num-thread=8
31
31
# spring.ai.ollama.chat.options.keep_alive=1s
You can’t perform that action at this time.
0 commit comments