Clean up OpenRouterService
This commit is contained in:
@@ -45,8 +45,6 @@ public class OpenRouterService {
|
|||||||
.uri(URI.create(OPENROUTER_URL))
|
.uri(URI.create(OPENROUTER_URL))
|
||||||
.header("Content-Type", "application/json")
|
.header("Content-Type", "application/json")
|
||||||
.header("Authorization", "Bearer " + apiKey)
|
.header("Authorization", "Bearer " + apiKey)
|
||||||
.header("HTTP-Referer", "https://petshop.local")
|
|
||||||
.header("X-Title", "Leon's Pet Store AI Assistant")
|
|
||||||
.POST(HttpRequest.BodyPublishers.ofString(requestBody))
|
.POST(HttpRequest.BodyPublishers.ofString(requestBody))
|
||||||
.timeout(Duration.ofSeconds(60))
|
.timeout(Duration.ofSeconds(60))
|
||||||
.build();
|
.build();
|
||||||
@@ -64,11 +62,6 @@ public class OpenRouterService {
|
|||||||
Thread.currentThread().interrupt();
|
Thread.currentThread().interrupt();
|
||||||
throw new RuntimeException("AI request was interrupted", e);
|
throw new RuntimeException("AI request was interrupted", e);
|
||||||
}
|
}
|
||||||
|
|
||||||
catch (RuntimeException e) {
|
|
||||||
throw e;
|
|
||||||
}
|
|
||||||
|
|
||||||
catch (Exception e) {
|
catch (Exception e) {
|
||||||
throw new RuntimeException("Failed to call OpenRouter API: " + e.getMessage(), e);
|
throw new RuntimeException("Failed to call OpenRouter API: " + e.getMessage(), e);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user