Skip to content

Add sources to statements - #227

Open
hranasit wants to merge 16 commits into
mainfrom
feature/216-add-sources-to-statements-ai-part
Open

hranasit wants to merge 16 commits into
mainfrom
feature/216-add-sources-to-statements-ai-part

Conversation

@hranasit

@hranasit hranasit commented Nov 20, 2026 •

Copy link
Copy Markdown
Collaborator

closes #216
closes #217
closes #215

  • sources are not exported when downloading MS Word, downloading Markdown, copying to clipboard
  • paths sent to AI are shortened because of the number of tokens
  • based on the prompt, AI should not modify the source id, but it sometimes does, so retry was added

@hranasit
hranasit requested a review from MatejFrnka November 20, 2026 12:29
@hranasit hranasit linked an issue Nov 20, 2026 that may be closed by this pull request
Comment thread plugin/src/statement-sources.ts Outdated
// Leave fenced code and inline code untouched. Statements may span multiple lines.
// Adjacent statement elements form flowing prose, even when separated by blank lines.
const tokens =
/(^ {0,3}(`{3,}|~{3,})[^\n]*\n[\s\S]*?^ {0,3}\2[^\S\n]*(?:\n|$))|(`+)[^`]*?\3|<statement\s+source\s*=\s*(?:"([^"]*)"|'([^']*)')\s*>([\s\S]*?)<\/statement\s*>(\s*(?=<statement\s+source\s*=))?/gm

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think single and double brackets could be maybe merged into a single match group

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

also, I would consider removing the condition to ignore stuff inside codeblocks. I think it makes sence to replace there as well. It would also simplify.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you mean the quotes? I'd keep them separate. Using a backreference would make the regex less readable. We would need to check if the first quote was ' or ". The separate alternatives "..." and '...' are clear at a glance.

Comment thread service/prompts.yaml Outdated
- Consolidate related information that is scattered across sections.
- Remove or shorten redundant mentions when the same information appears in multiple places (keep it in the most appropriate location).
- Improve flow and logical structure so each section focuses on its intended theme.
- Rewrite questionnaire-like bullets and isolated fragments into connected, complete sentences in coherent paragraphs. Organize by topic rather than by source or answer order. Do not leave one bullet, line, or paragraph per fact. Use lists or tables only for genuine enumerations or comparisons, or where explicitly required by the section structure.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The current outcome makes it unclear which source refers to what:

image

It might be enough to update the prompts. If not, it may be needed to allow nested tags

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I aimed to find the best balance between the flow of the text and source grouping

@hranasit
hranasit force-pushed the feature/216-add-sources-to-statements-ai-part branch from b9d2df9 to 833169a Compare November 24, 2026 15:59
@hranasit
hranasit force-pushed the feature/216-add-sources-to-statements-ai-part branch from 833169a to d31290d Compare November 25, 2026 15:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add sources to statements - UI Add sources to statements - AI part Add sources to statements in the DMP

2 participants