mirror of
https://github.com/ritonioz/minecraft-ai-companion-mod-EMVs12-Project.git
synced 2026-03-17 23:00:20 +01:00
changed german t0 english
This commit is contained in:
@@ -29,18 +29,18 @@ public class AiChatScreen extends Screen {
|
|||||||
protected void init() {
|
protected void init() {
|
||||||
inputField = new TextFieldWidget(
|
inputField = new TextFieldWidget(
|
||||||
textRenderer, width / 2 - 150, height - 35, 270, 20,
|
textRenderer, width / 2 - 150, height - 35, 270, 20,
|
||||||
Text.literal("Nachricht...")
|
Text.literal("Message...")
|
||||||
);
|
);
|
||||||
inputField.setMaxLength(500);
|
inputField.setMaxLength(500);
|
||||||
inputField.setFocused(true);
|
inputField.setFocused(true);
|
||||||
addDrawableChild(inputField);
|
addDrawableChild(inputField);
|
||||||
|
|
||||||
addDrawableChild(ButtonWidget.builder(Text.literal("Senden"), btn -> sendMessage())
|
addDrawableChild(ButtonWidget.builder(Text.literal("Send"), btn -> sendMessage())
|
||||||
.dimensions(width / 2 + 125, height - 35, 60, 20)
|
.dimensions(width / 2 + 125, height - 35, 60, 20)
|
||||||
.build()
|
.build()
|
||||||
);
|
);
|
||||||
|
|
||||||
addDrawableChild(ButtonWidget.builder(Text.literal("Schließen"), btn -> close())
|
addDrawableChild(ButtonWidget.builder(Text.literal("Close"), btn -> close())
|
||||||
.dimensions(width / 2 - 30, height - 10, 60, 15)
|
.dimensions(width / 2 - 30, height - 10, 60, 15)
|
||||||
.build()
|
.build()
|
||||||
);
|
);
|
||||||
@@ -61,9 +61,9 @@ public class AiChatScreen extends Screen {
|
|||||||
inputField.setText("");
|
inputField.setText("");
|
||||||
|
|
||||||
displayLines().add("§eIch: §f" + msg);
|
displayLines().add("§eIch: §f" + msg);
|
||||||
displayLines().add("§7[AI denkt nach...]");
|
displayLines().add("§7[AI thinking about...]");
|
||||||
session.sendMessage(msg, response -> {
|
session.sendMessage(msg, response -> {
|
||||||
displayLines().remove("§7[AI denkt nach...]");
|
displayLines().remove("§7[AI thinking about...]");
|
||||||
displayLines().add("§6AI: §f" + response);
|
displayLines().add("§6AI: §f" + response);
|
||||||
// auto-scroll to bottom
|
// auto-scroll to bottom
|
||||||
scrollOffset = 0;
|
scrollOffset = 0;
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ public class AiChatSession {
|
|||||||
this.apiBaseUrl = apiBaseUrl;
|
this.apiBaseUrl = apiBaseUrl;
|
||||||
this.apiKey = apiKey;
|
this.apiKey = apiKey;
|
||||||
this.model = model;
|
this.model = model;
|
||||||
displayLines.add("§7Starte eine Unterhaltung mit deinem AI-Begleiter!");
|
displayLines.add("§7Start a conversation with your AI companion!");
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<String> getDisplayLines() {
|
public List<String> getDisplayLines() {
|
||||||
@@ -37,7 +37,7 @@ public class AiChatSession {
|
|||||||
history.add(new String[]{"assistant", response});
|
history.add(new String[]{"assistant", response});
|
||||||
onResponse.accept(response);
|
onResponse.accept(response);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
onResponse.accept("§cFehler: " + e.getMessage());
|
onResponse.accept("§cError: " + e.getMessage());
|
||||||
}
|
}
|
||||||
}).start();
|
}).start();
|
||||||
}
|
}
|
||||||
@@ -118,9 +118,9 @@ public class AiChatSession {
|
|||||||
|
|
||||||
private String formatHttpError(int status, String body, String path) {
|
private String formatHttpError(int status, String body, String path) {
|
||||||
if (body == null || body.isBlank()) {
|
if (body == null || body.isBlank()) {
|
||||||
return "Fehler: HTTP " + status + " (" + path + ")";
|
return "Error: HTTP " + status + " (" + path + ")";
|
||||||
}
|
}
|
||||||
return "Fehler: HTTP " + status + " (" + path + ") - " + body;
|
return "Error: HTTP " + status + " (" + path + ") - " + body;
|
||||||
}
|
}
|
||||||
|
|
||||||
private String jsonEscape(String value) {
|
private String jsonEscape(String value) {
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ public class ApiKeyScreen extends Screen {
|
|||||||
private final Runnable onSuccess;
|
private final Runnable onSuccess;
|
||||||
|
|
||||||
public ApiKeyScreen(Runnable onSuccess) {
|
public ApiKeyScreen(Runnable onSuccess) {
|
||||||
super(Text.literal("API Key eingeben"));
|
super(Text.literal("Enter API Key"));
|
||||||
this.onSuccess = onSuccess;
|
this.onSuccess = onSuccess;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -27,7 +27,7 @@ public class ApiKeyScreen extends Screen {
|
|||||||
keyField.setFocused(true);
|
keyField.setFocused(true);
|
||||||
addDrawableChild(keyField);
|
addDrawableChild(keyField);
|
||||||
|
|
||||||
addDrawableChild(ButtonWidget.builder(Text.literal("Bestätigen"), btn -> confirm())
|
addDrawableChild(ButtonWidget.builder(Text.literal("Confirm"), btn -> confirm())
|
||||||
.dimensions(width / 2 - 75, height / 2 + 20, 150, 20)
|
.dimensions(width / 2 - 75, height / 2 + 20, 150, 20)
|
||||||
.build()
|
.build()
|
||||||
);
|
);
|
||||||
@@ -57,9 +57,9 @@ public class ApiKeyScreen extends Screen {
|
|||||||
public void render(DrawContext context, int mouseX, int mouseY, float delta) {
|
public void render(DrawContext context, int mouseX, int mouseY, float delta) {
|
||||||
renderBackground(context);
|
renderBackground(context);
|
||||||
context.drawCenteredTextWithShadow(textRenderer,
|
context.drawCenteredTextWithShadow(textRenderer,
|
||||||
"§6Bitte gib deinen Open-WebUI API Key ein:", width / 2, height / 2 - 30, 0xFFFFFF);
|
"§6Please enter your Open WebUI API key:", width / 2, height / 2 - 30, 0xFFFFFF);
|
||||||
context.drawCenteredTextWithShadow(textRenderer,
|
context.drawCenteredTextWithShadow(textRenderer,
|
||||||
"§7(Wird lokal gespeichert, nur einmalig nötig)", width / 2, height / 2 - 20, 0xAAAAAA);
|
"§7(Stored locally, only required once.)", width / 2, height / 2 - 20, 0xAAAAAA);
|
||||||
super.render(context, mouseX, mouseY, delta);
|
super.render(context, mouseX, mouseY, delta);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -33,7 +33,7 @@ public class ClientConfig {
|
|||||||
apiKey = loadApiKeyFrom(CONFIG_PATH);
|
apiKey = loadApiKeyFrom(CONFIG_PATH);
|
||||||
}
|
}
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
System.out.println("[aicompanion2_0] Konnte Client-Config nicht laden.");
|
System.out.println("[aicompanion2_0] Could not load Client Config.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -42,7 +42,7 @@ public class ClientConfig {
|
|||||||
saveApiKeyTo(CONFIG_PATH, "AI Companion Client Config");
|
saveApiKeyTo(CONFIG_PATH, "AI Companion Client Config");
|
||||||
saveApiKeyTo(SHARED_CONFIG_PATH, "AI Companion Shared Config");
|
saveApiKeyTo(SHARED_CONFIG_PATH, "AI Companion Shared Config");
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
System.out.println("[aicompanion2_0] Konnte Client-Config nicht speichern.");
|
System.out.println("[aicompanion2_0] Could not save Client Config.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -68,7 +68,7 @@ public class Aicompanion2_0 implements ModInitializer {
|
|||||||
companion.setOwner(player);
|
companion.setOwner(player);
|
||||||
companion.setTamed(true);
|
companion.setTamed(true);
|
||||||
player.getWorld().spawnEntity(companion);
|
player.getWorld().spawnEntity(companion);
|
||||||
player.sendMessage(Text.literal("§6[AI] §fBegleiter wurde gerufen!"), false);
|
player.sendMessage(Text.literal("§6[AI] §fThe companion has been called!"), false);
|
||||||
}
|
}
|
||||||
return 1;
|
return 1;
|
||||||
})
|
})
|
||||||
@@ -90,7 +90,7 @@ public class Aicompanion2_0 implements ModInitializer {
|
|||||||
|
|
||||||
final int removedCount = removed;
|
final int removedCount = removed;
|
||||||
ctx.getSource().sendFeedback(
|
ctx.getSource().sendFeedback(
|
||||||
() -> Text.literal("§6[AI] §fBegleiter entfernt: " + removedCount), false);
|
() -> Text.literal("§6[AI] §fCompanion removed: " + removedCount), false);
|
||||||
return 1;
|
return 1;
|
||||||
})
|
})
|
||||||
)
|
)
|
||||||
@@ -104,7 +104,7 @@ public class Aicompanion2_0 implements ModInitializer {
|
|||||||
|
|
||||||
if (player != null) {
|
if (player != null) {
|
||||||
player.sendMessage(
|
player.sendMessage(
|
||||||
Text.literal("§6[AI] §fDenke nach über: " + frage), false);
|
Text.literal("§6[AI] §fThink about: " + frage), false);
|
||||||
}
|
}
|
||||||
|
|
||||||
new Thread(() -> {
|
new Thread(() -> {
|
||||||
@@ -115,14 +115,14 @@ public class Aicompanion2_0 implements ModInitializer {
|
|||||||
if (player != null) {
|
if (player != null) {
|
||||||
String finalAntwort = antwort;
|
String finalAntwort = antwort;
|
||||||
server.execute(() -> player.sendMessage(
|
server.execute(() -> player.sendMessage(
|
||||||
Text.literal("§6[AI] §fAntwort: " + finalAntwort), false));
|
Text.literal("§6[AI] §fAnswer: " + finalAntwort), false));
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
if (player != null) {
|
if (player != null) {
|
||||||
String error = e.getMessage() != null ? e.getMessage() : e.getClass().getSimpleName();
|
String error = e.getMessage() != null ? e.getMessage() : e.getClass().getSimpleName();
|
||||||
server.execute(() -> player.sendMessage(
|
server.execute(() -> player.sendMessage(
|
||||||
Text.literal("§c[AI] Fehler bei /ai question: " + error), false));
|
Text.literal("§c[AI] Error with /ai question: " + error), false));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}).start();
|
}).start();
|
||||||
|
|||||||
Reference in New Issue
Block a user