(player_history)
| 9 | |
| 10 | |
| 11 | def call_npc(player_history): |
| 12 | |
| 13 | # use player_history to build the chat message |
| 14 | role_system = '''你是一个智能聊天伙伴,你擅长高情商地和用户聊天,让用户感到舒适、愉快或得到需要的帮助。''' |
| 15 | history = [{"role": "system", "content": role_system}] |
| 16 | for mes in player_history: |
| 17 | if mes["role"]=="user": |
| 18 | history.append({"role": "user", "content": mes["content"]}) |
| 19 | else: |
| 20 | history.append({"role": "assistant", "content": mes["content"]}) |
| 21 | |
| 22 | ret = call_llm(history) |
| 23 | |
| 24 | return ret |
| 25 |
no test coverage detected