File tree Expand file tree Collapse file tree 2 files changed +22
-3
lines changed
java/ch/xxx/aidoclibchat/adapter/client Expand file tree Collapse file tree 2 files changed +22
-3
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 org .slf4j .Logger ;
16
+ import org .slf4j .LoggerFactory ;
17
+ import org .springframework .beans .factory .annotation .Value ;
15
18
import org .springframework .stereotype .Component ;
16
19
import org .springframework .web .client .RestClient ;
17
20
18
21
@ Component
19
22
public class TmdbRestClient {
20
- private static final String BASE_URL = "get https://api.themoviedb.org/3/" ;
23
+ private static final Logger LOG = LoggerFactory .getLogger (TmdbRestClient .class );
24
+ private static final String BASE_URL = "https://api.themoviedb.org/3/" ;
21
25
private final RestClient restClient ;
26
+ @ Value ("${tmdb.api.key:}" )
27
+ private String apiKey ;
22
28
23
29
public TmdbRestClient (RestClient restClient ) {
24
30
this .restClient = restClient ;
25
31
}
32
+
33
+ public void searchMovie (String query ) {
34
+ var url = BASE_URL + "search/movie?query=" + query ;
35
+ var response = restClient .get ()
36
+ .uri (url )
37
+ .header ("accept" , "application/json" )
38
+ .header ("Authorization" , "Bearer " +this .apiKey )
39
+ .retrieve ()
40
+ .body (String .class );
41
+ LOG .info ("Response from TMDB: {}" , response );
42
+ }
43
+
26
44
}
Original file line number Diff line number Diff line change @@ -26,7 +26,7 @@ spring.servlet.multipart.max-request-size=15MB
26
26
spring.servlet.multipart.resolve-lazily =true
27
27
28
28
spring.jackson.parser.allow-unquoted-control-chars =true
29
- spring.ai.openai.api-key =${OPENAI-API-KEY:23418pajkfdsadlöa }
29
+ spring.ai.openai.api-key =${OPENAI-API-KEY:23418pajkfdsadl�a }
30
30
spring.ai.embedding.transformer.enabled =false
31
31
spring.ai.ollama.embedding.enabled =false
32
32
@@ -40,4 +40,5 @@ management.endpoint.health.show-details=always
40
40
embedding-token-limit =2000
41
41
document-token-limit =2000
42
42
image.result-size =20
43
- openlibrary.result-size =5
43
+ openlibrary.result-size =5
44
+ tmdb.api.key =${TMDB_API_KEY:}
You can’t perform that action at this time.
0 commit comments