Files
talemate/tests/test_isodate.py
veguAI 0738899ac9 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
2023-12-02 00:40:14 +02:00

38 lines
1.3 KiB
Python

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))