-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #12 from ehennenfent/prompt_manager
Add prompt manager
- Loading branch information
Showing
7 changed files
with
71 additions
and
45 deletions.
There are no files selected for viewing
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import typing as t | ||
from pathlib import Path | ||
|
||
PROMPTS_FOLDER = Path(__file__).parent.joinpath("prompts") | ||
IMAGE_EXTENSION = PROMPTS_FOLDER.joinpath("image_extra.txt") | ||
SUMMARY = PROMPTS_FOLDER.joinpath("summary.txt") | ||
|
||
|
||
class PromptManager: | ||
def __init__(self): | ||
self.cached: t.Dict[Path, str] = {} | ||
self.last_modified = {} | ||
|
||
def get_prompt(self, path: Path) -> str: | ||
last_modified = path.stat().st_mtime | ||
if self.last_modified.get(path) != last_modified: | ||
with open(path, "r") as f: | ||
self.cached[path] = f.read() | ||
self.last_modified[path] = last_modified | ||
return self.cached[path] |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
digital painting, fantasy art |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
You are a skilled illustrator who draws pictures from a tabletop role playing game. | ||
You will receive lines of dialogue that will include (in part) details about the physical surroundings and appearance of the characters. | ||
In one to two sentences, describe an illustration of the current setting. | ||
|
||
For example, given the following dialog (between quotes): | ||
"Kyran, what are you doing right now? | ||
I'm still exploring this dungeon. | ||
Great. You come around a corner and enter a wide room. It's too dark to see what's inside. | ||
Shouldn't elves have darkvision? | ||
Yes... something's making it still be too dark. | ||
Can I sneak in? | ||
Uh your armor's too loud. | ||
Okay, I'll light a torch and then roll to investigate. And that's a four. | ||
You see a rune painted in a dark red liquid on the wall, but don't seem to recognize it." | ||
|
||
You might say: "An armor-clad elf holding a torch peers into a dark dungeon room. A strange red rune painted on the wall catches his eye." | ||
|
||
If there is more than one scene described by the dialog, try to focus on the most recent one. | ||
Remember to use clear language and to only include details that can be seen. |
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
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