| 1 | import { ArrowUp, MessageSquare, RotateCcw, Settings2, Square } from "lucide-react"; |
| 2 | import { type FormEvent, type KeyboardEvent, useCallback, useEffect, useMemo, useRef, useState } from "react"; |
| 3 | import { Link, useLocation } from "react-router"; |
| 4 | |
| 5 | import { type AskSetup, type ChatLiveEvent, type ChatMessage, type Result } from "@g1t/contracts"; |
| 6 | |
| 7 | import { askPage, askWhere, browserTimeZone } from "../lib/ask"; |
| 8 | import { anyAnswering, applyLive, fromG1t, suggestions } from "../lib/g1t-chat"; |
| 9 | import { Conversation, ConversationContent, ConversationEmptyState, ConversationScrollButton } from "./ai-elements/conversation"; |
| 10 | import { Message, MessageContent } from "./ai-elements/message"; |
| 11 | import type { ResponseContext } from "./ai-elements/response"; |
| 12 | import { Suggestion, Suggestions } from "./ai-elements/suggestion"; |
| 13 | import { G1tAnswer } from "./chat/answer"; |
| 14 | import { useChatLive } from "./chat/live"; |
| 15 | import { MarkGlyph } from "./logo"; |
| 16 | import { Alert, AlertDescription, AlertTitle } from "./ui/alert"; |
| 17 | import { Button } from "./ui/button"; |
| 18 | import { Hint } from "./ui/hint"; |
| 19 | import { Kbd } from "./ui/kbd"; |
| 20 | import { SheetClose, SheetContent, SheetDescription, SheetHeader, SheetTitle } from "./ui/sheet"; |
| 21 | import { Skeleton } from "./ui/skeleton"; |
| 22 | import { Textarea } from "./ui/textarea"; |
| 23 | |
| 24 | /** |
| 25 | * Ask g1t: a conversation with g1t about your work, from the top bar. It |
| 26 | * is your direct message with @g1t in Chat: the same messages, the same |
| 27 | * answers, whichever you write in. The answers come from the AI provider |
| 28 | * and model an owner chose for the workspace (Integrations → Your AI |
| 29 | * providers → Ask g1t), on the workspace's own key: g1t hosts no model. |
| 30 | * |
| 31 | * Each question carries the page you are on, which g1t is told. The chat |
| 32 | * service has g1t answer, and the answer streams into the direct message |
| 33 | * over its live socket, so it shows here and in Chat at once. The panel |
| 34 | * shows the current conversation, since the latest "New conversation"; |
| 35 | * everything before it stays in Chat. |
| 36 | */ |
| 37 | |
| 38 | type Setup = AskSetup & { owner: boolean }; |
| 39 | type SetupAnswer = { ok: boolean; value?: AskSetup; error?: { message: string }; owner: boolean }; |
| 40 | type Shown = ChatMessage & { pending?: boolean; failed?: boolean }; |
| 41 | |
| 42 | const channelKey = (slug: string) => `g1t:ask-dm:${slug}`; |
| 43 | |
| 44 | function rememberedChannel(slug: string): string | null { |
| 45 | try { |
| 46 | return sessionStorage.getItem(channelKey(slug)); |
| 47 | } catch { |
| 48 | return null; |
| 49 | } |
| 50 | } |
| 51 | |
| 52 | function rememberChannel(slug: string, id: string) { |
| 53 | try { |
| 54 | sessionStorage.setItem(channelKey(slug), id); |
| 55 | } catch { |
| 56 | // Not kept: it is asked for again next time. |
| 57 | } |
| 58 | } |
| 59 | |
| 60 | async function chatApi<T>(slug: string, body: Record<string, unknown>): Promise<Result<T>> { |
| 61 | try { |
| 62 | const response = await fetch(`/${slug}/-/chat/api`, { method: "POST", headers: { "content-type": "application/json" }, body: JSON.stringify(body) }); |
| 63 | return (await response.json()) as Result<T>; |
| 64 | } catch { |
| 65 | return { ok: false, error: { code: "conflict", message: "g1t could not be reached. Check your connection and try again." } }; |
| 66 | } |
| 67 | } |
| 68 | |
| 69 | /** Oldest first, the newest message from each id. */ |
| 70 | function byId(list: Shown[]): Shown[] { |
| 71 | return [...new Map(list.map((m) => [m.id, m])).values()].sort((a, b) => (a.id < b.id ? -1 : a.id > b.id ? 1 : 0)); |
| 72 | } |
| 73 | |
| 74 | /** |
| 75 | * The viewer's direct message with @g1t, as the panel shows it. It belongs |
| 76 | * to the top bar's button, not the panel, so what was said stays while the |
| 77 | * panel is closed; the answer itself is kept by chat either way. |
| 78 | */ |
| 79 | function useG1tConversation(slug: string, open: boolean) { |
| 80 | const [channelId, setChannelId] = useState<string | null>(null); |
| 81 | const [messages, setMessages] = useState<Shown[]>([]); |
| 82 | const [loaded, setLoaded] = useState(false); |
| 83 | const [problem, setProblem] = useState<string | null>(null); |
| 84 | const opening = useRef<Promise<string | null> | null>(null); |
| 85 | |
| 86 | const channel = useCallback(async (): Promise<string | null> => { |
| 87 | if (channelId) return channelId; |
| 88 | opening.current ??= (async () => { |
| 89 | const remembered = rememberedChannel(slug); |
| 90 | if (remembered) return remembered; |
| 91 | const opened = await chatApi<{ channel: { id: string } }>(slug, { intent: "g1t_dm" }); |
| 92 | if (!opened.ok) { |
| 93 | setProblem(opened.error.message); |
| 94 | return null; |
| 95 | } |
| 96 | rememberChannel(slug, opened.value.channel.id); |
| 97 | return opened.value.channel.id; |
| 98 | })().finally(() => { |
| 99 | opening.current = null; |
| 100 | }); |
| 101 | const id = await opening.current; |
| 102 | if (id) setChannelId(id); |
| 103 | return id; |
| 104 | }, [channelId, slug]); |
| 105 | |
| 106 | const load = useCallback(async () => { |
| 107 | const id = await channel(); |
| 108 | if (!id) return; |
| 109 | try { |
| 110 | const response = await fetch(`/${slug}/-/chat/api?channel=${encodeURIComponent(id)}&limit=60`, { headers: { accept: "application/json" } }); |
| 111 | const page = (await response.json()) as Result<{ messages: ChatMessage[] }>; |
| 112 | if (page.ok) { |
| 113 | setMessages((now) => byId([...now.filter((m) => m.pending), ...page.value.messages.filter((m) => !m.deleted_at && !m.thread_root)])); |
| 114 | setProblem(null); |
| 115 | } else if (page.error.code === "not_found") { |
| 116 | // Kept from another session that no longer has it: open it again. |
| 117 | try { |
| 118 | sessionStorage.removeItem(channelKey(slug)); |
| 119 | } catch { |
| 120 | // Nothing kept. |
| 121 | } |
| 122 | setChannelId(null); |
| 123 | } else setProblem(page.error.message); |
| 124 | } catch { |
| 125 | setProblem("g1t could not be reached. Check your connection and try again."); |
| 126 | } |
| 127 | setLoaded(true); |
| 128 | }, [channel, slug]); |
| 129 | |
| 130 | useEffect(() => { |
| 131 | if (open) void load(); |
| 132 | }, [open, load]); |
| 133 | |
| 134 | const onEvent = useCallback((event: ChatLiveEvent) => { |
| 135 | if (!channelId) return; |
| 136 | setMessages((now) => applyLive(now, event, channelId) as Shown[]); |
| 137 | }, [channelId]); |
| 138 | |
| 139 | const ask = useCallback( |
| 140 | async (text: string, pathname: string) => { |
| 141 | const body = text.trim(); |
| 142 | if (!body) return; |
| 143 | const id = await channel(); |
| 144 | if (!id) return; |
| 145 | const pendingId = `~pending-${Date.now().toString(36)}`; |
| 146 | const pending: Shown = { |
| 147 | id: pendingId, |
| 148 | channel_id: id, |
| 149 | author: { kind: "user", id: "", name: "", display_name: "", avatar: null, role: null }, |
| 150 | kind: "text", |
| 151 | body, |
| 152 | card: null, |
| 153 | thread_root: null, |
| 154 | reply_count: 0, |
| 155 | last_reply_at: null, |
| 156 | created_at: new Date().toISOString(), |
| 157 | edited_at: null, |
| 158 | deleted_at: null, |
| 159 | pending: true, |
| 160 | }; |
| 161 | setMessages((now) => [...now, pending]); |
| 162 | const saved = await chatApi<ChatMessage>(slug, { intent: "post", channel_id: id, body, page: { ...askPage(pathname), time_zone: browserTimeZone() } }); |
| 163 | setMessages((now) => (saved.ok ? byId([...now.filter((m) => m.id !== pendingId), saved.value]) : now.map((m) => (m.id === pendingId ? { ...m, failed: true } : m)))); |
| 164 | // The answer arrives over the socket; should it have opened late, ask once more. |
| 165 | if (saved.ok) setTimeout(() => void load(), 1_500); |
| 166 | }, |
| 167 | [channel, slug, load], |
| 168 | ); |
| 169 | |
| 170 | const act = useCallback( |
| 171 | async (intent: "g1t_stop" | "g1t_reset" | "g1t_retry") => { |
| 172 | const id = await channel(); |
| 173 | if (!id) return; |
| 174 | const done = await chatApi<ChatMessage | null>(slug, { intent, channel_id: id }); |
| 175 | if (!done.ok) setProblem(done.error.message); |
| 176 | else if (intent === "g1t_reset" && done.value) setMessages((now) => byId([...now, done.value as ChatMessage])); |
| 177 | }, |
| 178 | [channel, slug], |
| 179 | ); |
| 180 | |
| 181 | return { channelId, messages, loaded, problem, ask, act, load, onEvent }; |
| 182 | } |
| 183 | |
| 184 | type G1tConversation = ReturnType<typeof useG1tConversation>; |
| 185 | |
| 186 | /** |
| 187 | * The Ask panel's sheet (components/ask-button.tsx loads it the first time |
| 188 | * the top bar's Ask opens, so pages don't carry it until then): the |
| 189 | * conversation, kept while the panel is closed. |
| 190 | */ |
| 191 | export function AskSheet({ slug, open }: { slug: string; open: boolean }) { |
| 192 | const conversation = useG1tConversation(slug, open); |
| 193 | const busy = anyAnswering(conversation.messages); |
| 194 | return ( |
| 195 | <SheetContent |
| 196 | side="right" |
| 197 | className="sm:max-w-xl" |
| 198 | // Esc stops an answer still coming first; pressed again, it closes the panel. |
| 199 | onEscapeKeyDown={(event) => { |
| 200 | if (!busy) return; |
| 201 | event.preventDefault(); |
| 202 | void conversation.act("g1t_stop"); |
| 203 | }} |
| 204 | > |
| 205 | <AskPanel slug={slug} open={open} conversation={conversation} /> |
| 206 | </SheetContent> |
| 207 | ); |
| 208 | } |
| 209 | |
| 210 | /** The live socket of the direct message, while the panel is open. */ |
| 211 | function LiveSocket({ slug, channelId, onEvent, onReconnect }: { slug: string; channelId: string; onEvent: (event: ChatLiveEvent) => void; onReconnect: () => void }) { |
| 212 | useChatLive(slug, channelId, onEvent, onReconnect); |
| 213 | return null; |
| 214 | } |
| 215 | |
| 216 | function AskPanel({ slug, open, conversation }: { slug: string; open: boolean; conversation: G1tConversation }) { |
| 217 | const { pathname } = useLocation(); |
| 218 | const { channelId, messages, loaded, problem, ask, act, load, onEvent } = conversation; |
| 219 | const [setup, setSetup] = useState<Setup | null>(null); |
| 220 | const [setupError, setSetupError] = useState<string | null>(null); |
| 221 | const [draft, setDraft] = useState(""); |
| 222 | const input = useRef<HTMLTextAreaElement>(null); |
| 223 | |
| 224 | // What Ask answers with, each time it opens: an owner may have changed it. |
| 225 | useEffect(() => { |
| 226 | if (!open) return; |
| 227 | let live = true; |
| 228 | fetch(`/${slug}/-/ask`, { headers: { accept: "application/json" } }) |
| 229 | .then((response) => (response.ok ? (response.json() as Promise<SetupAnswer>) : Promise.reject(new Error(String(response.status))))) |
| 230 | .then((answer) => { |
| 231 | if (!live) return; |
| 232 | if (answer.ok && answer.value) { |
| 233 | setSetup({ ...answer.value, owner: answer.owner }); |
| 234 | setSetupError(null); |
| 235 | } else setSetupError(answer.error?.message ?? "Ask could not be loaded."); |
| 236 | }) |
| 237 | .catch(() => live && setSetupError("Ask could not be loaded. Try again in a moment.")); |
| 238 | return () => { |
| 239 | live = false; |
| 240 | }; |
| 241 | }, [open, slug]); |
| 242 | |
| 243 | useEffect(() => { |
| 244 | if (open) requestAnimationFrame(() => input.current?.focus()); |
| 245 | }, [open]); |
| 246 | |
| 247 | // ⌘K or Ctrl+K, while the panel is open, goes to its box rather than the command palette. |
| 248 | useEffect(() => { |
| 249 | if (!open) return; |
| 250 | const onKey = (event: globalThis.KeyboardEvent) => { |
| 251 | if ((event.metaKey || event.ctrlKey) && event.key.toLowerCase() === "k") { |
| 252 | event.preventDefault(); |
| 253 | event.stopImmediatePropagation(); |
| 254 | input.current?.focus(); |
| 255 | } |
| 256 | }; |
| 257 | window.addEventListener("keydown", onKey, { capture: true }); |
| 258 | return () => window.removeEventListener("keydown", onKey, { capture: true }); |
| 259 | }, [open]); |
| 260 | |
| 261 | // The current conversation: what came after the latest "New conversation". |
| 262 | const shown = useMemo(() => { |
| 263 | let start = 0; |
| 264 | messages.forEach((m, index) => { |
| 265 | if (m.reset && fromG1t(m)) start = index + 1; |
| 266 | }); |
| 267 | return messages.slice(start); |
| 268 | }, [messages]); |
| 269 | const earlier = shown.length < messages.length; |
| 270 | const busy = anyAnswering(messages); |
| 271 | const ready = setup != null && setup.problem == null; |
| 272 | const where = askPage(pathname); |
| 273 | const lastAnswer = [...shown].reverse().find((m) => !m.pending); |
| 274 | const context = useMemo<ResponseContext>(() => ({ slug, repo: where.repo ?? null }), [slug, where.repo?.namespace, where.repo?.name]); |
| 275 | |
| 276 | const send = (text: string) => { |
| 277 | if (!ready || busy || !text.trim()) return; |
| 278 | setDraft(""); |
| 279 | void ask(text, pathname); |
| 280 | }; |
| 281 | const submit = (event: FormEvent) => { |
| 282 | event.preventDefault(); |
| 283 | send(draft); |
| 284 | }; |
| 285 | const onKeyDown = (event: KeyboardEvent<HTMLTextAreaElement>) => { |
| 286 | if (event.key === "Enter" && !event.shiftKey && !event.nativeEvent.isComposing) { |
| 287 | event.preventDefault(); |
| 288 | send(draft); |
| 289 | } |
| 290 | }; |
| 291 | const fresh = () => { |
| 292 | void act("g1t_reset"); |
| 293 | input.current?.focus(); |
| 294 | }; |
| 295 | |
| 296 | return ( |
| 297 | <> |
| 298 | {open && channelId && <LiveSocket slug={slug} channelId={channelId} onEvent={onEvent} onReconnect={() => void load()} />} |
| 299 | <SheetHeader className="gap-1 border-b border-line pb-3"> |
| 300 | <SheetTitle className="flex items-center gap-2"> |
| 301 | <MarkGlyph className="h-3.5" /> |
| 302 | Ask g1t |
| 303 | </SheetTitle> |
| 304 | <SheetDescription className="sr-only">A conversation with g1t about your work in {slug}. It is your direct message with g1t in Chat.</SheetDescription> |
| 305 | <div className="flex min-h-7 flex-wrap items-center gap-2 text-xs text-muted"> |
| 306 | {setup == null && !setupError ? ( |
| 307 | <Skeleton className="h-4 w-40" /> |
| 308 | ) : ready ? ( |
| 309 | <span className="min-w-0 truncate"> |
| 310 | Answers with {setup.connection_name} · <span className="font-mono">{setup.model}</span> |
| 311 | </span> |
| 312 | ) : ( |
| 313 | <span>Not set up yet</span> |
| 314 | )} |
| 315 | <span className="ml-auto flex items-center gap-0.5"> |
| 316 | {setup?.owner && ( |
| 317 | <Hint label="Choose the provider and model"> |
| 318 | <Button asChild variant="ghost" size="icon-xs" aria-label="Choose the provider and model"> |
| 319 | <Link to={`/${slug}/-/integrations/models#ask`}> |
| 320 | <Settings2 size={14} /> |
| 321 | </Link> |
| 322 | </Button> |
| 323 | </Hint> |
| 324 | )} |
| 325 | {channelId && ( |
| 326 | <Hint label="Open this conversation in Chat"> |
| 327 | <Button asChild variant="ghost" size="icon-xs" aria-label="Open in Chat"> |
| 328 | <Link to={`/${slug}/-/chat/dm/${channelId}`}> |
| 329 | <MessageSquare size={14} /> |
| 330 | </Link> |
| 331 | </Button> |
| 332 | </Hint> |
| 333 | )} |
| 334 | <Hint label="New conversation: g1t reads only what comes next"> |
| 335 | <Button variant="ghost" size="xs" onClick={fresh} disabled={shown.length === 0}> |
| 336 | <RotateCcw size={13} /> |
| 337 | New conversation |
| 338 | </Button> |
| 339 | </Hint> |
| 340 | </span> |
| 341 | </div> |
| 342 | </SheetHeader> |
| 343 | |
| 344 | <Conversation aria-busy={busy}> |
| 345 | <ConversationContent> |
| 346 | {setupError && ( |
| 347 | <Alert tone="danger"> |
| 348 | <AlertDescription className="text-danger">{setupError}</AlertDescription> |
| 349 | </Alert> |
| 350 | )} |
| 351 | {problem && ( |
| 352 | <Alert tone="danger"> |
| 353 | <AlertDescription className="text-danger">{problem}</AlertDescription> |
| 354 | </Alert> |
| 355 | )} |
| 356 | {setup && setup.problem && <NotSetUp slug={slug} setup={setup} />} |
| 357 | {earlier && channelId && ( |
| 358 | <p className="text-center text-xs text-faint"> |
| 359 | Earlier conversations are in{" "} |
| 360 | <Link to={`/${slug}/-/chat/dm/${channelId}`} className="text-accent hover:underline"> |
| 361 | your direct message with g1t |
| 362 | </Link> |
| 363 | . |
| 364 | </p> |
| 365 | )} |
| 366 | {!loaded && open ? ( |
| 367 | <div className="space-y-3" aria-busy="true"> |
| 368 | <Skeleton className="ml-auto h-9 w-2/3 rounded-2xl" /> |
| 369 | <Skeleton className="h-4 w-11/12" /> |
| 370 | <Skeleton className="h-4 w-3/4" /> |
| 371 | </div> |
| 372 | ) : shown.length === 0 && ready ? ( |
| 373 | <ConversationEmptyState className="pt-16"> |
| 374 | <MarkGlyph className="h-7" /> |
| 375 | <div className="space-y-1"> |
| 376 | <h3 className="text-base font-semibold text-fg">Ask about your work</h3> |
| 377 | <p className="max-w-sm text-sm text-muted"> |
| 378 | {where.repo |
| 379 | ? `g1t is told you're in ${where.repo.namespace}/${where.repo.name}${where.issue ? `, on issue #${where.issue}` : where.pull ? `, on pull request #${where.pull}` : ""}.` |
| 380 | : "g1t is told which page you're on, and reads the issue or pull request in front of you."} |
| 381 | </p> |
| 382 | </div> |
| 383 | <Suggestions className="mt-3 max-w-md justify-center"> |
| 384 | {suggestions(where).map((text) => ( |
| 385 | <Suggestion key={text} suggestion={text} onPick={send} /> |
| 386 | ))} |
| 387 | </Suggestions> |
| 388 | </ConversationEmptyState> |
| 389 | ) : ( |
| 390 | shown.map((m) => |
| 391 | fromG1t(m) ? ( |
| 392 | m.reset ? null : ( |
| 393 | <Message key={m.id} from="assistant"> |
| 394 | <G1tAnswer message={m} context={context} onRetry={!busy && lastAnswer?.id === m.id ? () => void act("g1t_retry") : undefined} /> |
| 395 | </Message> |
| 396 | ) |
| 397 | ) : ( |
| 398 | <Message key={m.id} from="user"> |
| 399 | <MessageContent className={m.pending && !m.failed ? "opacity-70" : undefined}>{m.body}</MessageContent> |
| 400 | {m.failed && <span className="text-xs text-danger">Not sent. Ask again.</span>} |
| 401 | </Message> |
| 402 | ), |
| 403 | ) |
| 404 | )} |
| 405 | </ConversationContent> |
| 406 | <ConversationScrollButton /> |
| 407 | </Conversation> |
| 408 | |
| 409 | <form onSubmit={submit} className="border-t border-line px-4 pt-3 pb-3"> |
| 410 | <div className="rounded-xl border border-line bg-bg transition-shadow focus-within:border-accent-dim focus-within:ring-2 focus-within:ring-accent/25"> |
| 411 | <label htmlFor="ask-g1t" className="sr-only"> |
| 412 | Ask g1t |
| 413 | </label> |
| 414 | <Textarea |
| 415 | id="ask-g1t" |
| 416 | ref={input} |
| 417 | value={draft} |
| 418 | onChange={(event) => setDraft(event.target.value)} |
| 419 | onKeyDown={onKeyDown} |
| 420 | rows={2} |
| 421 | maxLength={16_000} |
| 422 | disabled={!ready} |
| 423 | placeholder={ready ? "Ask about this page, a repository, or your work" : "Ask is not set up yet"} |
| 424 | className="max-h-48 min-h-14 resize-none border-0 bg-transparent px-3 pt-2.5 pb-1 shadow-none focus-visible:ring-0" |
| 425 | /> |
| 426 | <div className="flex items-center gap-2 px-2 pb-2"> |
| 427 | <span className="truncate pl-1 text-xs text-faint">{askWhere(where)}</span> |
| 428 | <span className="ml-auto" /> |
| 429 | {busy ? ( |
| 430 | <Hint label="Stop the answer (Esc)"> |
| 431 | <Button type="button" variant="outline" size="icon-sm" onClick={() => void act("g1t_stop")} aria-label="Stop"> |
| 432 | <Square size={12} className="fill-current" /> |
| 433 | </Button> |
| 434 | </Hint> |
| 435 | ) : ( |
| 436 | <Hint label="Send (Enter)"> |
| 437 | <Button type="submit" variant="accent" size="icon-sm" disabled={!ready || !draft.trim()} aria-label="Send"> |
| 438 | <ArrowUp size={15} /> |
| 439 | </Button> |
| 440 | </Hint> |
| 441 | )} |
| 442 | </div> |
| 443 | </div> |
| 444 | <p className="mt-2 px-1 text-[0.6875rem] leading-relaxed text-faint"> |
| 445 | Answers come from your workspace's own AI provider and can be wrong. Kept in your direct message with g1t.{" "} |
| 446 | <span className="whitespace-nowrap max-sm:hidden"> |
| 447 | <Kbd>Shift</Kbd> <Kbd>Enter</Kbd> for a new line. |
| 448 | </span> |
| 449 | </p> |
| 450 | </form> |
| 451 | </> |
| 452 | ); |
| 453 | } |
| 454 | |
| 455 | function NotSetUp({ slug, setup }: { slug: string; setup: Setup }) { |
| 456 | return ( |
| 457 | <Alert tone="info"> |
| 458 | <AlertTitle>Ask needs one of your workspace's AI providers</AlertTitle> |
| 459 | <AlertDescription> |
| 460 | <p>{setup.problem}</p> |
| 461 | <p className="mt-2"> |
| 462 | Ask answers with an AI provider your workspace connects, on its own key: g1t hosts no model for it.{" "} |
| 463 | {setup.owner ? ( |
| 464 | // Following it closes the panel, so the page it opens is not behind it. |
| 465 | <SheetClose asChild> |
| 466 | <Link to={`/${slug}/-/integrations/models#ask`} className="text-accent hover:underline"> |
| 467 | Connect a provider and choose it for Ask |
| 468 | </Link> |
| 469 | </SheetClose> |
| 470 | ) : ( |
| 471 | <>Ask an owner of {slug} to connect one and choose it for Ask.</> |
| 472 | )} |
| 473 | </p> |
| 474 | </AlertDescription> |
| 475 | </Alert> |
| 476 | ); |
| 477 | } |