From 02c080e40f3cbf67810230011227f84ae64e9ca2 Mon Sep 17 00:00:00 2001 From: AccidentallyOnPurpose <4935931+AccidentallyOnPurpose@users.noreply.github.com4935931+AccidentallyOnPurpose@users.noreply.github.com> Date: Tue, 24 Dec 2019 20:55:38 +0800 Subject: [PATCH] fix for when no action --- story/utils.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/story/utils.py b/story/utils.py index 5ae29b6..5a59fb1 100644 --- a/story/utils.py +++ b/story/utils.py @@ -122,7 +122,7 @@ def clean_suggested_action(result_raw, min_length=4): results = [s.strip() for s in results] results = [s for s in results if len(s) > min_length] # Sometimes actions are generated with leading > ! . or ?. Likely the model trying to finish the prompt or start an action. - result = results[0].strip().lstrip(" >!.?") + result = results[0].strip().lstrip(" >!.?") if len(results) else '' result = cut_trailing_quotes(result) logger.debug( "full suggested action '%s'. Cropped: '%s'. Split '%s'",