From b9b3cd3aba4d076cf9c703b5cb29a2ecc4b6e431 Mon Sep 17 00:00:00 2001 From: somebody Date: Wed, 19 Jul 2023 12:02:53 -0500 Subject: [PATCH] API: Fix /story --- aiserver.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/aiserver.py b/aiserver.py index 95234644..2278015c 100644 --- a/aiserver.py +++ b/aiserver.py @@ -8817,8 +8817,14 @@ def get_story(): chunks = [] if koboldai_vars.gamestarted: chunks.append({"num": 0, "text": koboldai_vars.prompt}) - for num, action in koboldai_vars.actions.items(): - chunks.append({"num": num + 1, "text": action}) + + last_action_num = list(koboldai_vars.actions.actions.keys())[-1] + for num, action in koboldai_vars.actions.actions.items(): + text = action["Selected Text"] + # The last action seems to always be empty + if not text and num == last_action_num: + continue + chunks.append({"num": num + 1, "text": text}) return {"results": chunks}