Skip to content

Commit c968137

Browse files
authored
Implement send_llm_to_chatbotUI for LLM response handling
Added send_llm_to_chatbotUI function to handle LLM responses.
1 parent ad33aac commit c968137

1 file changed

Lines changed: 14 additions & 2 deletions

File tree

services/5_Mouth.py

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,8 @@ def onFilterText(text):
129129
if runtime.isStarted('i01.mouth'):
130130
i01_mouth.speak(filtered_text)
131131
if runtime.isStarted('i01.chatBot'):
132-
i01_chatBot.getResponse("LLM_RESPONSE " + filtered_text)
132+
if filtered_text and not re.match(r'^\s*\*[\w\s]+\*\s*$', filtered_text):
133+
send_llm_to_chatbotUI(filtered_text)
133134
print("Extracted Word:", extracted_word)
134135
print("Parameters:", params)
135136
function_to_call = globals().get(extracted_word)
@@ -141,6 +142,17 @@ def onFilterText(text):
141142
else:
142143
result = "No function found matching '{}'".format(extracted_word)
143144
print(result)
144-
145+
146+
def send_llm_to_chatbotUI(text):
147+
from org.myrobotlab.programab import Response
148+
from java.util import ArrayList
149+
payloads = ArrayList()
150+
resp = Response(i01_chatBot.getCurrentBotName(),
151+
i01_chatBot.getCurrentUserName(),
152+
text,
153+
payloads)
154+
#i01_chatBot.publishResponse(resp)
155+
i01_chatBot.invoke("publishResponse", resp)
156+
145157
if runtime.isStarted('i01.mouth'):
146158
initMouth()

0 commit comments

Comments
 (0)