From edbe7b1823ba6cb93812c7088c53e63d85680e6e Mon Sep 17 00:00:00 2001 From: WDRshadow Date: Wed, 27 Mar 2024 20:39:46 +0100 Subject: [PATCH] update: add search group function to default. --- src/main/java/com/jackdaw/chatwithnpc/npc/NPCEntity.java | 3 ++- .../java/com/jackdaw/chatwithnpc/npc/NPCEntityManager.java | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/main/java/com/jackdaw/chatwithnpc/npc/NPCEntity.java b/src/main/java/com/jackdaw/chatwithnpc/npc/NPCEntity.java index 48c6abf..6fd2305 100644 --- a/src/main/java/com/jackdaw/chatwithnpc/npc/NPCEntity.java +++ b/src/main/java/com/jackdaw/chatwithnpc/npc/NPCEntity.java @@ -2,6 +2,7 @@ import com.jackdaw.chatwithnpc.ChatWithNPCMod; import com.jackdaw.chatwithnpc.SettingManager; +import com.jackdaw.chatwithnpc.openaiapi.function.FunctionManager; import net.minecraft.entity.Entity; import net.minecraft.entity.player.PlayerEntity; import net.minecraft.text.Text; @@ -259,7 +260,7 @@ public boolean hasThreadId() { * @param function The function to add */ public void addFunction(String function) { - functions.add(function); + if (!functions.contains(function) && FunctionManager.getRegistryList().contains(function)) functions.add(function); } /** diff --git a/src/main/java/com/jackdaw/chatwithnpc/npc/NPCEntityManager.java b/src/main/java/com/jackdaw/chatwithnpc/npc/NPCEntityManager.java index 768ce32..35ee445 100644 --- a/src/main/java/com/jackdaw/chatwithnpc/npc/NPCEntityManager.java +++ b/src/main/java/com/jackdaw/chatwithnpc/npc/NPCEntityManager.java @@ -88,6 +88,7 @@ public static void registerNPCEntity(@NotNull Entity entity, boolean isOP) { NPCDataManager npcDataManager = npcEntity.getDataManager(); if (!isOP && !npcDataManager.isExist()) return; npcDataManager.sync(); + npcEntity.addFunction("inquiry_group"); npcMap.put(entity.getUuid(), npcEntity); }