+
+
+ Free trial requests
+
+
+
+ {completed} / {total}
+
+
+
+
+
0.75 ? "bg-amber-500" : "bg-stone-500"
+ }`}
+ style={{
+ width: `${fillPercentage}%`,
+ }}
+ />
+
+
+
+ {tooltipPortalDiv &&
+ ReactDOM.createPortal(
+
+ {`Click to use your own API key or local LLM (required after ${FREE_TRIAL_LIMIT_REQUESTS} inputs)`}
+ ,
+ tooltipPortalDiv,
+ )}
+ >
+ );
+}
+
+export default FreeTrialProgressBar;
diff --git a/gui/src/components/loaders/IndexingProgressBar.tsx b/gui/src/components/loaders/IndexingProgressBar.tsx
deleted file mode 100644
index 9677853da..000000000
--- a/gui/src/components/loaders/IndexingProgressBar.tsx
+++ /dev/null
@@ -1,305 +0,0 @@
-import { IndexingProgressUpdate } from "core";
-import TransformersJsEmbeddingsProvider from "core/indexing/embeddings/TransformersJsEmbeddingsProvider";
-import { usePostHog } from "posthog-js/react";
-import { useContext, useEffect, useState } from "react";
-import { useDispatch, useSelector } from "react-redux";
-import styled from "styled-components";
-import { Button, lightGray, vscForeground } from "..";
-import { IdeMessengerContext } from "../../context/IdeMessenger";
-import {
- setDialogMessage,
- setShowDialog,
-} from "../../redux/slices/uiStateSlice";
-import { RootState } from "../../redux/store";
-import { getFontSize, isJetBrains } from "../../util";
-import ConfirmationDialog from "../dialogs/ConfirmationDialog";
-import StatusDot from "./StatusDot";
-
-const STATUS_COLORS: Record
= {
- disabled: lightGray, // light gray
- loading: "#00B8D9", // ice blue
- indexing: "#6554C0", // purple
- paused: "#FFAB00", // yellow
- done: "#36B37E", // green
- failed: "#FF5630", // red
-};
-
-const STATUS_MESSAGES: Record = {
- done: "Indexing complete",
- loading: "Initializing",
- indexing: "Indexing in progress",
- paused: "Indexing paused",
- failed: "Indexing error",
- disabled: "Indexing disabled",
-};
-
-const BUTTON_MESSAGES: Record<
- IndexingProgressUpdate["status"],
- string | undefined
-> = {
- done: "Re-index",
- loading: undefined,
- indexing: "Pause",
- paused: "Resume",
- failed: "Retry",
- disabled: "Enable",
-};
-
-const ProgressBarWrapper = styled.div`
- width: 100%;
- height: 6px;
- border-radius: 6px;
- border: 0.5px solid ${lightGray};
-
- margin-top: 8px;
- margin-bottom: 8px;
- margin-right: 8px;
-`;
-
-const ProgressBarFill = styled.div<{ completed: number; color?: string }>`
- height: 100%;
- background-color: ${(props) => props.color || vscForeground};
- border-radius: inherit;
- transition: width 0.2s ease-in-out;
- width: ${(props) => props.completed}%;
-`;
-
-const FlexDiv = styled.div`
- display: flex;
- align-items: center;
- gap: 6px;
- overflow: hidden;
-`;
-
-const StatusHeading = styled.div`
- color: ${lightGray};
- font-size: ${getFontSize() - 2.4}px;
- white-space: nowrap;
- overflow: hidden;
- text-overflow: ellipsis;
-
- @media (max-width: 400px) {
- display: none;
- }
-`;
-
-const StatusInfo = styled.div`
- font-size: ${getFontSize() - 3.6}px;
- color: ${lightGray};
- white-space: nowrap;
- overflow: hidden;
- text-overflow: ellipsis;
- margin-top: 2px;
-`;
-
-const StyledButton = styled(Button)`
- padding: 6px 8px;
- border-radius: 3px;
-`;
-
-interface ProgressBarProps {
- indexingState?: IndexingProgressUpdate;
-}
-
-const IndexingProgressBar = ({
- indexingState: indexingStateProp,
-}: ProgressBarProps) => {
- const dispatch = useDispatch();
- const ideMessenger = useContext(IdeMessengerContext);
- const posthog = usePostHog();
-
- const [paused, setPaused] = useState(undefined);
- const [hovered, setHovered] = useState(false);
-
- const embeddingsProvider = useSelector(
- (state: RootState) => state.state.config.embeddingsProvider,
- );
-
- // If sidebar is opened before extension initiates, define a default indexingState
- const defaultIndexingState: IndexingProgressUpdate = {
- status: "loading",
- progress: 0,
- desc: "",
- };
-
- const indexingState = indexingStateProp || defaultIndexingState;
-
- const fillPercentage = Math.min(
- 100,
- Math.max(0, indexingState.progress * 100),
- );
-
- const tooltipPortalDiv = document.getElementById("tooltip-portal-div");
-
- // If sidebar is opened after extension initializes, retrieve saved states.
- let initialized = false;
-
- useEffect(() => {
- if (!initialized) {
- // Triggers retrieval for possible non-default states set prior to IndexingProgressBar initialization
- ideMessenger.post("index/indexingProgressBarInitialized", undefined);
- initialized = true;
- }
- }, []);
-
- useEffect(() => {
- if (paused === undefined) return;
- ideMessenger.post("index/setPaused", paused);
- }, [paused]);
-
- function onClick() {
- switch (indexingState.status) {
- case "failed":
- break;
- case "indexing":
- case "paused":
- if (indexingState.progress < 1 && indexingState.progress >= 0) {
- setPaused((prev) => !prev);
- } else {
- ideMessenger.post("index/forceReIndex", undefined);
- }
- break;
- default:
- ideMessenger.post("index/forceReIndex", undefined);
- break;
- }
- }
-
- function getIndexingErrMsg(msg: string): string {
- if (
- isJetBrains() &&
- embeddingsProvider === TransformersJsEmbeddingsProvider.model
- ) {
- return (
- "The 'transformers.js' embeddingsProvider is currently unsupported in JetBrains. " +
- "To enable codebase indexing, you can use any of the other providers described " +
- "in the docs: https://docs.continue.dev/walkthroughs/codebase-embeddings#embeddings-providers"
- );
- }
-
- return msg;
- }
-
- return (
-
-
- Indexing generates embeddings used for codebase retrieval. The index is
- stored entirely locally.
-
-
-
-
-
-
-
-
-
-
-
- {STATUS_MESSAGES[indexingState.status]}
-
-
-
-
- {Math.trunc(Math.min(100, 100 * indexingState.progress))}%
-
-
-
- {indexingState.status === "disabled" ? null : indexingState.status ===
- "done" ? (
-
{
- ideMessenger.post("index/forceReIndex", undefined);
- }}
- >
- Re-index
-
- ) : indexingState.status === "failed" ? (
-
{
- // For now, we don't show in JetBrains since the reindex command
- // is not yet implemented
- if (indexingState.shouldClearIndexes && !isJetBrains()) {
- dispatch(setShowDialog(true));
- dispatch(
- setDialogMessage(
- {
- posthog.capture("rebuild_index_clicked");
- ideMessenger.post("index/forceReIndex", {
- shouldClearIndexes: true,
- });
- }}
- />,
- ),
- );
- } else {
- ideMessenger.post("index/forceReIndex", undefined);
- }
- }}
- >
- Retry
-
- ) : indexingState.status === "indexing" ||
- indexingState.status === "loading" ? (
-
- {
- if (indexingState.progress < 1 && indexingState.progress >= 0) {
- setPaused((prev) => !prev);
- } else {
- ideMessenger.post("index/forceReIndex", undefined);
- }
- }}
- >
- Pause
-
-
- ) : indexingState.status === "paused" ? (
-
{
- if (indexingState.progress < 1 && indexingState.progress >= 0) {
- setPaused((prev) => !prev);
- } else {
- ideMessenger.post("index/forceReIndex", undefined);
- }
- }}
- >
- Resume
-
- ) : null}
-
-
- {indexingState.status === "failed" && (
-
- {getIndexingErrMsg(indexingState.desc)}
-
- )}
- {indexingState.status === "indexing" && (
-
{indexingState.desc}
- )}
-
-
- );
-};
-
-export default IndexingProgressBar;
diff --git a/gui/src/components/loaders/ProgressBar.tsx b/gui/src/components/loaders/ProgressBar.tsx
deleted file mode 100644
index 285f3c6fe..000000000
--- a/gui/src/components/loaders/ProgressBar.tsx
+++ /dev/null
@@ -1,130 +0,0 @@
-import { ExclamationCircleIcon } from "@heroicons/react/24/outline";
-import ReactDOM from "react-dom";
-import { useDispatch } from "react-redux";
-import { useNavigate } from "react-router-dom";
-import styled from "styled-components";
-import { lightGray, vscForeground } from "..";
-import AddModelForm from "../../forms/AddModelForm";
-import {
- setDialogMessage,
- setShowDialog,
-} from "../../redux/slices/uiStateSlice";
-import { getFontSize } from "../../util";
-import { FREE_TRIAL_LIMIT_REQUESTS } from "../../util/freeTrial";
-import { ToolTip } from "../gui/Tooltip";
-
-const ProgressBarWrapper = styled.div`
- width: 100px;
- height: 6px;
- border-radius: 6px;
- border: 0.5px solid ${lightGray};
- margin-top: 6px;
-`;
-
-const ProgressBarFill = styled.div<{ completed: number; color?: string }>`
- height: 100%;
- background-color: ${(props) => props.color || vscForeground};
- border-radius: inherit;
- transition: width 0.2s ease-in-out;
- width: ${(props) => props.completed}%;
-`;
-
-const GridDiv = styled.div`
- display: grid;
- grid-template-rows: 1fr auto;
- align-items: center;
- justify-items: center;
- cursor: pointer;
-`;
-
-const P = styled.p`
- margin: 0;
- margin-top: 2px;
- font-size: ${getFontSize() - 2.5}px;
- color: ${lightGray};
- text-align: center;
- white-space: nowrap;
- overflow: hidden;
- text-overflow: ellipsis;
-`;
-
-interface ProgressBarProps {
- completed: number;
- total: number;
-}
-
-const ProgressBar = ({ completed, total }: ProgressBarProps) => {
- const dispatch = useDispatch();
- const navigate = useNavigate();
- const fillPercentage = Math.min(100, Math.max(0, (completed / total) * 100));
-
- const tooltipPortalDiv = document.getElementById("tooltip-portal-div");
-
- if (completed > total) {
- return (
- <>
-
-
- Trial limit reached
-
- {tooltipPortalDiv &&
- ReactDOM.createPortal(
-
- Configure a model above in order to continue
- ,
- tooltipPortalDiv,
- )}
- >
- );
- }
-
- return (
- <>
- {
- dispatch(setShowDialog(true));
- dispatch(
- setDialogMessage(
- {
- dispatch(setShowDialog(false));
- navigate("/");
- }}
- />,
- ),
- );
- }}
- >
-
- 0.75
- ? completed / total > 0.9
- ? "#f00"
- : "#fc0"
- : undefined
- }
- />
-
-
- Free Uses: {completed} / {total}
-
-
-
- {tooltipPortalDiv &&
- ReactDOM.createPortal(
-
- {`Click to use your own API key or local LLM (required after ${FREE_TRIAL_LIMIT_REQUESTS} inputs)`}
- ,
- tooltipPortalDiv,
- )}
- >
- );
-};
-
-export default ProgressBar;
diff --git a/gui/src/components/loaders/StatusDot.tsx b/gui/src/components/loaders/StatusDot.tsx
deleted file mode 100644
index fa4f38c65..000000000
--- a/gui/src/components/loaders/StatusDot.tsx
+++ /dev/null
@@ -1,33 +0,0 @@
-import styled, { css, keyframes } from "styled-components";
-
-const DEFAULT_DIAMETER = 6;
-
-const blink = keyframes`
- 0%, 100% {
- transform: scale(1);
- opacity: 1;
- }
- 50% {
- opacity: 0.25;
- }
-`;
-
-const blinkAnimation = css`
- animation: ${blink} 3s infinite;
-`;
-
-const StatusDot = styled.div<{
- color: string;
- diameter?: number;
- shouldBlink?: boolean;
-}>`
- background-color: ${(props) => props.color};
- box-shadow: 0px 0px 2px 1px ${(props) => props.color};
- width: ${(props) => props.diameter ?? DEFAULT_DIAMETER}px;
- height: ${(props) => props.diameter ?? DEFAULT_DIAMETER}px;
- border-radius: 50%;
- border: 1px solid rgba(255, 255, 255, 0.75);
- ${(props) => (props.shouldBlink ?? false) && blinkAnimation};
-`;
-
-export default StatusDot;
diff --git a/gui/src/components/mainInput/ContextItemsPeek.tsx b/gui/src/components/mainInput/ContextItemsPeek.tsx
index 5327719d2..2d7409b26 100644
--- a/gui/src/components/mainInput/ContextItemsPeek.tsx
+++ b/gui/src/components/mainInput/ContextItemsPeek.tsx
@@ -1,17 +1,19 @@
import { ChevronDownIcon, ChevronRightIcon } from "@heroicons/react/24/outline";
import { ContextItemWithId } from "core";
-import { contextItemToRangeInFileWithContents } from "core/commands/util";
-import React, { useContext } from "react";
-import { lightGray, vscBackground } from "..";
+import { ctxItemToRifWithContents } from "core/commands/util";
+import { useContext, useState } from "react";
+import { AnimatedEllipsis, lightGray, vscBackground } from "..";
import { IdeMessengerContext } from "../../context/IdeMessenger";
-import { getFontSize } from "../../util";
import FileIcon from "../FileIcon";
import SafeImg from "../SafeImg";
import { INSTRUCTIONS_BASE_ITEM } from "core/context/providers/utils";
import { getIconFromDropdownItem } from "./MentionList";
+import styled from "styled-components";
+import { getBasename } from "core/util";
interface ContextItemsPeekProps {
contextItems?: ContextItemWithId[];
+ isGatheringContext: boolean;
}
interface ContextItemsPeekItemProps {
@@ -30,7 +32,7 @@ function ContextItemsPeekItem({ contextItem }: ContextItemsPeekItemProps) {
const isRangeInFile = name.includes(" (") && name.endsWith(")");
if (isRangeInFile) {
- const rif = contextItemToRangeInFileWithContents(contextItem);
+ const rif = ctxItemToRifWithContents(contextItem);
ideMessenger.ide.showLines(
rif.filepath,
rif.range.start.line,
@@ -94,8 +96,7 @@ function ContextItemsPeekItem({ contextItem }: ContextItemsPeekItemProps) {
return (
{getContextItemIcon()}
@@ -104,11 +105,11 @@ function ContextItemsPeekItem({ contextItem }: ContextItemsPeekItemProps) {
{contextItem.name}
- {contextItem.description}
+ {contextItem.uri?.type === "file"
+ ? getBasename(contextItem.description)
+ : contextItem.description}
@@ -116,53 +117,49 @@ function ContextItemsPeekItem({ contextItem }: ContextItemsPeekItemProps) {
);
}
-function ContextItemsPeek({ contextItems }: ContextItemsPeekProps) {
- const [open, setOpen] = React.useState(false);
+function ContextItemsPeek({
+ contextItems,
+ isGatheringContext,
+}: ContextItemsPeekProps) {
+ const [open, setOpen] = useState(false);
const ctxItems = contextItems?.filter(
(ctxItem) => !ctxItem.name.includes(INSTRUCTIONS_BASE_ITEM.name),
);
- if (!ctxItems || ctxItems.length === 0) {
+ if ((!ctxItems || ctxItems.length === 0) && !isGatheringContext) {
return null;
}
- const contextItemsText = `${ctxItems.length} context ${
- ctxItems.length > 1 ? "items" : "item"
- }`;
-
return (
-
+
setOpen((prev) => !prev)}
>
-
- {contextItemsText}
+
+ {isGatheringContext ? (
+ <>
+ Gathering context
+
+ >
+ ) : (
+ `${ctxItems.length} context ${
+ ctxItems.length > 1 ? "items" : "item"
+ }`
+ )}
@@ -171,9 +168,10 @@ function ContextItemsPeek({ contextItems }: ContextItemsPeekProps) {
open ? "max-h-[50vh] opacity-100" : "max-h-0 opacity-0"
}`}
>
- {ctxItems.map((contextItem, idx) => (
-
- ))}
+ {ctxItems &&
+ ctxItems.map((contextItem, idx) => (
+
+ ))}
);
diff --git a/gui/src/components/mainInput/ContinueInputBox.tsx b/gui/src/components/mainInput/ContinueInputBox.tsx
index 574a945d0..40127037f 100644
--- a/gui/src/components/mainInput/ContinueInputBox.tsx
+++ b/gui/src/components/mainInput/ContinueInputBox.tsx
@@ -9,6 +9,16 @@ import { newSession, setMessageAtIndex } from "../../redux/slices/stateSlice";
import { RootState } from "../../redux/store";
import ContextItemsPeek from "./ContextItemsPeek";
import TipTapEditor from "./TipTapEditor";
+import { useState, useRef, useEffect } from "react";
+
+interface ContinueInputBoxProps {
+ isLastUserInput: boolean;
+ isMainInput?: boolean;
+ onEnter: (editorState: JSONContent, modifiers: InputModifiers) => void;
+ editorState?: JSONContent;
+ contextItems?: ContextItemWithId[];
+ hidden?: boolean;
+}
const gradient = keyframes`
0% {
@@ -22,8 +32,6 @@ const gradient = keyframes`
const GradientBorder = styled.div<{
borderRadius?: string;
borderColor?: string;
- isFirst: boolean;
- isLast: boolean;
loading: 0 | 1;
}>`
border-radius: ${(props) => props.borderRadius || "0"};
@@ -47,18 +55,8 @@ const GradientBorder = styled.div<{
display: flex;
flex-direction: row;
align-items: center;
- margin-top: 8px;
`;
-interface ContinueInputBoxProps {
- isLastUserInput: boolean;
- isMainInput?: boolean;
- onEnter: (editorState: JSONContent, modifiers: InputModifiers) => void;
- editorState?: JSONContent;
- contextItems?: ContextItemWithId[];
- hidden?: boolean;
-}
-
function ContinueInputBox(props: ContinueInputBoxProps) {
const dispatch = useDispatch();
@@ -67,6 +65,12 @@ function ContinueInputBox(props: ContinueInputBoxProps) {
const availableContextProviders = useSelector(
(store: RootState) => store.state.config.contextProviders,
);
+ const isGatheringContextStore = useSelector(
+ (store: RootState) => store.state.isGatheringContext,
+ );
+
+ const [isGatheringContext, setIsGatheringContext] = useState(false);
+ const timeoutRef = useRef