mirror of
https://github.com/vegu-ai/talemate.git
synced 2025-12-16 11:47:48 +01:00
* linux dev instance shortcuts * add voice samples to gitignore * direction mode: inner monologue * actor direction fixes * py script support for scene logic * fix end_simulation call * port sim suite logic to python * remove dupe log * fix typing * section off the text * fix end simulation command * simulation goal, prompt tweaks * prompt tweaks * dialogue format improvements * director action logged with message * call director action log and other fixes * generate character dialogue instructions, prompt fixes, director action ux * fix question / answer call * generate dialogue instructions when loading from character cards * more dialogue format improvements * set scene content context more reliably. * fix innermonologue perspective * conversation prompt should honor the client's decensor setting * fix comfyui checkpoint list not loading * more dialogue format fixes * prompt tweaks * fix sim suite group characters, prompt fixes * npm relock * handle inanimate objects, handle player name change issues * don't rename details if the original name was "You" * As the conversation goes on, dialogue instructions should be moved backwards further to have a weaker effect on immediate generations. * add more context to character creation prompt * fix select next talking actor when natural language flow is turned on and the LLM returns multiple character names * prompt fixes for dialogue generation * summarization fixes * default to script format * seperate dialogue prompt by formatting style, tweak conversation system prompt * remove cruft * add gen format to agent details * relock * relock * prep 0.22.0 * add claude-3-haiku-20240307 * readme
43 lines
3.0 KiB
Python
43 lines
3.0 KiB
Python
import pytest
|
|
from talemate.util import ensure_dialog_format, clean_dialogue
|
|
|
|
@pytest.mark.parametrize("input, expected", [
|
|
('Hello how are you?', 'Hello how are you?'),
|
|
('"Hello how are you?"', '"Hello how are you?"'),
|
|
('"Hello how are you?" he asks "I am fine"', '"Hello how are you?" *he asks* "I am fine"'),
|
|
('Hello how are you? *he asks* I am fine', '"Hello how are you?" *he asks* "I am fine"'),
|
|
|
|
('Hello how are you?" *he asks* I am fine', '"Hello how are you?" *he asks* "I am fine"'),
|
|
('Hello how are you?" *he asks I am fine', '"Hello how are you?" *he asks I am fine*'),
|
|
('Hello how are you?" *he asks* "I am fine" *', '"Hello how are you?" *he asks* "I am fine"'),
|
|
|
|
('"Hello how are you *he asks* I am fine"', '"Hello how are you" *he asks* "I am fine"'),
|
|
('This is a string without any markers', 'This is a string without any markers'),
|
|
('This is a string with an ending quote"', '"This is a string with an ending quote"'),
|
|
('This is a string with an ending asterisk*', '*This is a string with an ending asterisk*'),
|
|
('"Mixed markers*', '*Mixed markers*'),
|
|
('*narrative.* dialogue" *more narrative.*', '*narrative.* "dialogue" *more narrative.*'),
|
|
('"*messed up dialogue formatting.*" *some narration.*', '"messed up dialogue formatting." *some narration.*'),
|
|
('*"messed up narration formatting."* "some dialogue."', '"messed up narration formatting." "some dialogue."'),
|
|
('Some dialogue and two line-breaks right after, followed by narration.\n\n*Narration*', '"Some dialogue and two line-breaks right after, followed by narration."\n\n*Narration*'),
|
|
('*Some narration with a "quoted" string in it.* Then some unquoted dialogue.\n\n*More narration.*', '*Some narration with a* "quoted" *string in it.* "Then some unquoted dialogue."\n\n*More narration.*'),
|
|
('*Some narration* Some dialogue but not in quotes. *', '*Some narration* "Some dialogue but not in quotes."'),
|
|
])
|
|
def test_dialogue_cleanup(input, expected):
|
|
assert ensure_dialog_format(input) == expected
|
|
|
|
|
|
@pytest.mark.parametrize("input, expected, main_name", [
|
|
("bob: says a sentence", "bob: says a sentence", "bob"),
|
|
("bob: says a sentence\nbob: says another sentence", "bob: says a sentence\nsays another sentence", "bob"),
|
|
("bob: says a sentence with a colon: to explain something", "bob: says a sentence with a colon: to explain something", "bob"),
|
|
("bob: i have a riddle for you, alice: the riddle", "bob: i have a riddle for you, alice: the riddle", "bob"),
|
|
("bob: says something\nalice: says something else", "bob: says something", "bob"),
|
|
("bob: says a sentence. then a", "bob: says a sentence.", "bob"),
|
|
("bob: first paragraph\n\nsecond paragraph", "bob: first paragraph\n\nsecond paragraph", "bob"),
|
|
# movie script new speaker cutoff
|
|
("bob: says a sentence\n\nALICE\nsays something else", "bob: says a sentence", "bob"),
|
|
])
|
|
def test_clean_dialogue(input, expected, main_name):
|
|
others = ["alice", "charlie"]
|
|
assert clean_dialogue(input, main_name) == expected |