diff options
Diffstat (limited to 'src/ollama_web/prompts/__init__.py')
| -rw-r--r-- | src/ollama_web/prompts/__init__.py | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/ollama_web/prompts/__init__.py b/src/ollama_web/prompts/__init__.py index 59bdb48..5b6b53e 100644 --- a/src/ollama_web/prompts/__init__.py +++ b/src/ollama_web/prompts/__init__.py @@ -9,7 +9,7 @@ from __future__ import annotations import json from pathlib import Path -from typing import Any +from typing import Any, cast from ollama_web.config import settings @@ -23,7 +23,7 @@ def _load_prompts(lang: str) -> dict[str, Any]: path = _DIR / f"{lang}.json" try: with path.open("r", encoding="utf-8") as f: - return json.load(f) + return cast(dict[str, Any], json.load(f)) except (FileNotFoundError, json.JSONDecodeError): return {} @@ -54,4 +54,4 @@ def get_prompt(key: str, lang: str | None = None, fallback: str | None = None) - current = current[part] if isinstance(current, str): return current - return fallback if fallback is not None else key + return fallback if fallback is not None else key
\ No newline at end of file |
