From 08299b37dfda86e56e4f2b442f68ccd2da7a82e3 Mon Sep 17 00:00:00 2001 From: 简律纯 Date: Fri, 24 Oct 2025 23:15:35 +0800 Subject: feat: Enhance Processor, RuleExtractor, and Renderers with type hints and improved documentation - Added type hints to Processor methods for better clarity and type safety. - Improved documentation for Processor methods, including detailed descriptions of parameters and return types. - Refactored RuleExtractor to support optional configuration file loading and added error handling for file operations. - Enhanced MarkdownRenderer to handle both list and dictionary inputs, with improved rendering logic. - Created comprehensive examples and tests for all components, ensuring robust functionality and error handling. - Added example rules for D&D 5E and structured output files for various formats (JSON, HTML, Markdown). - Established a testing framework with clear instructions and coverage reporting. --- examples/output/session_output.html | 1 + examples/output/session_output.json | 121 ++++++++++++++++++++++++++++++++++++ examples/output/session_output.md | 87 ++++++++++++++++++++++++++ 3 files changed, 209 insertions(+) create mode 100644 examples/output/session_output.html create mode 100644 examples/output/session_output.json create mode 100644 examples/output/session_output.md (limited to 'examples/output') diff --git a/examples/output/session_output.html b/examples/output/session_output.html new file mode 100644 index 0000000..461a59f --- /dev/null +++ b/examples/output/session_output.html @@ -0,0 +1 @@ +TRPG Log Output

TRPG Log Output

\ No newline at end of file diff --git a/examples/output/session_output.json b/examples/output/session_output.json new file mode 100644 index 0000000..076ef15 --- /dev/null +++ b/examples/output/session_output.json @@ -0,0 +1,121 @@ +[ + { + "type": "metadata", + "timestamp": "2025-10-24 14:30:01", + "speaker": "艾莉娅", + "content": [], + "processed": true + }, + { + "type": "metadata", + "timestamp": "2025-10-24 14:30:05", + "speaker": "艾莉娅", + "content": [], + "processed": true + }, + { + "type": "metadata", + "timestamp": "2025-10-24 14:30:05", + "speaker": "DiceBot", + "content": [], + "processed": true + }, + { + "type": "metadata", + "timestamp": "2025-10-24 14:30:15", + "speaker": "DM", + "content": [], + "processed": true + }, + { + "type": "metadata", + "timestamp": "2025-10-24 14:30:30", + "speaker": "艾莉娅", + "content": [], + "processed": true + }, + { + "type": "metadata", + "timestamp": "2025-10-24 14:30:35", + "speaker": "艾莉娅", + "content": [], + "processed": true + }, + { + "type": "metadata", + "timestamp": "2025-10-24 14:30:35", + "speaker": "DiceBot", + "content": [], + "processed": true + }, + { + "type": "metadata", + "timestamp": "2025-10-24 14:30:45", + "speaker": "DM", + "content": [], + "processed": true + }, + { + "type": "metadata", + "timestamp": "2025-10-24 14:31:00", + "speaker": "索恩", + "content": [], + "processed": true + }, + { + "type": "metadata", + "timestamp": "2025-10-24 14:31:10", + "speaker": "DM", + "content": [], + "processed": true + }, + { + "type": "metadata", + "timestamp": "2025-10-24 14:31:25", + "speaker": "索恩", + "content": [], + "processed": true + }, + { + "type": "metadata", + "timestamp": "2025-10-24 14:31:30", + "speaker": "艾莉娅", + "content": [], + "processed": true + }, + { + "type": "metadata", + "timestamp": "2025-10-24 14:31:45", + "speaker": "莉莉安", + "content": [], + "processed": true + }, + { + "type": "metadata", + "timestamp": "2025-10-24 14:31:50", + "speaker": "DM", + "content": [], + "processed": true + }, + { + "type": "metadata", + "timestamp": "2025-10-24 14:31:55", + "speaker": "莉莉安", + "content": [], + "processed": true + }, + { + "type": "metadata", + "timestamp": "2025-10-24 14:31:55", + "speaker": "DiceBot", + "content": [], + "processed": true + }, + { + "type": "metadata", + "timestamp": "2025-10-24 14:32:10", + "speaker": "DM", + "content": [], + "processed": true + } +] \ No newline at end of file diff --git a/examples/output/session_output.md b/examples/output/session_output.md new file mode 100644 index 0000000..6f4a09b --- /dev/null +++ b/examples/output/session_output.md @@ -0,0 +1,87 @@ +# TRPG Log + +## Entry 1 + +**Timestamp**: 2025-10-24 14:30:01 +**Speaker**: 艾莉娅 + +## Entry 2 + +**Timestamp**: 2025-10-24 14:30:05 +**Speaker**: 艾莉娅 + +## Entry 3 + +**Timestamp**: 2025-10-24 14:30:05 +**Speaker**: DiceBot + +## Entry 4 + +**Timestamp**: 2025-10-24 14:30:15 +**Speaker**: DM + +## Entry 5 + +**Timestamp**: 2025-10-24 14:30:30 +**Speaker**: 艾莉娅 + +## Entry 6 + +**Timestamp**: 2025-10-24 14:30:35 +**Speaker**: 艾莉娅 + +## Entry 7 + +**Timestamp**: 2025-10-24 14:30:35 +**Speaker**: DiceBot + +## Entry 8 + +**Timestamp**: 2025-10-24 14:30:45 +**Speaker**: DM + +## Entry 9 + +**Timestamp**: 2025-10-24 14:31:00 +**Speaker**: 索恩 + +## Entry 10 + +**Timestamp**: 2025-10-24 14:31:10 +**Speaker**: DM + +## Entry 11 + +**Timestamp**: 2025-10-24 14:31:25 +**Speaker**: 索恩 + +## Entry 12 + +**Timestamp**: 2025-10-24 14:31:30 +**Speaker**: 艾莉娅 + +## Entry 13 + +**Timestamp**: 2025-10-24 14:31:45 +**Speaker**: 莉莉安 + +## Entry 14 + +**Timestamp**: 2025-10-24 14:31:50 +**Speaker**: DM + +## Entry 15 + +**Timestamp**: 2025-10-24 14:31:55 +**Speaker**: 莉莉安 + +## Entry 16 + +**Timestamp**: 2025-10-24 14:31:55 +**Speaker**: DiceBot + +## Entry 17 + +**Timestamp**: 2025-10-24 14:32:10 +**Speaker**: DM + -- cgit v1.2.3-70-g09d2