AI Summarization
<msc-ai-summarization />
is a web component based on Chrome Built-in AI > Summarization API.
Web developers could use <msc-ai-summarization />
wrap article which want to adopt summarize feature.
Check the following demo and just press the 「Summarize」 button. Then Gemini will give you a short summary about the iPhone article.
Let's see what can <msc-ai-summarization />
do ?
Built for Apple Intelligence with the all-new A18 chip, both models feature Camera Control, powerful upgrades to the advanced camera system, the Action button to quickly access useful features, and a big boost in battery life
CUPERTINO, CALIFORNIA Apple today announced iPhone 16 and iPhone 16 Plus, built for Apple Intelligence, the easy-to-use personal intelligence system that understands personal context to deliver intelligence that is helpful and relevant while protecting user privacy. The iPhone 16 lineup also introduces Camera Control, which brings new ways to capture memories, and will help users quickly access visual intelligence to learn about objects or places around them faster than ever before. The powerful camera system features a 48MP Fusion camera with a 2x Telephoto option, giving users two cameras in one, while a new Ultra Wide camera enables macro photography. Next-generation Photographic Styles help users personalize their images, and spatial photo and video capture allows users to relive life’s precious memories with remarkable depth on Apple Vision Pro. The new A18 chip delivers a huge leap in performance and efficiency, enabling demanding AAA games, as well as a big boost in battery life.
iPhone 16 and iPhone 16 Plus will be available in five bold colors: black, white, pink, teal, and ultramarine. Pre-orders begin Friday, September 13, with availability beginning Friday, September 20.
“iPhone 16 and iPhone 16 Plus mark the beginning of a new era for iPhone with Apple Intelligence delivering powerful, personal, and private experiences to our users,” said Kaiann Drance, Apple’s vice president of Worldwide iPhone Product Marketing. “With new ways to discover the world around you and capture memories using Camera Control; a 48MP Fusion camera that gives you two optical-quality cameras in one; a big boost in battery life; and powerful, efficient performance thanks to the A18 chip, this is the perfect time for customers to upgrade or make the switch to iPhone.”
Basic Usage
<msc-ai-summarization />
is a web component. All we need to do is put the required script into your HTML document. Then follow <msc-ai-summarization />
's html structure and everything will be all set.
Required Script
Structure
Put <msc-ai-summarization />
into HTML document. It will have different functions and looks with attribute mutation.
Otherwise, developers could also choose remoteconfig to fetch config for <msc-ai-summarization />
.
JavaScript Instantiation
<msc-ai-summarization />
could also use JavaScript to create DOM element. Here comes some examples.
Style Customization
Developers could apply styles to decorate <msc-ai-summarization />
's looking.
Delevelopers could add className - align-container-size
to make <msc-ai-summarization />
's size same as container's size.(default is inline-size: 100%
only)
Otherwise, apply pseudo class ::part(trigger) to direct style the summarize button.
Attributes
<msc-ai-summarization />
supports some attributes to let it become more convenience & useful.
config
Set type
、length
、format
and sharedContext
for summarize setting.
- type
:Set type from key-points
、tl;dr
、teaser
and headline
. Default is key-points.
- length
:Set length from short
、medium
and long
. Default is short.
- format
:Set format from markdown
and plain-text
. Default is markdown.
- sharedContext
:Set sharedContext. Default is "".
disabled
Hides the summarize trigger button once set. It is false by default (not set).
l10n
Set localization for title or action buttons.
- subject
:Set dialog subject.
- introduction
:Set dialog result title.
- summarize
:Set summarize trigger button's content.
- showlongersummary
:Set advance button's content. (when lenght !== long)
- showshortersummary
:Set advance button's content. (when lenght === long)
Properties
Property Name | Type | Description |
---|---|---|
config
|
Object | Getter / Setter config. Developers could set type 、length 、format and sharedContext here. |
disabled
|
Boolean | Getter / Setter disabled. Hides the summarize trigger button once set. It is false by default. |
l10n
|
Object | Getter / Setter localization for title or action buttons. Developers could set subject 、introduction 、summarize 、showlongersummary and showshortersummary here. |
available
|
String | Getter available. Web developers will get "no" if current browser doesn't support Build-in AI. |
summary
|
String | Getter the last summary. |
Mathod
Mathod Signature | Description |
---|---|
summarize({ content = '', useDialog = false })
|
Go summarize. This is an async function. Default will take <msc-ai-summarization />'s children's text content. Developers could set useDialog to decide display summary by dialog or not. |
Events
Event Signature | Description |
---|---|
msc-ai-summarize-error
|
Fired when summarize process error occured. Developers could gather message information through event.detail. |
msc-ai-summarize-process
|
Fired when prompt processing. |
msc-ai-summarize-process-end
|
Fired when prompt process end. |