zuul ollama
This commit is contained in:
@@ -147,36 +147,24 @@ public class Game
|
|||||||
}
|
}
|
||||||
|
|
||||||
String commandWord = command.getCommandWord();
|
String commandWord = command.getCommandWord();
|
||||||
if (commandWord.equals("help")) {
|
switch (commandWord) {
|
||||||
printHelp();
|
case "help" -> printHelp();
|
||||||
}
|
case "go" -> goRoom(command);
|
||||||
else if (commandWord.equals("go")) {
|
case "quit" -> wantToQuit = quit(command);
|
||||||
goRoom(command);
|
case "look" -> look(player.getCurrentRoom());
|
||||||
}
|
case "status" -> showStatus();
|
||||||
else if (commandWord.equals("quit")) {
|
case "take" -> takeItem(command);
|
||||||
wantToQuit = quit(command);
|
case "drop" -> dropItem(command);
|
||||||
}
|
case "say" -> {
|
||||||
else if (commandWord.equals("look")) {
|
if (command.hasSecondWord()) {
|
||||||
look(player.getCurrentRoom());
|
if (command.getSecondWord().equals("health")) {
|
||||||
}
|
Ollama.status();
|
||||||
else if (commandWord.equals("status")) {
|
} else {
|
||||||
showStatus();
|
Ollama.chat(command.getSecondWord(), player);
|
||||||
}
|
}
|
||||||
else if (commandWord.equals("take")) {
|
|
||||||
takeItem(command);
|
|
||||||
}
|
|
||||||
else if (commandWord.equals("drop")) {
|
|
||||||
dropItem(command);
|
|
||||||
}
|
|
||||||
else if (commandWord.equals("say")) {
|
|
||||||
if (command.hasSecondWord()) {
|
|
||||||
if (command.getSecondWord().equals("health")) {
|
|
||||||
Ollama.status();
|
|
||||||
} else {
|
} else {
|
||||||
Ollama.chat(command.getSecondWord(), player.getCurrentRoom());
|
System.out.println("Chat what?");
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
System.out.println("Chat what?");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -6,21 +6,12 @@ import java.net.http.HttpRequest;
|
|||||||
import java.net.http.HttpResponse;
|
import java.net.http.HttpResponse;
|
||||||
|
|
||||||
public class Ollama {
|
public class Ollama {
|
||||||
public void spit() {
|
public static void chat(String message, Player player) {
|
||||||
System.out.println("The ollama spits at you.");
|
|
||||||
}
|
|
||||||
|
|
||||||
public String say() {
|
Room room = player.getCurrentRoom();
|
||||||
return "The ollama says: \"Hello!\"";
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void chat(String message, Room room) {
|
|
||||||
|
|
||||||
|
|
||||||
room.getLongDescription();
|
|
||||||
|
|
||||||
String model = "llama3.1";
|
String model = "llama3.1";
|
||||||
String system = "You are a NPC in my game World of Zuul and the character kann chat with you please answer short. Here is the room description of the current room: " + room.getLongDescription().replace("\n", " ") + ".";
|
String system = "You are an NPC and your name is GPTdaya please grate the player every time he interacts with you in my game World of Zuul. The character can chat with you. Please provide short answers. Here is the room description: " + room.getLongDescription().replace("\n", " ") + ". Here is the Player description: " + player.showStatus().replace("\n", " ") + ".";
|
||||||
|
|
||||||
String body = "{\"model\": \"" + model + "\", \"messages\": [{\"role\": \"system\", \"content\": \"" + system + "\"}, {\"role\": \"user\", \"content\": \"" + message + "\"}], \"stream\": false}";
|
String body = "{\"model\": \"" + model + "\", \"messages\": [{\"role\": \"system\", \"content\": \"" + system + "\"}, {\"role\": \"user\", \"content\": \"" + message + "\"}], \"stream\": false}";
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user