2.2 KiB
2.2 KiB
Fix ChatGPT extractor message granularity and role inheritance.
Problem: The extractor is now discovering conversation content, but it is treating paragraphs, list items, links, inline fragments, and code blocks as separate messages. This creates many Unknown blocks and misclassified User/Assistant fragments.
Goal: Return one message object per actual ChatGPT turn, not one message per child DOM block.
Requirements:
-
Identify the outer message turn container first.
- A single user prompt should produce one User message.
- A single assistant response should produce one Assistant message.
- Child paragraphs, lists, tables, links, and code blocks must be content within that message, not separate messages.
-
Role must be assigned from the outer message container.
- Child nodes must inherit the parent message role.
- Do not classify inline fragments independently.
- Do not classify text fragments like "re", "can", "own", "have" as User messages.
-
Deduplicate repeated turns.
- The same user prompt should not appear twice.
- Use normalized text fingerprinting after role assignment.
-
Fix link serialization.
- A Markdown link must be emitted as one inline unit.
- Do not split
[MakeMKV](https://www.makemkv.com)into separate Unknown/Assistant blocks.
-
Keep unsupported placeholders inside the parent turn.
[Unsupported ChatGPT content: ...]should not be split across Unknown and Assistant blocks.
-
Debug output should include:
- turnContainersFound
- messagesReturned
- duplicateTurnsSkipped
- orphanChildBlocksSkipped
- unknownTurnsReturned
Acceptance criteria:
- The Jellyfin conversation starts with exactly one User message for the opening question.
- The first assistant answer is one Assistant message containing all options, lists, links, and code blocks.
- The Tiny Media Manager question is one User message.
- The SmartScreen answer is one Assistant message.
- The .nfo question is one User message.
- The .nfo answer is one Assistant message.
- No
.com)standalone Assistant message. - No
re,can,own,have, or similar fragments as User messages. - Unknown messages are allowed only for actual unsupported ChatGPT turn-level content, not paragraph/list/link fragments.