Skip to content

Commit

Permalink
fix robust issue
Browse files Browse the repository at this point in the history
  • Loading branch information
rayrayraykk committed Jan 18, 2024
1 parent 6bac1a5 commit e05a168
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
15 changes: 13 additions & 2 deletions examples/game/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,9 @@ def invited_group_chat(
msg = None
elif answer == "结束邀请对话":
break
else:
send_chat_msg("【系统】请重新选择。")
continue
for c in invited_customer:
msg = c(msg)
send_pretty_msg(msg)
Expand Down Expand Up @@ -141,7 +144,9 @@ def one_on_one_loop(customers, player):
break
send_pretty_msg(msg)
send_chat_msg(
"【系统】请输入“做菜”启动做菜程序,它会按所选定食材产生菜品。" " (对话轮次过多会使得顾客综合满意度下降。)",
"【系统】请输入“做菜”启动做菜程序,它会按所选定食材产生菜品。 \n"
"【系统】对话轮次过多会使得顾客综合满意度下降。 \n"
"【系统】若不输入任何内容直接按回车键,顾客将离开餐馆。",
)
msg = player(msg)
if len(msg["content"]) == 0 or "[TERMINATE]" in msg["content"]:
Expand Down Expand Up @@ -201,6 +206,9 @@ def invite_customers(customers):
answer = query_answer(select_customer, "invited")
if answer == "END":
break
if answer not in select_customer:
send_chat_msg("【系统】请重新选择。")
continue

invited_customers.append(answer)
available_customers.remove(answer)
Expand Down Expand Up @@ -312,7 +320,10 @@ def main(args) -> None:
for c in customers
if c.name not in checkpoint.invited_customers
]
checkpoint.visit_customers = one_on_one_loop(rest_customers, player)
checkpoint.visit_customers = one_on_one_loop(
rest_customers,
player,
)
checkpoint.stage_per_night = StagePerNight.MAKING_INVITATION
elif checkpoint.stage_per_night == StagePerNight.MAKING_INVITATION:
# ============ making invitation decision =============
Expand Down
1 change: 1 addition & 0 deletions examples/game/ruled_user.py
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,7 @@ def cook(self):
cook_list.clear()
elif sel_ingr not in ingredients_list:
send_chat_msg("【系统】不可用食材,请重新选择。")
continue
else:
cook_list.append(sel_ingr)
end_query_answer()
Expand Down

0 comments on commit e05a168

Please sign in to comment.