Skip to content

feat: click-to-highlight source spans#5

Merged
bacemtayeb merged 2 commits into
devfrom
feat/frontend-ui
Jun 8, 2026
Merged

feat: click-to-highlight source spans#5
bacemtayeb merged 2 commits into
devfrom
feat/frontend-ui

Conversation

@Davidpereira2803

Copy link
Copy Markdown
Collaborator

No description provided.

Closes #F3

- _render_source_html: renders source sentences as HTML; sentences whose IDs
  are in the highlighted set get a yellow <mark> span
- run() now returns the AnalysisResult object so build_app can store it in
  gr.State for the select handler
- summary_out.select() wired to _on_sentence_select: looks up the clicked
  sentence's verdict, extracts top_source_sentence_ids (≤5), and re-renders
  the source HTML with those spans highlighted; clicking another sentence
  switches the highlight
- Source panel promoted from accordion Textbox to always-visible gr.HTML in
  the left column so the two-panel layout is complete
- 6 new tests covering _render_source_html and the select highlight logic
html.escape() applied to sentence.text and document.raw_text before
interpolation into the gr.HTML panel — user-supplied content (pasted
text or PDF extract) could otherwise inject arbitrary HTML.
@bacemtayeb bacemtayeb merged commit d2f8e8a into dev Jun 8, 2026
1 check passed
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.

2 participants