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