Created
December 11, 2019 04:24
-
-
Save MightyAlex200/528804ea07905d6b29e060c14b6c617c to your computer and use it in GitHub Desktop.
AIDungeon2 custom prompt is final
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
%%bash | |
# Custom prompt is final | |
echo """From 9c5a6df8f37369711369e5891030e746df2d84b4 Mon Sep 17 00:00:00 2001 | |
From: MightyAlex200 <[email protected]> | |
Date: Tue, 10 Dec 2019 23:00:31 -0500 | |
Subject: [PATCH] Custom prompt is final | |
--- | |
play.py | 8 ++++---- | |
story/story_manager.py | 9 ++++++--- | |
2 files changed, 10 insertions(+), 7 deletions(-) | |
diff --git a/play.py b/play.py | |
index 31cd2bd..f44c4f4 100644 | |
--- a/play.py | |
+++ b/play.py | |
@@ -43,7 +43,7 @@ def select_game(): | |
+ \"terrorizing the kingdom. You enter the forest searching for the dragon and see' \" | |
) | |
prompt = input(\"Starting Prompt: \") | |
- return context, prompt | |
+ return context, prompt, True | |
setting_key = list(settings)[choice] | |
@@ -73,7 +73,7 @@ def select_game(): | |
prompt_num = np.random.randint(0, len(character[\"prompts\"])) | |
prompt = character[\"prompts\"][prompt_num] | |
- return context, prompt | |
+ return context, prompt, False | |
def instructions(): | |
@@ -121,12 +121,12 @@ def play_aidungeon_2(): | |
if splash_choice == \"new\": | |
print(\"\\n\\n\") | |
- context, prompt = select_game() | |
+ context, prompt, noblock = select_game() | |
console_print(instructions()) | |
print(\"\\nGenerating story...\") | |
story_manager.start_new_story( | |
- prompt, context=context, upload_story=upload_story | |
+ prompt, context=context, upload_story=upload_story, noblock=noblock | |
) | |
print(\"\\n\") | |
console_print(str(story_manager.story)) | |
diff --git a/story/story_manager.py b/story/story_manager.py | |
index aba3974..78bd0b0 100644 | |
--- a/story/story_manager.py | |
+++ b/story/story_manager.py | |
@@ -159,10 +159,13 @@ class StoryManager: | |
self.story = None | |
def start_new_story( | |
- self, story_prompt, context=\"\", game_state=None, upload_story=False | |
+ self, story_prompt, context=\"\", game_state=None, upload_story=False, noblock=False | |
): | |
- block = self.generator.generate(context + story_prompt) | |
- block = cut_trailing_sentence(block) | |
+ if noblock: | |
+ block = \"\" | |
+ else: | |
+ block = self.generator.generate(context + story_prompt) | |
+ block = cut_trailing_sentence(block) | |
self.story = Story( | |
context + story_prompt + block, | |
context=context, | |
-- | |
2.24.0""" > fix.patch | |
# email and username required | |
git config user.email "[email protected]" | |
git config user.name "Anonymous" | |
git am --3way fix.patch && echo Patch Applied! |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment