HyperChat icon indicating copy to clipboard operation
HyperChat copied to clipboard

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

Open FlaminSarge opened this issue 1 year ago • 6 comments

  • 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 avatar Sep 17 '24 12:09 FlaminSarge

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"
    }
}

FlaminSarge avatar Sep 17 '24 13:09 FlaminSarge

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?

danirukun avatar Sep 17 '24 17:09 danirukun

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

Candygoblen123 avatar Sep 17 '24 17:09 Candygoblen123

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 avatar Sep 17 '24 23:09 FlaminSarge

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

danirukun avatar Sep 28 '24 13:09 danirukun

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

KentoNishi avatar Oct 03 '24 15:10 KentoNishi

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

KentoNishi avatar Dec 16 '24 01:12 KentoNishi

what an absolutely fantastic pr @FlaminSarge u absolute legend

KentoNishi avatar Dec 16 '24 06:12 KentoNishi