@anthusai/papyrus 1.0.0 → 1.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/amplify/auth/prospectus-google-client.js +66 -0
- package/amplify/auth/prospectus-google-client.ts +71 -0
- package/amplify/auth/resource.js +4 -1
- package/amplify/auth/resource.ts +5 -1
- package/amplify/data/schema.js +0 -2
- package/amplify/data/schema.ts +0 -2
- package/amplify/functions/email-submission-processor/handler.py +3 -1
- package/amplify/functions/ses-inbound-receive/handler.ts +32 -4
- package/amplify/functions/shared/email-submission.ts +109 -1
- package/amplify/site-backend.js +8 -1
- package/amplify/site-backend.ts +9 -1
- package/app/api/auth/prospectus/callback/route.ts +9 -0
- package/app/api/auth/prospectus/selection/route.ts +9 -0
- package/app/api/auth/prospectus/session/route.ts +9 -0
- package/app/api/auth/prospectus/sign-in/route.ts +9 -0
- package/app/api/auth/prospectus/sign-out/route.ts +9 -0
- package/app/tailwind.css +0 -6
- package/components/priming-proof-page.tsx +7 -5
- package/components/topic-steering-workspace.tsx +0 -2
- package/infra/amplify-app-shell.js +20 -2
- package/infra/amplify-app-shell.ts +22 -2
- package/infra/site-config.js +1 -1
- package/infra/site-config.ts +1 -1
- package/lib/priming-proof-report.ts +1 -0
- package/lib/prospectus-publication-access.ts +53 -0
- package/lib/prospectus-session.ts +196 -0
- package/lib/prospectus-sign-in-routes.ts +284 -0
- package/package.json +10 -8
- package/routes.manifest.json +56 -1
- package/components/ai-elements/message.tsx +0 -360
package/package.json
CHANGED
|
@@ -65,7 +65,6 @@
|
|
|
65
65
|
"default": "./infra/index.js"
|
|
66
66
|
},
|
|
67
67
|
"./components/ai-elements/conversation": "./components/ai-elements/conversation.tsx",
|
|
68
|
-
"./components/ai-elements/message": "./components/ai-elements/message.tsx",
|
|
69
68
|
"./components/ai-elements/model-selector": "./components/ai-elements/model-selector.tsx",
|
|
70
69
|
"./components/ai-elements/prompt-input": "./components/ai-elements/prompt-input.tsx",
|
|
71
70
|
"./components/ai-elements/shimmer": "./components/ai-elements/shimmer.tsx",
|
|
@@ -209,6 +208,9 @@
|
|
|
209
208
|
"./lib/presentation-footer": "./lib/presentation-footer.ts",
|
|
210
209
|
"./lib/pretext-layout": "./lib/pretext-layout.ts",
|
|
211
210
|
"./lib/priming-proof-report": "./lib/priming-proof-report.ts",
|
|
211
|
+
"./lib/prospectus-publication-access": "./lib/prospectus-publication-access.ts",
|
|
212
|
+
"./lib/prospectus-session": "./lib/prospectus-session.ts",
|
|
213
|
+
"./lib/prospectus-sign-in-routes": "./lib/prospectus-sign-in-routes.ts",
|
|
212
214
|
"./lib/prospectus-site-identity": "./lib/prospectus-site-identity.ts",
|
|
213
215
|
"./lib/public-placeholder-config": "./lib/public-placeholder-config.ts",
|
|
214
216
|
"./lib/publication-cyclotron": "./lib/publication-cyclotron.ts",
|
|
@@ -264,6 +266,11 @@
|
|
|
264
266
|
"./app/[year]/[month]/[day]/page/[pageNumber]/page": "./app/[year]/[month]/[day]/page/[pageNumber]/page.tsx",
|
|
265
267
|
"./app/[year]/[month]/[day]/section/[sectionKey]/page": "./app/[year]/[month]/[day]/section/[sectionKey]/page.tsx",
|
|
266
268
|
"./app/api/archive/editions/route": "./app/api/archive/editions/route.ts",
|
|
269
|
+
"./app/api/auth/prospectus/callback/route": "./app/api/auth/prospectus/callback/route.ts",
|
|
270
|
+
"./app/api/auth/prospectus/selection/route": "./app/api/auth/prospectus/selection/route.ts",
|
|
271
|
+
"./app/api/auth/prospectus/session/route": "./app/api/auth/prospectus/session/route.ts",
|
|
272
|
+
"./app/api/auth/prospectus/sign-in/route": "./app/api/auth/prospectus/sign-in/route.ts",
|
|
273
|
+
"./app/api/auth/prospectus/sign-out/route": "./app/api/auth/prospectus/sign-out/route.ts",
|
|
267
274
|
"./app/api/cyclotron/priming-proof/route": "./app/api/cyclotron/priming-proof/route.ts",
|
|
268
275
|
"./app/api/media/[...path]/route": "./app/api/media/[...path]/route.ts",
|
|
269
276
|
"./app/api/revalidate/route": "./app/api/revalidate/route.ts",
|
|
@@ -332,13 +339,14 @@
|
|
|
332
339
|
"optional": true
|
|
333
340
|
}
|
|
334
341
|
},
|
|
335
|
-
"version": "1.
|
|
342
|
+
"version": "1.1.0",
|
|
336
343
|
"dependencies": {
|
|
337
344
|
"@aws-amplify/adapter-nextjs": "^1.7.3",
|
|
338
345
|
"@aws-crypto/sha256-js": "5.2.0",
|
|
339
346
|
"@aws-sdk/client-cognito-identity-provider": "3.1045.0",
|
|
340
347
|
"@aws-sdk/client-lambda": "^3.1045.0",
|
|
341
348
|
"@aws-sdk/client-s3": "^3.1045.0",
|
|
349
|
+
"@aws-sdk/client-secrets-manager": "3.1045.0",
|
|
342
350
|
"@aws-sdk/client-ssm": "^3.1045.0",
|
|
343
351
|
"@aws-sdk/credential-provider-node": "3.972.84",
|
|
344
352
|
"@aws-sdk/s3-request-presigner": "^3.1045.0",
|
|
@@ -348,10 +356,6 @@
|
|
|
348
356
|
"@radix-ui/colors": "3.0.0",
|
|
349
357
|
"@smithy/protocol-http": "5.4.1",
|
|
350
358
|
"@smithy/signature-v4": "5.7.4",
|
|
351
|
-
"@streamdown/cjk": "^1.0.3",
|
|
352
|
-
"@streamdown/code": "^1.1.1",
|
|
353
|
-
"@streamdown/math": "^1.0.2",
|
|
354
|
-
"@streamdown/mermaid": "^1.0.2",
|
|
355
359
|
"@tailwindcss/postcss": "^4.3.0",
|
|
356
360
|
"ai": "^6.0.191",
|
|
357
361
|
"anthus-vultus": "github:AnthusAI/Vultus#af98d57",
|
|
@@ -364,12 +368,10 @@
|
|
|
364
368
|
"esbuild": "^0.28.2",
|
|
365
369
|
"gray-matter": "^4.0.3",
|
|
366
370
|
"gsap": "^3.15.0",
|
|
367
|
-
"katex": "^0.17.0",
|
|
368
371
|
"lucide-react": "^1.16.0",
|
|
369
372
|
"motion": "^12.40.0",
|
|
370
373
|
"nanoid": "^5.1.11",
|
|
371
374
|
"shadcn": "^4.8.0",
|
|
372
|
-
"streamdown": "^2.5.0",
|
|
373
375
|
"tailwind-merge": "^3.6.0",
|
|
374
376
|
"tailwindcss": "^4.3.0",
|
|
375
377
|
"tsx": "^4.23.15",
|
package/routes.manifest.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version": "1.
|
|
2
|
+
"version": "1.1.0",
|
|
3
3
|
"routes": [
|
|
4
4
|
{
|
|
5
5
|
"file": "app/%5F_preview/[[...path]]/route.ts",
|
|
@@ -66,6 +66,61 @@
|
|
|
66
66
|
"revalidate": "60"
|
|
67
67
|
}
|
|
68
68
|
},
|
|
69
|
+
{
|
|
70
|
+
"file": "app/api/auth/prospectus/callback/route.ts",
|
|
71
|
+
"hasDefault": false,
|
|
72
|
+
"exports": [
|
|
73
|
+
"GET"
|
|
74
|
+
],
|
|
75
|
+
"config": {
|
|
76
|
+
"dynamic": "\"force-dynamic\"",
|
|
77
|
+
"runtime": "\"nodejs\""
|
|
78
|
+
}
|
|
79
|
+
},
|
|
80
|
+
{
|
|
81
|
+
"file": "app/api/auth/prospectus/selection/route.ts",
|
|
82
|
+
"hasDefault": false,
|
|
83
|
+
"exports": [
|
|
84
|
+
"POST"
|
|
85
|
+
],
|
|
86
|
+
"config": {
|
|
87
|
+
"dynamic": "\"force-dynamic\"",
|
|
88
|
+
"runtime": "\"nodejs\""
|
|
89
|
+
}
|
|
90
|
+
},
|
|
91
|
+
{
|
|
92
|
+
"file": "app/api/auth/prospectus/session/route.ts",
|
|
93
|
+
"hasDefault": false,
|
|
94
|
+
"exports": [
|
|
95
|
+
"GET"
|
|
96
|
+
],
|
|
97
|
+
"config": {
|
|
98
|
+
"dynamic": "\"force-dynamic\"",
|
|
99
|
+
"runtime": "\"nodejs\""
|
|
100
|
+
}
|
|
101
|
+
},
|
|
102
|
+
{
|
|
103
|
+
"file": "app/api/auth/prospectus/sign-in/route.ts",
|
|
104
|
+
"hasDefault": false,
|
|
105
|
+
"exports": [
|
|
106
|
+
"GET"
|
|
107
|
+
],
|
|
108
|
+
"config": {
|
|
109
|
+
"dynamic": "\"force-dynamic\"",
|
|
110
|
+
"runtime": "\"nodejs\""
|
|
111
|
+
}
|
|
112
|
+
},
|
|
113
|
+
{
|
|
114
|
+
"file": "app/api/auth/prospectus/sign-out/route.ts",
|
|
115
|
+
"hasDefault": false,
|
|
116
|
+
"exports": [
|
|
117
|
+
"POST"
|
|
118
|
+
],
|
|
119
|
+
"config": {
|
|
120
|
+
"dynamic": "\"force-dynamic\"",
|
|
121
|
+
"runtime": "\"nodejs\""
|
|
122
|
+
}
|
|
123
|
+
},
|
|
69
124
|
{
|
|
70
125
|
"file": "app/api/cyclotron/priming-proof/route.ts",
|
|
71
126
|
"hasDefault": false,
|
|
@@ -1,360 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
|
|
3
|
-
import { Button } from "../ui/button";
|
|
4
|
-
import {
|
|
5
|
-
ButtonGroup,
|
|
6
|
-
ButtonGroupText,
|
|
7
|
-
} from "../ui/button-group";
|
|
8
|
-
import {
|
|
9
|
-
Tooltip,
|
|
10
|
-
TooltipContent,
|
|
11
|
-
TooltipProvider,
|
|
12
|
-
TooltipTrigger,
|
|
13
|
-
} from "../ui/tooltip";
|
|
14
|
-
import { cn } from "../../lib/utils";
|
|
15
|
-
import { cjk } from "@streamdown/cjk";
|
|
16
|
-
import { code } from "@streamdown/code";
|
|
17
|
-
import { math } from "@streamdown/math";
|
|
18
|
-
import { mermaid } from "@streamdown/mermaid";
|
|
19
|
-
import type { UIMessage } from "ai";
|
|
20
|
-
import { ChevronLeftIcon, ChevronRightIcon } from "lucide-react";
|
|
21
|
-
import type { ComponentProps, HTMLAttributes, ReactElement } from "react";
|
|
22
|
-
import {
|
|
23
|
-
createContext,
|
|
24
|
-
memo,
|
|
25
|
-
useCallback,
|
|
26
|
-
useContext,
|
|
27
|
-
useEffect,
|
|
28
|
-
useMemo,
|
|
29
|
-
useState,
|
|
30
|
-
} from "react";
|
|
31
|
-
import { Streamdown } from "streamdown";
|
|
32
|
-
|
|
33
|
-
export type MessageProps = HTMLAttributes<HTMLDivElement> & {
|
|
34
|
-
from: UIMessage["role"];
|
|
35
|
-
};
|
|
36
|
-
|
|
37
|
-
export const Message = ({ className, from, ...props }: MessageProps) => (
|
|
38
|
-
<div
|
|
39
|
-
className={cn(
|
|
40
|
-
"group flex w-full max-w-[95%] flex-col gap-2",
|
|
41
|
-
from === "user" ? "is-user ml-auto justify-end" : "is-assistant",
|
|
42
|
-
className
|
|
43
|
-
)}
|
|
44
|
-
{...props}
|
|
45
|
-
/>
|
|
46
|
-
);
|
|
47
|
-
|
|
48
|
-
export type MessageContentProps = HTMLAttributes<HTMLDivElement>;
|
|
49
|
-
|
|
50
|
-
export const MessageContent = ({
|
|
51
|
-
children,
|
|
52
|
-
className,
|
|
53
|
-
...props
|
|
54
|
-
}: MessageContentProps) => (
|
|
55
|
-
<div
|
|
56
|
-
className={cn(
|
|
57
|
-
"is-user:dark flex w-fit min-w-0 max-w-full flex-col gap-2 overflow-hidden text-sm",
|
|
58
|
-
"group-[.is-user]:ml-auto group-[.is-user]:rounded-lg group-[.is-user]:bg-secondary group-[.is-user]:px-4 group-[.is-user]:py-3 group-[.is-user]:text-foreground",
|
|
59
|
-
"group-[.is-assistant]:text-foreground",
|
|
60
|
-
className
|
|
61
|
-
)}
|
|
62
|
-
{...props}
|
|
63
|
-
>
|
|
64
|
-
{children}
|
|
65
|
-
</div>
|
|
66
|
-
);
|
|
67
|
-
|
|
68
|
-
export type MessageActionsProps = ComponentProps<"div">;
|
|
69
|
-
|
|
70
|
-
export const MessageActions = ({
|
|
71
|
-
className,
|
|
72
|
-
children,
|
|
73
|
-
...props
|
|
74
|
-
}: MessageActionsProps) => (
|
|
75
|
-
<div className={cn("flex items-center gap-1", className)} {...props}>
|
|
76
|
-
{children}
|
|
77
|
-
</div>
|
|
78
|
-
);
|
|
79
|
-
|
|
80
|
-
export type MessageActionProps = ComponentProps<typeof Button> & {
|
|
81
|
-
tooltip?: string;
|
|
82
|
-
label?: string;
|
|
83
|
-
};
|
|
84
|
-
|
|
85
|
-
export const MessageAction = ({
|
|
86
|
-
tooltip,
|
|
87
|
-
children,
|
|
88
|
-
label,
|
|
89
|
-
variant = "ghost",
|
|
90
|
-
size = "icon-sm",
|
|
91
|
-
...props
|
|
92
|
-
}: MessageActionProps) => {
|
|
93
|
-
const button = (
|
|
94
|
-
<Button size={size} type="button" variant={variant} {...props}>
|
|
95
|
-
{children}
|
|
96
|
-
<span className="sr-only">{label || tooltip}</span>
|
|
97
|
-
</Button>
|
|
98
|
-
);
|
|
99
|
-
|
|
100
|
-
if (tooltip) {
|
|
101
|
-
return (
|
|
102
|
-
<TooltipProvider>
|
|
103
|
-
<Tooltip>
|
|
104
|
-
<TooltipTrigger>{button}</TooltipTrigger>
|
|
105
|
-
<TooltipContent>
|
|
106
|
-
<p>{tooltip}</p>
|
|
107
|
-
</TooltipContent>
|
|
108
|
-
</Tooltip>
|
|
109
|
-
</TooltipProvider>
|
|
110
|
-
);
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
return button;
|
|
114
|
-
};
|
|
115
|
-
|
|
116
|
-
interface MessageBranchContextType {
|
|
117
|
-
currentBranch: number;
|
|
118
|
-
totalBranches: number;
|
|
119
|
-
goToPrevious: () => void;
|
|
120
|
-
goToNext: () => void;
|
|
121
|
-
branches: ReactElement[];
|
|
122
|
-
setBranches: (branches: ReactElement[]) => void;
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
const MessageBranchContext = createContext<MessageBranchContextType | null>(
|
|
126
|
-
null
|
|
127
|
-
);
|
|
128
|
-
|
|
129
|
-
const useMessageBranch = () => {
|
|
130
|
-
const context = useContext(MessageBranchContext);
|
|
131
|
-
|
|
132
|
-
if (!context) {
|
|
133
|
-
throw new Error(
|
|
134
|
-
"MessageBranch components must be used within MessageBranch"
|
|
135
|
-
);
|
|
136
|
-
}
|
|
137
|
-
|
|
138
|
-
return context;
|
|
139
|
-
};
|
|
140
|
-
|
|
141
|
-
export type MessageBranchProps = HTMLAttributes<HTMLDivElement> & {
|
|
142
|
-
defaultBranch?: number;
|
|
143
|
-
onBranchChange?: (branchIndex: number) => void;
|
|
144
|
-
};
|
|
145
|
-
|
|
146
|
-
export const MessageBranch = ({
|
|
147
|
-
defaultBranch = 0,
|
|
148
|
-
onBranchChange,
|
|
149
|
-
className,
|
|
150
|
-
...props
|
|
151
|
-
}: MessageBranchProps) => {
|
|
152
|
-
const [currentBranch, setCurrentBranch] = useState(defaultBranch);
|
|
153
|
-
const [branches, setBranches] = useState<ReactElement[]>([]);
|
|
154
|
-
|
|
155
|
-
const handleBranchChange = useCallback(
|
|
156
|
-
(newBranch: number) => {
|
|
157
|
-
setCurrentBranch(newBranch);
|
|
158
|
-
onBranchChange?.(newBranch);
|
|
159
|
-
},
|
|
160
|
-
[onBranchChange]
|
|
161
|
-
);
|
|
162
|
-
|
|
163
|
-
const goToPrevious = useCallback(() => {
|
|
164
|
-
const newBranch =
|
|
165
|
-
currentBranch > 0 ? currentBranch - 1 : branches.length - 1;
|
|
166
|
-
handleBranchChange(newBranch);
|
|
167
|
-
}, [currentBranch, branches.length, handleBranchChange]);
|
|
168
|
-
|
|
169
|
-
const goToNext = useCallback(() => {
|
|
170
|
-
const newBranch =
|
|
171
|
-
currentBranch < branches.length - 1 ? currentBranch + 1 : 0;
|
|
172
|
-
handleBranchChange(newBranch);
|
|
173
|
-
}, [currentBranch, branches.length, handleBranchChange]);
|
|
174
|
-
|
|
175
|
-
const contextValue = useMemo<MessageBranchContextType>(
|
|
176
|
-
() => ({
|
|
177
|
-
branches,
|
|
178
|
-
currentBranch,
|
|
179
|
-
goToNext,
|
|
180
|
-
goToPrevious,
|
|
181
|
-
setBranches,
|
|
182
|
-
totalBranches: branches.length,
|
|
183
|
-
}),
|
|
184
|
-
[branches, currentBranch, goToNext, goToPrevious]
|
|
185
|
-
);
|
|
186
|
-
|
|
187
|
-
return (
|
|
188
|
-
<MessageBranchContext.Provider value={contextValue}>
|
|
189
|
-
<div
|
|
190
|
-
className={cn("grid w-full gap-2 [&>div]:pb-0", className)}
|
|
191
|
-
{...props}
|
|
192
|
-
/>
|
|
193
|
-
</MessageBranchContext.Provider>
|
|
194
|
-
);
|
|
195
|
-
};
|
|
196
|
-
|
|
197
|
-
export type MessageBranchContentProps = HTMLAttributes<HTMLDivElement>;
|
|
198
|
-
|
|
199
|
-
export const MessageBranchContent = ({
|
|
200
|
-
children,
|
|
201
|
-
...props
|
|
202
|
-
}: MessageBranchContentProps) => {
|
|
203
|
-
const { currentBranch, setBranches, branches } = useMessageBranch();
|
|
204
|
-
const childrenArray = useMemo(
|
|
205
|
-
() => (Array.isArray(children) ? children : [children]),
|
|
206
|
-
[children]
|
|
207
|
-
);
|
|
208
|
-
|
|
209
|
-
// Use useEffect to update branches when they change
|
|
210
|
-
useEffect(() => {
|
|
211
|
-
if (branches.length !== childrenArray.length) {
|
|
212
|
-
setBranches(childrenArray);
|
|
213
|
-
}
|
|
214
|
-
}, [childrenArray, branches, setBranches]);
|
|
215
|
-
|
|
216
|
-
return childrenArray.map((branch, index) => (
|
|
217
|
-
<div
|
|
218
|
-
className={cn(
|
|
219
|
-
"grid gap-2 overflow-hidden [&>div]:pb-0",
|
|
220
|
-
index === currentBranch ? "block" : "hidden"
|
|
221
|
-
)}
|
|
222
|
-
key={branch.key}
|
|
223
|
-
{...props}
|
|
224
|
-
>
|
|
225
|
-
{branch}
|
|
226
|
-
</div>
|
|
227
|
-
));
|
|
228
|
-
};
|
|
229
|
-
|
|
230
|
-
export type MessageBranchSelectorProps = ComponentProps<typeof ButtonGroup>;
|
|
231
|
-
|
|
232
|
-
export const MessageBranchSelector = ({
|
|
233
|
-
className,
|
|
234
|
-
...props
|
|
235
|
-
}: MessageBranchSelectorProps) => {
|
|
236
|
-
const { totalBranches } = useMessageBranch();
|
|
237
|
-
|
|
238
|
-
// Don't render if there's only one branch
|
|
239
|
-
if (totalBranches <= 1) {
|
|
240
|
-
return null;
|
|
241
|
-
}
|
|
242
|
-
|
|
243
|
-
return (
|
|
244
|
-
<ButtonGroup
|
|
245
|
-
className={cn(
|
|
246
|
-
"[&>*:not(:first-child)]:rounded-l-md [&>*:not(:last-child)]:rounded-r-md",
|
|
247
|
-
className
|
|
248
|
-
)}
|
|
249
|
-
orientation="horizontal"
|
|
250
|
-
{...props}
|
|
251
|
-
/>
|
|
252
|
-
);
|
|
253
|
-
};
|
|
254
|
-
|
|
255
|
-
export type MessageBranchPreviousProps = ComponentProps<typeof Button>;
|
|
256
|
-
|
|
257
|
-
export const MessageBranchPrevious = ({
|
|
258
|
-
children,
|
|
259
|
-
...props
|
|
260
|
-
}: MessageBranchPreviousProps) => {
|
|
261
|
-
const { goToPrevious, totalBranches } = useMessageBranch();
|
|
262
|
-
|
|
263
|
-
return (
|
|
264
|
-
<Button
|
|
265
|
-
aria-label="Previous branch"
|
|
266
|
-
disabled={totalBranches <= 1}
|
|
267
|
-
onClick={goToPrevious}
|
|
268
|
-
size="icon-sm"
|
|
269
|
-
type="button"
|
|
270
|
-
variant="ghost"
|
|
271
|
-
{...props}
|
|
272
|
-
>
|
|
273
|
-
{children ?? <ChevronLeftIcon size={14} />}
|
|
274
|
-
</Button>
|
|
275
|
-
);
|
|
276
|
-
};
|
|
277
|
-
|
|
278
|
-
export type MessageBranchNextProps = ComponentProps<typeof Button>;
|
|
279
|
-
|
|
280
|
-
export const MessageBranchNext = ({
|
|
281
|
-
children,
|
|
282
|
-
...props
|
|
283
|
-
}: MessageBranchNextProps) => {
|
|
284
|
-
const { goToNext, totalBranches } = useMessageBranch();
|
|
285
|
-
|
|
286
|
-
return (
|
|
287
|
-
<Button
|
|
288
|
-
aria-label="Next branch"
|
|
289
|
-
disabled={totalBranches <= 1}
|
|
290
|
-
onClick={goToNext}
|
|
291
|
-
size="icon-sm"
|
|
292
|
-
type="button"
|
|
293
|
-
variant="ghost"
|
|
294
|
-
{...props}
|
|
295
|
-
>
|
|
296
|
-
{children ?? <ChevronRightIcon size={14} />}
|
|
297
|
-
</Button>
|
|
298
|
-
);
|
|
299
|
-
};
|
|
300
|
-
|
|
301
|
-
export type MessageBranchPageProps = HTMLAttributes<HTMLSpanElement>;
|
|
302
|
-
|
|
303
|
-
export const MessageBranchPage = ({
|
|
304
|
-
className,
|
|
305
|
-
...props
|
|
306
|
-
}: MessageBranchPageProps) => {
|
|
307
|
-
const { currentBranch, totalBranches } = useMessageBranch();
|
|
308
|
-
|
|
309
|
-
return (
|
|
310
|
-
<ButtonGroupText
|
|
311
|
-
className={cn(
|
|
312
|
-
"border-none bg-transparent text-muted-foreground shadow-none",
|
|
313
|
-
className
|
|
314
|
-
)}
|
|
315
|
-
{...props}
|
|
316
|
-
>
|
|
317
|
-
{currentBranch + 1} of {totalBranches}
|
|
318
|
-
</ButtonGroupText>
|
|
319
|
-
);
|
|
320
|
-
};
|
|
321
|
-
|
|
322
|
-
export type MessageResponseProps = ComponentProps<typeof Streamdown>;
|
|
323
|
-
|
|
324
|
-
const streamdownPlugins = { cjk, code, math, mermaid };
|
|
325
|
-
|
|
326
|
-
export const MessageResponse = memo(
|
|
327
|
-
({ className, ...props }: MessageResponseProps) => (
|
|
328
|
-
<Streamdown
|
|
329
|
-
className={cn(
|
|
330
|
-
"size-full [&>*:first-child]:mt-0 [&>*:last-child]:mb-0",
|
|
331
|
-
className
|
|
332
|
-
)}
|
|
333
|
-
plugins={streamdownPlugins}
|
|
334
|
-
{...props}
|
|
335
|
-
/>
|
|
336
|
-
),
|
|
337
|
-
(prevProps, nextProps) =>
|
|
338
|
-
prevProps.children === nextProps.children &&
|
|
339
|
-
nextProps.isAnimating === prevProps.isAnimating
|
|
340
|
-
);
|
|
341
|
-
|
|
342
|
-
MessageResponse.displayName = "MessageResponse";
|
|
343
|
-
|
|
344
|
-
export type MessageToolbarProps = ComponentProps<"div">;
|
|
345
|
-
|
|
346
|
-
export const MessageToolbar = ({
|
|
347
|
-
className,
|
|
348
|
-
children,
|
|
349
|
-
...props
|
|
350
|
-
}: MessageToolbarProps) => (
|
|
351
|
-
<div
|
|
352
|
-
className={cn(
|
|
353
|
-
"mt-4 flex w-full items-center justify-between gap-4",
|
|
354
|
-
className
|
|
355
|
-
)}
|
|
356
|
-
{...props}
|
|
357
|
-
>
|
|
358
|
-
{children}
|
|
359
|
-
</div>
|
|
360
|
-
);
|