Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Show YT's AI chat summary in a 'pinned'-style box if it is present #148

Merged
merged 14 commits into from
Dec 16, 2024

Conversation

FlaminSarge
Copy link
Contributor

@FlaminSarge FlaminSarge commented Sep 17, 2024

  • Uses subheader as a link to Google's support site for AI summaries
  • Dismissable and collapsible like pinned messages, but unlike stock YT it does not auto-dismiss after 12 seconds
  • Setting to hide it entirely (will update its visibility based on setting immediately without refresh)
  • Tested on ffox and on mv3 branch with chrome.

It's not perfect (icon and showtime fields remain unused right now) but it's pretty functional. Collapsing and dismissing both work as intended.
There are some hacky bits involved already to split the runs into header vs subheader vs message, so better ways to handle that would be nice, but YT's format for this action isn't ideal.
I tried adding the iconType stuff, but it resulted in the header being offset by the size of the name of the icon. Was not sure how to resolve.
As far as I can tell YT never sends this as a part of live chat data, only when first loading the chat, but hopefully it works the same if they do add it to live chat data as well.
I did not hook it up to dismiss when YT sends 'unpin' action, as a heads up.

Screenshots:

Setting Screenshot 2024-09-17 at 6 24 26 PM
With subheader as a link to https://support.google.com/youtube/thread/18138167?hl=en&msgid=284199217 : Screenshot 2024-09-17 at 5 52 56 PM
Before subheader change, but showing behavior alongside pinned msg: Screenshot 2024-09-17 at 6 05 58 AM Screenshot 2024-09-17 at 6 04 22 AM

@FlaminSarge
Copy link
Contributor Author

FlaminSarge commented Sep 17, 2024

YT's native implementation, for comparison (it hides any pinned msgs while it's active and auto-dismisses after 12 seconds):
Screenshot 2024-09-17 at 5 55 54 AM

YT's format:

"addBannerToLiveChatCommand": {
    "bannerRenderer": {
        "liveChatBannerRenderer": {
            "contents": {
                "liveChatBannerChatSummaryRenderer": {
                    "liveChatSummaryId": "_XUrqCfeLfg_1726265494507548",
                    "chatSummary": {
                        "runs": [{
                            "text": "Chat summary",
                            "bold": true,
                            "fontFace": "FONT_FACE_ROBOTO_MEDIUM"
                        }, {
                            "text": "\n"
                        }, {
                            "text": "Auto-generated experiment • Quality may vary",
                            "deemphasize": true,
                            "fontFace": "FONT_FACE_ROBOTO_MEDIUM"
                        }, {
                            "text": "\n"
                        }, {
                            "text": "Viewers are expressing excitement, support, and excitement for Fauna's performance of the song \"Oh, How the Mighty Have Fallen\" by Mother Mother.",
                            "fontFace": "FONT_FACE_ROBOTO_REGULAR"
                        }]
                    },
                    "icon": {
                        "iconType": "SPARK"
                    },
                    "trackingParams": "------"
                }
            },
            "actionId": "_XUrqCfeLfg_1726265494507548",
            "targetId": "live-chat-banner",
            "isStackable": true,
            "bannerProperties": {
                "isEphemeral": true,
                "autoCollapseDelay": {
                    "seconds": "30"
                }
            },
            "bannerType": "LIVE_CHAT_BANNER_TYPE_CHAT_SUMMARY"
        }
    },
    "bannerProperties": {
        "isEphemeral": true,
        "bannerTimeoutMs": "12000"
    }
}

@DaniruKun
Copy link
Member

I personally like that it doesn't interfere with the other pins like the native popup. Hmm do you think we need to make it clear that the AI summary is not a HyperChat feature?

@Candygoblen123
Copy link
Member

Candygoblen123 commented Sep 17, 2024

do you think we need to make it clear that the AI summary is not a HyperChat feature?

I think that we should. It can probably be done by just changing “Auto-generated experiment” to something like “auto-generated by YouTube” or “Auto-generated YouTube experiment”, or changing the title from “chat summary” to “chat summary by YouTube”. Though the specific language is up to you

@FlaminSarge
Copy link
Contributor Author

FlaminSarge commented Sep 17, 2024

I think that we should. It can probably be done by just changing “Auto-generated experiment” to something like “auto-generated by YouTube” or “Auto-generated YouTube experiment”, or changing the title from “chat summary” to “chat summary by YouTube”. Though the specific language is up to you

If someone can grab me the data for non-English YT UI (I bet it sends localized text), we should probably append to the existing text in subheader instead of overwriting it (so that it keeps some level of localization).

EDIT: Actually rather than trying to localize maybe it'd be better to just include a (!) icon with a link to https://support.google.com/youtube/thread/18138167?hl=en&msgid=284199217

EDIT2: I've just made the subheader link to the above, way simpler.

@FlaminSarge FlaminSarge marked this pull request as ready for review September 18, 2024 01:24
src/ts/chat-parser.ts Outdated Show resolved Hide resolved
src/ts/typings/ytc.d.ts Outdated Show resolved Hide resolved
@DaniruKun
Copy link
Member

@KentoNishi just looping you in, just needs a test and then include in the next release mb?

@KentoNishi KentoNishi self-assigned this Oct 3, 2024
@KentoNishi
Copy link
Member

my bad for being so late on this, was wrapped up with the iclr deadline. will review soon

Copy link
Member

@KentoNishi KentoNishi left a comment

Choose a reason for hiding this comment

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

this is brilliantly well implemented, i have no complaints whatsoever

@KentoNishi KentoNishi requested a review from r2dev2 December 16, 2024 01:58
@KentoNishi
Copy link
Member

@r2dev2 give it a quick scan, if it's good we can initiate the merge process

@KentoNishi KentoNishi merged commit b88ab55 into LiveTL:master Dec 16, 2024
2 checks passed
@KentoNishi
Copy link
Member

what an absolutely fantastic pr @FlaminSarge u absolute legend

@FlaminSarge FlaminSarge deleted the summary branch December 16, 2024 06:41
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.

5 participants