zuul ollama
This commit is contained in:
@@ -147,36 +147,24 @@ public class Game
|
||||
}
|
||||
|
||||
String commandWord = command.getCommandWord();
|
||||
if (commandWord.equals("help")) {
|
||||
printHelp();
|
||||
}
|
||||
else if (commandWord.equals("go")) {
|
||||
goRoom(command);
|
||||
}
|
||||
else if (commandWord.equals("quit")) {
|
||||
wantToQuit = quit(command);
|
||||
}
|
||||
else if (commandWord.equals("look")) {
|
||||
look(player.getCurrentRoom());
|
||||
}
|
||||
else if (commandWord.equals("status")) {
|
||||
showStatus();
|
||||
}
|
||||
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();
|
||||
switch (commandWord) {
|
||||
case "help" -> printHelp();
|
||||
case "go" -> goRoom(command);
|
||||
case "quit" -> wantToQuit = quit(command);
|
||||
case "look" -> look(player.getCurrentRoom());
|
||||
case "status" -> showStatus();
|
||||
case "take" -> takeItem(command);
|
||||
case "drop" -> dropItem(command);
|
||||
case "say" -> {
|
||||
if (command.hasSecondWord()) {
|
||||
if (command.getSecondWord().equals("health")) {
|
||||
Ollama.status();
|
||||
} else {
|
||||
Ollama.chat(command.getSecondWord(), player);
|
||||
}
|
||||
} 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;
|
||||
|
||||
public class Ollama {
|
||||
public void spit() {
|
||||
System.out.println("The ollama spits at you.");
|
||||
}
|
||||
public static void chat(String message, Player player) {
|
||||
|
||||
public String say() {
|
||||
return "The ollama says: \"Hello!\"";
|
||||
}
|
||||
|
||||
public static void chat(String message, Room room) {
|
||||
|
||||
|
||||
room.getLongDescription();
|
||||
Room room = player.getCurrentRoom();
|
||||
|
||||
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}";
|
||||
|
||||
|
||||
Reference in New Issue
Block a user