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 1212 */
1313package ch .xxx .aidoclibchat .adapter .client ;
1414
15+ import org .slf4j .Logger ;
16+ import org .slf4j .LoggerFactory ;
17+ import org .springframework .beans .factory .annotation .Value ;
1518import org .springframework .stereotype .Component ;
1619import org .springframework .web .client .RestClient ;
1720
1821@ Component
1922public 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/" ;
2125 private final RestClient restClient ;
26+ @ Value ("${tmdb.api.key:}" )
27+ private String apiKey ;
2228
2329 public TmdbRestClient (RestClient restClient ) {
2430 this .restClient = restClient ;
2531 }
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+
2644}
Original file line number Diff line number Diff line change @@ -26,7 +26,7 @@ spring.servlet.multipart.max-request-size=15MB
2626spring.servlet.multipart.resolve-lazily =true
2727
2828spring.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 }
3030spring.ai.embedding.transformer.enabled =false
3131spring.ai.ollama.embedding.enabled =false
3232
@@ -40,4 +40,5 @@ management.endpoint.health.show-details=always
4040embedding-token-limit =2000
4141document-token-limit =2000
4242image.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