Skip to content

order spans by their start index, return start index to the UI#259

Merged
mtblanton merged 1 commit intomainfrom
order-spans-by-start-index
Mar 27, 2025
Merged

order spans by their start index, return start index to the UI#259
mtblanton merged 1 commit intomainfrom
order-spans-by-start-index

Conversation

@mtblanton
Copy link
Copy Markdown
Contributor

Addresses https://github.com/allenai/playground-issues-repo/issues/156

This PR ensures that spans are sorted by their start_index (left) before being returned to the UI. This allows the UI to iterate through the spans one at a time, only adding highlights for the first span.

It also returns the start_index to the UI. That's not essential, but may be nice in the future or while debugging!

@mtblanton mtblanton merged commit 41fa6f7 into main Mar 27, 2025
3 checks passed
@mtblanton mtblanton deleted the order-spans-by-start-index branch March 27, 2025 17:56
mtblanton added a commit to allenai/olmo-ui that referenced this pull request Mar 27, 2025
## Description

Closes allenai/playground-issues-repo#156
Depends on allenai/olmo-api#259

This PR fixes the overlapping span issue. 

The issue was caused by two things:
* Our regex was global, making it replace every instance of a span
instead of just the first
* Our regex didn't match the current state of attribution highlights,
which now use HTML elements instead of Markdown directives.

I've addressed both of those issues in this PR.

## Testing Plan

Tested locally. Added mocks for a response that has this problem.

## Output / Screenshots

### Before

I forgot to take a screenshot of the before state of the test response I
have and it's hard to get now so you'll have to trust me on this one

### After


![image](https://github.com/user-attachments/assets/c7d88000-89c1-4c53-bcf9-54abe09d536a)
mtblanton added a commit that referenced this pull request Jun 13, 2025
Addresses allenai/playground-issues-repo#156

This PR ensures that spans are sorted by their `start_index` (left)
before being returned to the UI. This allows the UI to iterate through
the spans one at a time, only adding highlights for the first span.

It also returns the `start_index` to the UI. That's not essential, but
may be nice in the future or while debugging!
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