CCBlueX / LiquidBounce

A free mixin-based injection hacked client for Minecraft using the Fabric API
https://liquidbounce.net/
GNU General Public License v3.0
1.52k stars 488 forks source link

[BUG] AutoChatGame gives error #1754

Closed fineless71 closed 10 months ago

fineless71 commented 11 months ago

LiquidBounce Branch

Nextgen

LiquidBounce Build/Version

git-579cc38

Operating System

Linux

Minecraft Version

1.20.4

Describe the bug

I'm trying to use AutoChatGame for the first time, but it gives me an error. I have set my OpenAI key and the trigger.

Steps to reproduce

Setup and enable AutoChatGame

Client Log

[01:26:24] [Render thread/INFO]: [CHAT] §f§lLiquid§9§lBounce §8▸ §7§aUnderstood question: ServerName | First player to unscramble "Xams" gets 25 coins. ServerName | 3 new power up beacons have spawned. Punch it to claim the power up.
[01:26:24] [Thread-4688/INFO]: [STDERR]: java.lang.NullPointerException: Cannot invoke "com.google.gson.JsonElement.getAsJsonArray()" because the return value of "com.google.gson.JsonObject.get(String)" is null
[01:26:24] [Thread-4688/INFO]: [STDERR]:    at net.ccbluex.liquidbounce.utils.openai.Gpt.requestNewAnswer(Gpt.kt:82)
[01:26:24] [Thread-4688/INFO]: [STDERR]:    at net.ccbluex.liquidbounce.features.module.modules.misc.ModuleAutoChatGame$repeatable$1$1.invoke(ModuleAutoChatGame.kt:158)
[01:26:24] [Thread-4688/INFO]: [STDERR]:    at net.ccbluex.liquidbounce.features.module.modules.misc.ModuleAutoChatGame$repeatable$1$1.invoke(ModuleAutoChatGame.kt:155)
[01:26:24] [Thread-4688/INFO]: [STDERR]:    at kotlin.concurrent.ThreadsKt$thread$thread$1.run(Thread.kt:30)
[01:26:24] [Thread-4688/INFO]: [CHAT] §f§lLiquid§9§lBounce §8▸ §7§cFailed to answer question: Cannot invoke "com.google.gson.JsonElement.getAsJsonArray()" because the return value of "com.google.gson.JsonObject.get(String)" is null

Screenshots

image

fineless71 commented 11 months ago

It also might be a good idea to include the date in the prompt (without manually changing it every day..), as there are more likely to be christmas questions around christmas. I tried asking it manually and it thought the answer was 'maxs' instead of 'Xmas'. Although I tried giving it the date as well and it still failed...

1zun4 commented 11 months ago

Do you have OpenAI balance?

fineless71 commented 11 months ago

Do you have OpenAI balance?

It's linked to my card and I haven't hit the usage limit I set. I was able to do it manually through the playground so I don't think it's anything with my account

fineless71 commented 10 months ago

I found the issue, the question and prompt cannot contain quotes or it will error. It looks like the Gpt class does not escape the input when putting it in the JSON.