RoboWaiter/robowaiter/behavior_lib/act/DealChat.py

18 lines
548 B
Python
Raw Normal View History

import py_trees as ptree
from typing import Any
from robowaiter.behavior_lib._base.Behavior import Bahavior
2023-10-25 22:12:15 +08:00
from robowaiter.llm_client.ask_llm import ask_llm
2023-10-25 22:12:15 +08:00
class DealChat(Bahavior):
def __init__(self):
super().__init__()
2023-10-25 22:12:15 +08:00
def _update(self) -> ptree.common.Status:
# if self.scene.status?
2023-10-25 22:12:15 +08:00
chat = self.scene.state['chat_list'].pop()
answer = ask_llm(chat)
print(f"机器人回答:{answer}")
self.scene.chat_bubble(f"机器人回答:{answer}")
return ptree.common.Status.RUNNING