Skip to content

Commit 3c2535c

Browse files
feat: add T3 Chat option to CopyPageDropdown (#613)
Add T3 Chat as an AI assistant option in the CopyPageDropdown menu, allowing users to open the current page in T3 Chat for Q&A. Co-authored-by: Tanner Linsley <tannerlinsley@gmail.com>
1 parent 6740ac3 commit 3c2535c

File tree

1 file changed

+34
-0
lines changed

1 file changed

+34
-0
lines changed

src/components/CopyPageDropdown.tsx

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,26 @@ function CursorIcon({ className }: { className?: string }) {
5656
)
5757
}
5858

59+
// T3 Chat icon
60+
function T3ChatIcon({ className }: { className?: string }) {
61+
return (
62+
<svg viewBox="0 0 258 199" fill="currentColor" className={className}>
63+
<path
64+
fillRule="evenodd"
65+
clipRule="evenodd"
66+
d="M165.735 25.0701L188.947 0.972412H0.465994V25.0701H165.735Z"
67+
/>
68+
<path d="M163.981 96.3239L254.022 3.68314L221.206 3.68295L145.617 80.7609L163.981 96.3239Z" />
69+
<path d="M233.658 131.418C233.658 155.075 214.48 174.254 190.823 174.254C171.715 174.254 155.513 161.738 150 144.439L146.625 133.848L127.329 153.143L129.092 157.336C139.215 181.421 163.034 198.354 190.823 198.354C227.791 198.354 257.759 168.386 257.759 131.418C257.759 106.937 244.399 85.7396 224.956 74.0905L220.395 71.3582L202.727 89.2528L210.788 93.5083C224.403 100.696 233.658 114.981 233.658 131.418Z" />
70+
<path
71+
fillRule="evenodd"
72+
clipRule="evenodd"
73+
d="M88.2625 192.669L88.2626 45.6459H64.1648L64.1648 192.669H88.2625Z"
74+
/>
75+
</svg>
76+
)
77+
}
78+
5979
// Cache for fetched markdown content
6080
const markdownCache = new Map<string, string>()
6181

@@ -173,6 +193,14 @@ export function CopyPageDropdown({
173193
)
174194
}
175195

196+
const handleOpenInT3Chat = () => {
197+
const pageUrl = window.location.href
198+
const prompt = encodeURIComponent(
199+
`Read from this URL: ${pageUrl} and explain it to me`,
200+
)
201+
window.open(`https://t3.chat/new?q=${prompt}`, '_blank')
202+
}
203+
176204
const menuItems = [
177205
{
178206
icon: MarkdownIcon,
@@ -192,6 +220,12 @@ export function CopyPageDropdown({
192220
description: 'Ask questions about this page',
193221
onSelect: handleOpenInChatGPT,
194222
},
223+
{
224+
icon: T3ChatIcon,
225+
label: 'Open in T3 Chat',
226+
description: 'Ask questions about this page',
227+
onSelect: handleOpenInT3Chat,
228+
},
195229
{
196230
icon: CursorIcon,
197231
label: 'Open in Cursor',

0 commit comments

Comments
 (0)