@@ -1395,13 +1395,14 @@ def check_termination_and_human_reply(
1395
1395
if config is None :
1396
1396
config = self
1397
1397
if messages is None :
1398
- messages = self ._oai_messages [sender ]
1398
+ messages = self ._oai_messages [sender ] if sender else []
1399
1399
message = messages [- 1 ]
1400
1400
reply = ""
1401
1401
no_human_input_msg = ""
1402
+ sender_name = "the sender" if sender is None else sender .name
1402
1403
if self .human_input_mode == "ALWAYS" :
1403
1404
reply = self .get_human_input (
1404
- f"Provide feedback to { sender . name } . Press enter to skip and use auto-reply, or type 'exit' to end the conversation: "
1405
+ f"Provide feedback to { sender_name } . Press enter to skip and use auto-reply, or type 'exit' to end the conversation: "
1405
1406
)
1406
1407
no_human_input_msg = "NO HUMAN INPUT RECEIVED." if not reply else ""
1407
1408
# if the human input is empty, and the message is a termination message, then we will terminate the conversation
@@ -1414,9 +1415,9 @@ def check_termination_and_human_reply(
1414
1415
# self.human_input_mode == "TERMINATE":
1415
1416
terminate = self ._is_termination_msg (message )
1416
1417
reply = self .get_human_input (
1417
- f"Please give feedback to { sender . name } . Press enter or type 'exit' to stop the conversation: "
1418
+ f"Please give feedback to { sender_name } . Press enter or type 'exit' to stop the conversation: "
1418
1419
if terminate
1419
- else f"Please give feedback to { sender . name } . Press enter to skip and use auto-reply, or type 'exit' to stop the conversation: "
1420
+ else f"Please give feedback to { sender_name } . Press enter to skip and use auto-reply, or type 'exit' to stop the conversation: "
1420
1421
)
1421
1422
no_human_input_msg = "NO HUMAN INPUT RECEIVED." if not reply else ""
1422
1423
# if the human input is empty, and the message is a termination message, then we will terminate the conversation
@@ -1427,7 +1428,7 @@ def check_termination_and_human_reply(
1427
1428
else :
1428
1429
# self.human_input_mode == "TERMINATE":
1429
1430
reply = self .get_human_input (
1430
- f"Please give feedback to { sender . name } . Press enter or type 'exit' to stop the conversation: "
1431
+ f"Please give feedback to { sender_name } . Press enter or type 'exit' to stop the conversation: "
1431
1432
)
1432
1433
no_human_input_msg = "NO HUMAN INPUT RECEIVED." if not reply else ""
1433
1434
# if the human input is empty, and the message is a termination message, then we will terminate the conversation
@@ -1505,13 +1506,14 @@ async def a_check_termination_and_human_reply(
1505
1506
if config is None :
1506
1507
config = self
1507
1508
if messages is None :
1508
- messages = self ._oai_messages [sender ]
1509
- message = messages [- 1 ]
1509
+ messages = self ._oai_messages [sender ] if sender else []
1510
+ message = messages [- 1 ] if messages else {}
1510
1511
reply = ""
1511
1512
no_human_input_msg = ""
1513
+ sender_name = "the sender" if sender is None else sender .name
1512
1514
if self .human_input_mode == "ALWAYS" :
1513
1515
reply = await self .a_get_human_input (
1514
- f"Provide feedback to { sender . name } . Press enter to skip and use auto-reply, or type 'exit' to end the conversation: "
1516
+ f"Provide feedback to { sender_name } . Press enter to skip and use auto-reply, or type 'exit' to end the conversation: "
1515
1517
)
1516
1518
no_human_input_msg = "NO HUMAN INPUT RECEIVED." if not reply else ""
1517
1519
# if the human input is empty, and the message is a termination message, then we will terminate the conversation
@@ -1524,9 +1526,9 @@ async def a_check_termination_and_human_reply(
1524
1526
# self.human_input_mode == "TERMINATE":
1525
1527
terminate = self ._is_termination_msg (message )
1526
1528
reply = await self .a_get_human_input (
1527
- f"Please give feedback to { sender . name } . Press enter or type 'exit' to stop the conversation: "
1529
+ f"Please give feedback to { sender_name } . Press enter or type 'exit' to stop the conversation: "
1528
1530
if terminate
1529
- else f"Please give feedback to { sender . name } . Press enter to skip and use auto-reply, or type 'exit' to stop the conversation: "
1531
+ else f"Please give feedback to { sender_name } . Press enter to skip and use auto-reply, or type 'exit' to stop the conversation: "
1530
1532
)
1531
1533
no_human_input_msg = "NO HUMAN INPUT RECEIVED." if not reply else ""
1532
1534
# if the human input is empty, and the message is a termination message, then we will terminate the conversation
@@ -1537,7 +1539,7 @@ async def a_check_termination_and_human_reply(
1537
1539
else :
1538
1540
# self.human_input_mode == "TERMINATE":
1539
1541
reply = await self .a_get_human_input (
1540
- f"Please give feedback to { sender . name } . Press enter or type 'exit' to stop the conversation: "
1542
+ f"Please give feedback to { sender_name } . Press enter or type 'exit' to stop the conversation: "
1541
1543
)
1542
1544
no_human_input_msg = "NO HUMAN INPUT RECEIVED." if not reply else ""
1543
1545
# if the human input is empty, and the message is a termination message, then we will terminate the conversation
0 commit comments