import { CircleNotch } from "@phosphor-icons/react"; import ModalWrapper from "@/components/ModalWrapper"; import pluralize from "pluralize"; import { numberWithCommas } from "@/utils/numbers"; import useUser from "@/hooks/useUser"; import { Link } from "react-router-dom"; import Paths from "@/utils/paths"; import Workspace from "@/models/workspace"; export default function FileUploadWarningModal({ show, onClose, onContinue, onEmbed, tokenCount, maxTokens, fileCount = 1, isEmbedding = false, embedProgress = 0, }) { const { user } = useUser(); const canEmbed = !user || user.role !== "default"; if (!show) return null; if (isEmbedding) { return (

Embedding {embedProgress + 1} of {fileCount}{" "} {pluralize("file", fileCount)}

Please wait while we embed your files...

); } return (

Context Window Warning

Your workspace is using {numberWithCommas(tokenCount)} of{" "} {numberWithCommas(maxTokens)} available tokens. We recommend keeping usage below {(Workspace.maxContextWindowLimit * 100).toFixed(0)}% to ensure the best chat experience. Adding {fileCount} more{" "} {pluralize("file", fileCount)} would exceed this limit.{" "} Learn more about context windows →

Choose how you would like to proceed with these uploads.

{canEmbed && ( )}
); }