- {
}
+ {!turn.selectedText &&
+
}
+ {turn.selectedText &&
+
}
{isLoading &&
}
{turn.selectedText &&
}
{showSiteTitle &&
}
diff --git a/components/ai_chat/resources/page/components/quote/style.module.scss b/components/ai_chat/resources/page/components/quote/style.module.scss
index 56a0eb612ad..019332564f9 100644
--- a/components/ai_chat/resources/page/components/quote/style.module.scss
+++ b/components/ai_chat/resources/page/components/quote/style.module.scss
@@ -15,25 +15,24 @@
.text::before {
content: "";
+ position: absolute;
+ top: 0;
+ left: 0;
width: 3px;
+ height: 100%;
background: var(--leo-color-divider-strong);
border-radius: 2px;
- margin-right: 12px;
- flex: none;
- order: 0;
- align-self: stretch;
- flex-grow: 0;
}
.text {
width: 100%;
- display: flex;
- align-items: center;
+ display: -webkit-box;
+ -webkit-line-clamp: 4;
+ -webkit-box-orient: vertical;
+ overflow: hidden;
+ word-wrap: break-word;
+ position: relative;
+ padding-left: 18px;
letter-spacing: -0.1px;
color: var(--leo-color-text-secondary);
- flex: none;
- order: 1;
- align-self: stretch;
- flex-grow: 1;
}
-
diff --git a/components/ai_chat/resources/page/stories/components_panel.tsx b/components/ai_chat/resources/page/stories/components_panel.tsx
index 929a08d1954..95d66ffffb7 100644
--- a/components/ai_chat/resources/page/stories/components_panel.tsx
+++ b/components/ai_chat/resources/page/stories/components_panel.tsx
@@ -25,21 +25,21 @@ const HISTORY: mojom.ConversationTurn[] = [
characterType: mojom.CharacterType.HUMAN,
visibility: mojom.ConversationTurnVisibility.VISIBLE,
actionType: mojom.ActionType.UNSPECIFIED,
- selectedText: ''
+ selectedText: undefined
},
{
text: 'Hi, How are you?',
characterType: mojom.CharacterType.ASSISTANT,
visibility: mojom.ConversationTurnVisibility.VISIBLE,
actionType: mojom.ActionType.UNSPECIFIED,
- selectedText: ''
+ selectedText: undefined
},
{
text: 'What is pointer compression?',
characterType: mojom.CharacterType.HUMAN,
actionType: mojom.ActionType.QUERY,
visibility: mojom.ConversationTurnVisibility.VISIBLE,
- selectedText: 'Pointer compression is a memory optimization technique where pointers (memory addresses) are stored in a compressed format to save memory.'
+ selectedText: undefined
},
{
text: 'Pointer compression is a memory optimization technique where pointers (memory addresses) are stored in a compressed format to save memory. The basic idea is that since most pointers will be clustered together and point to objects allocated around the same time, you can store a compressed representation of the pointer and decompress it when needed. Some common ways this is done: Store an offset from a base pointer instead of the full pointer value Store increments/decrements from the previous pointer instead of the full value Use pointer tagging to store extra information in the low bits of the pointer Encode groups of pointers together The tradeoff is some extra CPU cost to decompress the pointers, versus saving memory. This technique is most useful in memory constrained environments.',
@@ -90,6 +90,20 @@ const HISTORY: mojom.ConversationTurn[] = [
visibility: mojom.ConversationTurnVisibility.VISIBLE,
selectedText: undefined
},
+ {
+ text: 'Shorten this selected text',
+ characterType: mojom.CharacterType.HUMAN,
+ actionType: mojom.ActionType.SHORTEN,
+ visibility: mojom.ConversationTurnVisibility.VISIBLE,
+ selectedText: 'Pointer compression is a memory optimization technique where pointers are stored in a compressed format to save memory.'
+ },
+ {
+ text: 'Pointer compression is a memory optimization technique.',
+ characterType: mojom.CharacterType.ASSISTANT,
+ actionType: mojom.ActionType.UNSPECIFIED,
+ visibility: mojom.ConversationTurnVisibility.VISIBLE,
+ selectedText: undefined
+ }
]
const MODELS: mojom.Model[] = [
diff --git a/components/ai_chat/resources/page/stories/locale.ts b/components/ai_chat/resources/page/stories/locale.ts
index d8547c5bcb9..37f5108f41f 100644
--- a/components/ai_chat/resources/page/stories/locale.ts
+++ b/components/ai_chat/resources/page/stories/locale.ts
@@ -87,4 +87,7 @@ provideStrings({
contextToggleLabel: 'Use page context for response',
contextToggleTooltipInfo: 'Toggle on to ask about this page. It\'s content will be sent to Brave Leo along with your messages.',
subscriptionPolicyInfo: 'All subscriptions are auto-renewed but can be cancelled at any time before renewal.',
+ summarizeLabel: 'Summarize',
+ changeLengthLabel: 'Change length',
+ shortenLabel: 'Shorten',
})
diff --git a/components/resources/ai_chat_prompts.grdp b/components/resources/ai_chat_prompts.grdp
index 990b0c5961b..005a62c2390 100644
--- a/components/resources/ai_chat_prompts.grdp
+++ b/components/resources/ai_chat_prompts.grdp
@@ -18,21 +18,21 @@ Here are some important rules for the interaction:
-Here is the user's question:
-<question>
+Here is the user's request:
+<request>
$1
-</question>
+</request>
-Here is the user's question about the excerpt:
-<question>
+Here is the user's request about the excerpt:
+<request>
$1
-</question>
+</request>
-How do you respond to the user's question? Put your response in <response></response> tags.
+How do you respond to the user's request? Put your response in <response></response> tags.
Here is the text of a web page in <page> tags:
<page>
@@ -57,7 +57,7 @@ The user selects this excerpt from the page content.
A user is watching this video.
-Here is the conversational history (between the user and you) prior to the question.
+Here is the conversational history (between the user and you) prior to the request.
<history>
$1
</history>
@@ -66,8 +66,21 @@ Here is the conversational history (between the user and you) prior to the quest
Propose up to 3 very short questions that a reader may ask about the content. Consider intriguing or unusual elements of the content, or structurally important. Separate each suggested question with the character "|". End the question list with a </response> tag.
Provide a concise list of up to 6 bullets on the most important points of the page.
-
Summarize the excerpt
+
Generate a summary of the excerpt.
Provide a concise list of up to 6 bullets of the most important points of the video.
+
Explain the excerpt in simple terms. Expand on concepts that might not be familiar to the user.
+
Rewrite the excerpt by paraphrasing. Include only the rewritten version in your response.
+
Use the excerpt to generate a tagline.
+
Use the excerpt to generate a post that could be used on social platforms like Twitter.
+
Use the excerpt to generate a post that could be used on social platforms like Reddit.
+
Improve the language of the excerpt. Include only the rewritten version in your response.
+
Rewrite the excerpt in simpler terms so that it is easier to understand for a general audience. Include only the rewritten version in your response.
+
Rewrite the excerpt in an academic tone. Include only the rewritten version in your response.
+
Rewrite the excerpt in a professional tone. Include only the rewritten version in your response.
+
Rewrite the excerpt in a casual tone. Include only the rewritten version in your response.
+
Rewrite the excerpt in a funny tone. Include only the rewritten version in your response.
+
Generate a shortened version of the excerpt in paragraph format by removing unnecessary details and refining the language for brevity. Include only the rewritten version in your response.
+
Generate a lengthened version of the excerpt in paragraph format by expanding on the details provided and adding more descriptive information where applicable. Include only the rewritten version in your response.
The current time and date is $1
@@ -83,15 +96,17 @@ Use unicode symbols for formatting where appropriate. Use backticks (`) to wrap
Here is your response:
-This is an excerpt of the page content in <excerpt> tags:
-
-<excerpt> $1 </excerpt>
+This is an excerpt of the page content:
+<excerpt>
+$1
+</excerpt>
-This is the text of a web page within <page> tags:
-
-<page> $1 </page>
+This is the text of a web page:
+<page>
+$1
+</page>
$2
diff --git a/components/resources/ai_chat_ui_strings.grdp b/components/resources/ai_chat_ui_strings.grdp
index 0bc726794ad..aeb635b23b9 100644
--- a/components/resources/ai_chat_ui_strings.grdp
+++ b/components/resources/ai_chat_ui_strings.grdp
@@ -36,9 +36,6 @@
Summarize this page
-
- Summarize this excerpt
-
Disconnect to stop sending this page content to Leo, and start a new conversation
@@ -267,4 +264,70 @@
Share the hostname of the page you are on ($1www.example.com) to help us make Leo better.
+
+ Leo tools
+
+
+ Quick actions
+
+
+ Create
+
+
+ Rewrite
+
+
+ Summarize
+
+
+ Short
+
+
+ Long
+
+
+ Blog post
+
+
+ Tagline
+
+
+ Paraphrase
+
+
+ Explain
+
+
+ Improve
+
+
+ Simplify
+
+
+ Change tone
+
+
+ Professional
+
+
+ Academic
+
+
+ Casual
+
+
+ Funny
+
+
+ Shorten
+
+
+ Expand
+
+
+ Change length
+
+
+ Social media post
+