kercre123 / wire-pod

Free, fully-featured server software for the Anki Vector robot.
MIT License
486 stars 165 forks source link

[BUG] Error when LLM returns a single line of text #339

Closed hiamitabha closed 5 months ago

hiamitabha commented 5 months ago

Describe the bug Wirepod crashes when a simple question is asked.

To Reproduce Here is the error from Wirepod console

Jdocs: Incoming ReadDocs request, Robot ID: vic:00902161, Item(s) to return: [doc_name:"vic.AppTokens"] Successfully got jdocs from 00902161 Bot 00902161 Stream type: OPUS (Bot 00902161, Vosk) Processing... Using general recognizer (Bot 00902161) End of speech detected. Bot 00902161 Transcribed text: combien de jours par an Not a custom intent Bot 00902161 Partial match for intent intent_greeting_goodmorning (jour) Checking params for candidate intent intent_greeting_goodmorning Bot 00902161 Intent Sent: intent_greeting_goodmorning No Parameters Sent Bot 00902161 request served. Bot 00902161 Stream type: OPUS (Bot 00902161, Vosk) Processing... Using general recognizer (Bot 00902161) End of speech detected. Bot 00902161 Transcribed text: quelle est la capitale de la france Not a custom intent Making LLM request for device 00902161... Using Qwen/Qwen2-72B-Instruct LLM stream response: panic: runtime error: index out of range [0] with length 0

goroutine 75 [running]: github.com/kercre123/wire-pod/chipper/pkg/wirepod/ttr.StreamingKGSim.func1() /mnt/ssddrive/alldata/code/wire-pod/chipper/pkg/wirepod/ttr/kgsim.go:175 +0xca5 created by github.com/kercre123/wire-pod/chipper/pkg/wirepod/ttr.StreamingKGSim in goroutine 230 /mnt/ssddrive/alldata/code/wire-pod/chipper/pkg/wirepod/ttr/kgsim.go:169 +0x95d exit status 2

Expected behavior Should not crash

Screenshots If applicable, add screenshots to help explain your problem.

Device you are running wire-pod on (please complete the following information): Latest version of Wirepod (top of tree from github) Additional context Add any other context about the problem here.

kercre123 commented 5 months ago

This should now be fixed in the latest version.