fix(gateway/telegram): include full numbered choices in clarify body#27535
Closed
luyao618 wants to merge 1 commit into
Closed
fix(gateway/telegram): include full numbered choices in clarify body#27535luyao618 wants to merge 1 commit into
luyao618 wants to merge 1 commit into
Conversation
Telegram inline button labels are clipped on mobile when clarify choices are long, leaving users unable to read full options. Render the question and a full numbered list of escaped options in the message body, and shorten inline button labels to just the option index so they always fit. Fixes NousResearch#27497.
c4aee09 to
16cc5b2
Compare
Contributor
|
Closing in favor of #27852 (same fix, three competing implementations of the same body+button-label pattern for #27497). #27852 was chosen because:
Functionally all three PRs (yours, #27581, #27852) do the same thing. Thanks for the parallel work. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes #27497.
Telegram inline-button labels are clipped on mobile when
clarifychoices are long, leaving users unable to read the full options. Previouslysend_clarifyrendered each option only as an inline-keyboard button (label truncated to 60 chars in code, and further visually truncated by Telegram on mobile), with the message body containing only the question.This change moves the full option text into the message body as a numbered list and shortens inline-button labels to just the option index, so buttons always fit while the full text is readable in the chat.
Changes
gateway/platforms/telegram.py::send_clarifychoicesis non-empty, build message text as❓ <question>\n\n1. <choice1>\n2. <choice2>…, with each choice HTML-escaped."1","2", …) instead of"{n}. {label}".callback_data(cl:<id>:<idx>,cl:<id>:other) is unchanged — callback handling is untouched.Tests
tests/gateway/test_telegram_clarify_buttons.py::test_truncates_long_choice_labelrewritten to:f"{idx}. {choice}"line appears in the sent body."1","2","3","4").Notes
clarify_gatewaytext-capture path or the "Other" flow.