feat: add session titles and migration

This commit is contained in:
2026-07-30 19:42:32 +02:00
parent 00a5a6ce8c
commit 112ae6d1da
5 changed files with 227 additions and 25 deletions
+17 -1
View File
@@ -2,7 +2,7 @@ import tempfile
import unittest
from pathlib import Path
from javis.core.chat_service import ChatService
from javis.core.chat_service import ChatService, derive_session_title
from javis.memory.sqlite_store import SQLiteSessionStore
from javis.providers.base import ChatMessage, LocalModelProvider, ProviderUnavailableError
@@ -64,6 +64,22 @@ class ChatServiceTests(unittest.TestCase):
"Antwort 2",
],
)
self.assertEqual(loaded.session.title, "Hallo")
def test_title_is_local_short_and_redacts_obvious_sensitive_content(self) -> None:
self.assertEqual(
derive_session_title("Erkläre SQLite-Transaktionen für Anfänger"),
"Erkläre SQLite-Transaktionen für Anfänger",
)
self.assertLessEqual(derive_session_title("Wort " * 30).__len__(), 60)
self.assertEqual(
derive_session_title("Mein API-Key ist ABC123 und funktioniert nicht"),
"Sensible Anfrage",
)
self.assertEqual(
derive_session_title("Wenn ich blute, sollte ich zum Arzt?"),
"Gesundheitsfrage",
)
def test_streaming_response_is_persisted_exactly_once_after_completion(self) -> None:
provider = StreamingProvider()