diff --git a/gui/src/components/dialogs/AddDocsDialog.tsx b/gui/src/components/dialogs/AddDocsDialog.tsx
index 1a8682150..d66c315fe 100644
--- a/gui/src/components/dialogs/AddDocsDialog.tsx
+++ b/gui/src/components/dialogs/AddDocsDialog.tsx
@@ -7,7 +7,7 @@ import { SiteIndexingConfig } from "core";
import { usePostHog } from "posthog-js/react";
import { useContext, useLayoutEffect, useRef, useState } from "react";
import { useDispatch, useSelector } from "react-redux";
-import { Button, HelperText, Input, lightGray } from "..";
+import { Button, HelperText, Input, lightGray, SecondaryButton } from "..";
import { IdeMessengerContext } from "../../context/IdeMessenger";
import {
setDialogMessage,
@@ -15,6 +15,7 @@ import {
} from "../../redux/slices/uiStateSlice";
import { RootState } from "../../redux/store";
import IndexingStatusViewer from "../indexing/IndexingStatus";
+import { NewSessionButton } from "../mainInput/NewSessionButton";
function AddDocsDialog() {
const posthog = usePostHog();
@@ -31,7 +32,7 @@ function AddDocsDialog() {
const ideMessenger = useContext(IdeMessengerContext);
const indexingStatuses = useSelector(
- (store: RootState) => store.state.indexingStatuses,
+ (store: RootState) => store.state.indexing.statuses,
);
const isFormValid = startUrl && title;
@@ -92,23 +93,23 @@ function AddDocsDialog() {
)}
-
-
+
diff --git a/gui/src/components/indexing/ChatIndexingPeeks.tsx b/gui/src/components/indexing/ChatIndexingPeeks.tsx
index f3a609c68..c77bdc323 100644
--- a/gui/src/components/indexing/ChatIndexingPeeks.tsx
+++ b/gui/src/components/indexing/ChatIndexingPeeks.tsx
@@ -1,14 +1,15 @@
-import { useSelector } from "react-redux";
+import { useDispatch, useSelector } from "react-redux";
import { RootState } from "../../redux/store";
import { IndexingStatus } from "core";
import { useMemo, useState } from "react";
import { useNavigate } from "react-router-dom";
import { ArrowPathIcon, EyeSlashIcon } from "@heroicons/react/24/outline";
+import { setIndexingChatPeekHidden } from "../../redux/slices/stateSlice";
interface MergedIndexingState {
displayName: string;
- type: string;
+ type: IndexingStatus["type"];
titles: IndexingStatus["title"][];
progressPercentage: number;
}
@@ -21,14 +22,16 @@ const mergeProgress = (states: IndexingStatus[]): number => {
export interface ChatIndexingPeekProps {
state: MergedIndexingState;
- hidden: boolean;
- setHidden: (hidden: boolean) => void;
}
-function ChatIndexingPeek({ state, hidden, setHidden }: ChatIndexingPeekProps) {
+function ChatIndexingPeek({ state }: ChatIndexingPeekProps) {
const navigate = useNavigate();
+ const dispatch = useDispatch();
+ const hiddenPeeks = useSelector(
+ (store: RootState) => store.state.indexing.hiddenChatPeekTypes,
+ );
- if (hidden) return null;
+ if (hiddenPeeks[state.type]) return null;
return (
{
- setHidden(true);
+ dispatch(
+ setIndexingChatPeekHidden({ type: state.type, hidden: true }),
+ );
e.stopPropagation();
}}
/>
@@ -75,13 +80,8 @@ function ChatIndexingPeek({ state, hidden, setHidden }: ChatIndexingPeekProps) {
function ChatIndexingPeeks() {
const indexingStatuses = useSelector(
- (store: RootState) => store.state.indexingStatuses,
+ (store: RootState) => store.state.indexing.statuses,
);
-
- const [hidden, setHidden] = useState<{
- [key: string]: boolean;
- }>({});
-
const mergedIndexingStates: MergedIndexingState[] = useMemo(() => {
const mergedStates: MergedIndexingState[] = [];
@@ -95,12 +95,6 @@ function ChatIndexingPeeks() {
titles: docsStates.map((state) => state.title),
progressPercentage: mergeProgress(docsStates),
});
- } else {
- // So that next indexing will show again if hidden
- setHidden({
- ...hidden,
- docs: false,
- });
}
return mergedStates;
}, [indexingStatuses]);
@@ -110,18 +104,7 @@ function ChatIndexingPeeks() {
return (
{mergedIndexingStates.map((state) => {
- return (
-
- setHidden({
- ...hidden,
- [state.type]: true,
- })
- }
- />
- );
+ return ;
})}
);
diff --git a/gui/src/components/indexing/IndexingStatuses.tsx b/gui/src/components/indexing/IndexingStatuses.tsx
index da10dde90..ecc35189d 100644
--- a/gui/src/components/indexing/IndexingStatuses.tsx
+++ b/gui/src/components/indexing/IndexingStatuses.tsx
@@ -11,7 +11,7 @@ import AddDocsDialog from "../dialogs/AddDocsDialog";
function IndexingStatuses() {
const indexingStatuses = useSelector(
- (store: RootState) => store.state.indexingStatuses,
+ (store: RootState) => store.state.indexing.statuses,
);
const docsStatuses = useMemo(() => {
const docs = Object.values(indexingStatuses).filter(
@@ -28,6 +28,7 @@ function IndexingStatuses() {
{/*
*/}
+ {/* TODO add some way to hide, scroll, etc. */}
Manage your documentation sources
diff --git a/gui/src/redux/slices/stateSlice.ts b/gui/src/redux/slices/stateSlice.ts
index 7027ac54c..b31e4b01e 100644
--- a/gui/src/redux/slices/stateSlice.ts
+++ b/gui/src/redux/slices/stateSlice.ts
@@ -38,7 +38,10 @@ type State = {
isMultifileEdit: boolean;
applyStates: ApplyState[];
nextCodeBlockToApplyIndex: number;
- indexingStatuses: Record;
+ indexing: {
+ hiddenChatPeekTypes: Record;
+ statuses: Record;
+ };
};
const initialState: State = {
@@ -70,7 +73,12 @@ const initialState: State = {
curCheckpointIndex: 0,
nextCodeBlockToApplyIndex: 0,
applyStates: [],
- indexingStatuses: {},
+ indexing: {
+ statuses: {},
+ hiddenChatPeekTypes: {
+ docs: false,
+ },
+ },
};
export const stateSlice = createSlice({
@@ -366,10 +374,37 @@ export const stateSlice = createSlice({
state,
{ payload }: PayloadAction,
) => {
- state.indexingStatuses = {
- ...state.indexingStatuses,
+ state.indexing.statuses = {
+ ...state.indexing.statuses,
[payload.id]: payload,
};
+
+ // This check is so that if all indexing is stopped for e.g. docs
+ // The next time docs indexing starts the peek will show again
+ const indexingThisType = Object.values(state.indexing.statuses).filter(
+ (status) =>
+ status.type === payload.type && status.status === "indexing",
+ );
+ if (indexingThisType.length === 0) {
+ state.indexing.hiddenChatPeekTypes = {
+ ...state.indexing.hiddenChatPeekTypes,
+ [payload.type]: false,
+ };
+ }
+ },
+ setIndexingChatPeekHidden: (
+ state,
+ {
+ payload,
+ }: PayloadAction<{
+ type: IndexingStatus["type"];
+ hidden: boolean;
+ }>,
+ ) => {
+ state.indexing.hiddenChatPeekTypes = {
+ ...state.indexing.hiddenChatPeekTypes,
+ [payload.type]: payload.hidden,
+ };
},
},
});
@@ -401,6 +436,7 @@ export const {
resetNextCodeBlockToApplyIndex,
updateApplyState,
updateIndexingStatus,
+ setIndexingChatPeekHidden,
} = stateSlice.actions;
export default stateSlice.reducer;