mirror of
https://github.com/vegu-ai/talemate.git
synced 2025-12-28 16:06:38 +01:00
Prep 0.15.0 (#38)
* send one request for assign all clients * tweak narrate-after-dialogue prompt * elevenlabs default to turbo model and make model id configurable * improve add client dialogue to be more robust * prompt for default character creation on character card loads * rename to model as to not conflict with pydantic * narrate after dialogue strip dialogue generation unless enabled via new option * starling and capybara-tess * narrate dialogue context increased * relabel tts agent to Voice, show agent label in status bar * dont expect LLM to handle * and " - most of them are not stable / consistent enough with it * starling template updated * if allow dialogue in narration is disabled just assume the entire string is a narration * reorganization the narrate after dialogue template * fix more issues with time passage calculations * move punkt download to agent init and silence * improved RAG during conversation if AI selected is enabled in conversation agent * prompt tweaks * deepseek, chromomaid-storytelling * relock * narrate-after-dialogue prompt tweaks * runpod status queries every 15 secs instead of 60 * default player character prompting when loading character card from talemate storage * better chunking during split tts generation * tweak narrate progress prompt * improvements to ensure_dialogue_format and tests * to pytest * prep 0.15.0 * update packages * dialogue cleanup fixes * fix openai default model name fix not being able to edit client due to name check * free form analyst was using wrong system prompt causing gpt-4 to actually generate json responses
This commit is contained in:
0
tests/conftest.py
Normal file
0
tests/conftest.py
Normal file
21
tests/test_dialogue_cleanup.py
Normal file
21
tests/test_dialogue_cleanup.py
Normal file
@@ -0,0 +1,21 @@
|
||||
import pytest
|
||||
from talemate.util import ensure_dialog_format
|
||||
|
||||
@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*'),
|
||||
])
|
||||
def test_dialogue_cleanup(input, expected):
|
||||
assert ensure_dialog_format(input) == expected
|
||||
38
tests/test_isodate.py
Normal file
38
tests/test_isodate.py
Normal file
@@ -0,0 +1,38 @@
|
||||
from talemate.util import (
|
||||
iso8601_add,
|
||||
iso8601_correct_duration,
|
||||
iso8601_diff,
|
||||
iso8601_diff_to_human,
|
||||
iso8601_duration_to_human,
|
||||
parse_duration_to_isodate_duration,
|
||||
timedelta_to_duration,
|
||||
duration_to_timedelta,
|
||||
isodate
|
||||
)
|
||||
|
||||
|
||||
def test_isodate_utils():
|
||||
|
||||
date1 = "P11MT15M"
|
||||
date2 = "PT1S"
|
||||
|
||||
duration1= parse_duration_to_isodate_duration(date1)
|
||||
assert duration1.months == 11
|
||||
assert duration1.tdelta.seconds == 900
|
||||
|
||||
duration2 = parse_duration_to_isodate_duration(date2)
|
||||
assert duration2.seconds == 1
|
||||
|
||||
timedelta1 = duration_to_timedelta(duration1)
|
||||
assert timedelta1.seconds == 900
|
||||
assert timedelta1.days == 11*30, timedelta1.days
|
||||
|
||||
timedelta2 = duration_to_timedelta(duration2)
|
||||
assert timedelta2.seconds == 1
|
||||
|
||||
parsed = parse_duration_to_isodate_duration("P11MT14M59S")
|
||||
assert iso8601_diff(date1, date2) == parsed, parsed
|
||||
|
||||
assert iso8601_duration_to_human(date1) == "11 Months and 15 Minutes ago", iso8601_duration_to_human(date1)
|
||||
assert iso8601_duration_to_human(date2) == "1 Second ago", iso8601_duration_to_human(date2)
|
||||
assert iso8601_duration_to_human(iso8601_diff(date1, date2)) == "11 Months, 14 Minutes and 59 Seconds ago", iso8601_duration_to_human(iso8601_diff(date1, date2))
|
||||
Reference in New Issue
Block a user