Skip to content

DeepTutor: Lifelong Personalized Tutoring. https://deeptutor.info/.

Format merged voice and settings modules

Bingxi Zhao (Frank)706699eca6a5
diff --git a/deeptutor/services/config/runtime_settings.py b/deeptutor/services/config/runtime_settings.py
index cfe6cd6d6..0d3774ce5 100644
--- a/deeptutor/services/config/runtime_settings.py
+++ b/deeptutor/services/config/runtime_settings.py
@@ -1045,9 +1045,7 @@ class RuntimeSettingsService:
"entity_extract_max_gleaning": _coerce_clamped_int(
settings.get("entity_extract_max_gleaning"), 1, 0, 5
),
- "llm_timeout": _coerce_clamped_int(
- settings.get("llm_timeout"), 240, 60, 3600
- ),
+ "llm_timeout": _coerce_clamped_int(settings.get("llm_timeout"), 240, 60, 3600),
"llm_profile_id": _string(settings.get("llm_profile_id"))[:128],
"llm_model_id": _string(settings.get("llm_model_id"))[:128],
}
diff --git a/deeptutor/services/voice/__init__.py b/deeptutor/services/voice/__init__.py
index c7ac7bc10..d071e5dc1 100644
--- a/deeptutor/services/voice/__init__.py
+++ b/deeptutor/services/voice/__init__.py
@@ -53,9 +53,7 @@ async def synthesize_speech(
config.response_format = response_format
speak_math = _math_speak_from_settings() if math_speak is None else math_speak
prepared = (
- strip_markdown_for_speech(
- text, max_chars=config.max_input_chars, math_speak=speak_math
- )
+ strip_markdown_for_speech(text, max_chars=config.max_input_chars, math_speak=speak_math)
if strip_markdown
else text.strip()
)
diff --git a/deeptutor/services/voice/base.py b/deeptutor/services/voice/base.py
index 7c22eae8f..ba3590f93 100644
--- a/deeptutor/services/voice/base.py
+++ b/deeptutor/services/voice/base.py
@@ -152,9 +152,7 @@ _WHITESPACE = re.compile(r"[ \t]+")
_BLANK_LINES = re.compile(r"\n{3,}")
-def strip_markdown_for_speech(
- text: str, *, max_chars: int = 0, math_speak: bool = True
-) -> str:
+def strip_markdown_for_speech(text: str, *, max_chars: int = 0, math_speak: bool = True) -> str:
"""Reduce Markdown to plain prose suitable for TTS.
Drops code blocks and tables outright (they read terribly), unwraps links