Compare commits
No commits in common. "f29ec8f5c26f95760e50c9d3c98966ca3651e24e" and "84aa5fdf3e0c337b70688af7a2ad45ff8fa66561" have entirely different histories.
f29ec8f5c2
...
84aa5fdf3e
3 changed files with 17 additions and 10 deletions
|
@ -22,6 +22,6 @@ steps:
|
|||
dockerfile: Dockerfile
|
||||
target: setup-image
|
||||
repo: rg.fr-par.scw.cloud/hamburghammer/dchat/setup-image
|
||||
tag: ${CI_PIPELINE_NUMBER}
|
||||
tag: ${CI_PIPELINE_PARENT}
|
||||
pull_image: false
|
||||
platforms: ${PLATFORM}
|
||||
|
|
|
@ -6,17 +6,24 @@ import com.fasterxml.jackson.annotation.JsonProperty;
|
|||
import java.util.List;
|
||||
|
||||
@JsonIgnoreProperties(ignoreUnknown = true)
|
||||
public record ChatGPTResponse(Usage usage,
|
||||
List<Choice> choices) {
|
||||
public record ChatGPTResponse(String id,
|
||||
String object,
|
||||
long created,
|
||||
String model,
|
||||
Usage usage,
|
||||
List<Choice> choices,
|
||||
@JsonProperty("system_fingerprint") String systemFingerprint) {
|
||||
|
||||
@JsonIgnoreProperties(ignoreUnknown = true)
|
||||
public record Usage(@JsonProperty("prompt_tokens") int promptTokens,
|
||||
@JsonProperty("completion_tokens") int completionTokens,
|
||||
@JsonProperty("total_tokens") int totalTokens) {
|
||||
}
|
||||
|
||||
@JsonIgnoreProperties(ignoreUnknown = true)
|
||||
public record Choice(Message message) {
|
||||
@JsonIgnoreProperties(ignoreUnknown = true)
|
||||
public record Choice(Message message, @JsonProperty("finish_reason") String finishReason, int index) {
|
||||
public record Message(String role, String content) {
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -18,10 +18,10 @@ import java.util.List;
|
|||
import java.util.concurrent.Callable;
|
||||
import java.util.concurrent.Executors;
|
||||
|
||||
public final class App {
|
||||
public class App {
|
||||
private static final Logger logger = LoggerFactory.getLogger(App.class);
|
||||
|
||||
public static void main(final String[] args) {
|
||||
public static void main(String[] args) {
|
||||
final String discordApiKey = System.getenv("DISCORD_API_KEY");
|
||||
if (discordApiKey == null) {
|
||||
logger.error("Missing environment variables: DISCORD_API_KEY");
|
||||
|
@ -63,12 +63,12 @@ public final class App {
|
|||
}
|
||||
}
|
||||
|
||||
private static void run(final Runnable... apps) throws InterruptedException {
|
||||
final List<Callable<Void>> callableApps = Arrays.stream(apps).sequential().map(runnable -> (Callable<Void>) () -> {
|
||||
private static void run(Runnable... apps) throws InterruptedException {
|
||||
List<Callable<Void>> callableApps = Arrays.stream(apps).sequential().map(runnable -> (Callable<Void>) () -> {
|
||||
runnable.run();
|
||||
return null;
|
||||
}).toList();
|
||||
try (final var executorService = Executors.newFixedThreadPool(apps.length)) {
|
||||
try (var executorService = Executors.newFixedThreadPool(apps.length)) {
|
||||
executorService.invokeAll(callableApps);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue