diff --git a/apps/desktop/index.html b/apps/desktop/index.html index 91a82d9c15..87045c7753 100644 --- a/apps/desktop/index.html +++ b/apps/desktop/index.html @@ -13,12 +13,9 @@ - +
- diff --git a/client/index.html b/client/index.html index dc1e1110ab..45f30539ea 100644 --- a/client/index.html +++ b/client/index.html @@ -8,7 +8,7 @@ bloop - +
diff --git a/client/src/CommandBar/steps/Documentation/index.tsx b/client/src/CommandBar/steps/Documentation/index.tsx index 82e425cb65..8d3428683e 100644 --- a/client/src/CommandBar/steps/Documentation/index.tsx +++ b/client/src/CommandBar/steps/Documentation/index.tsx @@ -107,7 +107,11 @@ const Documentation = ({}: Props) => { useEffect(() => { const mapped = indexedDocs.map((d) => ({ Component: DocItem, - componentProps: { doc: d, isIndexed: !!d.id, refetchDocs }, + componentProps: { + doc: d, + isIndexed: d.index_status === 'done', + refetchDocs, + }, key: d.id, })); if (addedDoc) { diff --git a/client/src/CommandBar/steps/items/DocItem.tsx b/client/src/CommandBar/steps/items/DocItem.tsx index 779c25b00a..92bddb390e 100644 --- a/client/src/CommandBar/steps/items/DocItem.tsx +++ b/client/src/CommandBar/steps/items/DocItem.tsx @@ -72,9 +72,11 @@ const DocItem = ({ const startEventSource = useCallback(() => { setIsIndexingFinished(false); + eventSourceRef.current?.close(); eventSourceRef.current = new EventSource( `${apiUrl.replace('https:', '')}/docs/${doc.id}/status`, ); + setTimeout(refetchDocs, 1000); eventSourceRef.current.onmessage = (ev) => { try { const data = JSON.parse(ev.data); @@ -151,6 +153,7 @@ const DocItem = ({ const handleAddToProject = useCallback(() => { if (project?.id) { + console.log('handleAddToProject', project.id, doc.id); return addDocToProject(project.id, doc.id).finally(() => { refreshCurrentProjectDocs(); }); @@ -256,7 +259,7 @@ const DocItem = ({ ? favIconComponent : MagazineIcon } - label={docToShow.name} + label={`${docToShow.id} ${doc.id} ${docToShow.name}`} id={'doc_settings'} footerHint={ isIndexing ? ( diff --git a/client/src/Project/CurrentTabContent/StudioTab/Conversation/NoFilesMessage.tsx b/client/src/Project/CurrentTabContent/StudioTab/Conversation/NoFilesMessage.tsx index 27929fb5b7..97042bccce 100644 --- a/client/src/Project/CurrentTabContent/StudioTab/Conversation/NoFilesMessage.tsx +++ b/client/src/Project/CurrentTabContent/StudioTab/Conversation/NoFilesMessage.tsx @@ -23,7 +23,9 @@ const NoFilesMessage = ({ studioId }: Props) => { }, [studioId]); const isEmptyContext = useMemo(() => { - const fullStudio = project?.studios.find((s) => s.id === studioId); + const fullStudio = project?.studios.find( + (s) => s.id.toString() === studioId.toString(), + ); return !!fullStudio && !fullStudio.context.length; }, [project?.studios, studioId]); diff --git a/client/src/context/projectContext.ts b/client/src/context/projectContext.ts index 994a82471a..5602dd5999 100644 --- a/client/src/context/projectContext.ts +++ b/client/src/context/projectContext.ts @@ -5,6 +5,9 @@ export const ProjectContext = { Current: createContext<{ project: ProjectFullType | null; isReposLoaded: boolean; + isChatsLoaded: boolean; + isStudiosLoaded: boolean; + isDocsLoaded: boolean; isLoading: boolean; setCurrentProjectId: (id: string) => void; refreshCurrentProject: () => void; @@ -15,6 +18,9 @@ export const ProjectContext = { }>({ project: null, isReposLoaded: false, + isChatsLoaded: false, + isStudiosLoaded: false, + isDocsLoaded: false, isLoading: true, setCurrentProjectId: (id: string) => {}, refreshCurrentProject: () => {}, diff --git a/client/src/context/providers/ProjectContextProvider.tsx b/client/src/context/providers/ProjectContextProvider.tsx index 7df15d10de..f41625730e 100644 --- a/client/src/context/providers/ProjectContextProvider.tsx +++ b/client/src/context/providers/ProjectContextProvider.tsx @@ -40,6 +40,9 @@ const ProjectContextProvider = ({ children }: PropsWithChildren) => { const [project, setProject] = useState(null); const [projects, setProjects] = useState([]); const [isReposLoaded, setIsReposLoaded] = useState(false); + const [isChatsLoaded, setIsChatsLoaded] = useState(false); + const [isStudiosLoaded, setIsStudiosLoaded] = useState(false); + const [isDocsLoaded, setIsDocsLoaded] = useState(false); const [isRegexSearchEnabled, setIsRegexSearchEnabled] = useState(false); const [preferredAnswerSpeed, setPreferredAnswerSpeed] = useState< 'normal' | 'fast' @@ -62,6 +65,7 @@ const ProjectContextProvider = ({ children }: PropsWithChildren) => { const refreshCurrentProjectConversations = useCallback(async () => { getProjectConversations(currentProjectId).then((r) => { setProject((prev) => (prev ? { ...prev, conversations: r } : null)); + setIsChatsLoaded(true); }); }, [currentProjectId]); const refreshCurrentProjectStudios = useCallback(async () => { @@ -75,11 +79,13 @@ const ProjectContextProvider = ({ children }: PropsWithChildren) => { } : null, ); + setIsStudiosLoaded(true); }); }, [currentProjectId]); const refreshCurrentProjectDocs = useCallback(async () => { getProjectDocs(currentProjectId).then((r) => { setProject((prev) => (prev ? { ...prev, docs: r } : null)); + setIsDocsLoaded(true); }); }, [currentProjectId]); @@ -95,6 +101,9 @@ const ProjectContextProvider = ({ children }: PropsWithChildren) => { useEffect(() => { setIsReposLoaded(false); + setIsChatsLoaded(false); + setIsStudiosLoaded(false); + setIsDocsLoaded(false); }, [currentProjectId]); useEffect(() => { @@ -172,6 +181,9 @@ const ProjectContextProvider = ({ children }: PropsWithChildren) => { () => ({ project, isReposLoaded, + isChatsLoaded, + isStudiosLoaded, + isDocsLoaded, setCurrentProjectId, refreshCurrentProjectRepos, refreshCurrentProjectConversations, @@ -183,6 +195,9 @@ const ProjectContextProvider = ({ children }: PropsWithChildren) => { [ project, isReposLoaded, + isChatsLoaded, + isStudiosLoaded, + isDocsLoaded, refreshCurrentProjectRepos, refreshCurrentProjectConversations, refreshCurrentProjectStudios, diff --git a/client/src/context/providers/TabsContextProvider.tsx b/client/src/context/providers/TabsContextProvider.tsx index 3a99f17246..04477e34b6 100644 --- a/client/src/context/providers/TabsContextProvider.tsx +++ b/client/src/context/providers/TabsContextProvider.tsx @@ -32,6 +32,9 @@ const TabsContextProvider = ({ children }: PropsWithChildren) => { const { project, isReposLoaded, + isChatsLoaded, + isStudiosLoaded, + isDocsLoaded, isLoading: isLoadingProjects, } = useContext(ProjectContext.Current); const { setFocusedTabItems } = useContext(CommandBarContext.Handlers); @@ -387,17 +390,68 @@ const TabsContextProvider = ({ children }: PropsWithChildren) => { [], ); + const checkIfTabsShouldClose = useCallback( + (checkIfTabShouldClose: (t: TabType | null) => boolean) => { + if (!isLoading && !isLoadingProjects) { + setActiveLeftTab((prev) => (checkIfTabShouldClose(prev) ? null : prev)); + setActiveRightTab((prev) => + checkIfTabShouldClose(prev) ? null : prev, + ); + setLeftTabs((prev) => prev.filter((t) => !checkIfTabShouldClose(t))); + setRightTabs((prev) => prev.filter((t) => !checkIfTabShouldClose(t))); + } + }, + [isLoading, isLoadingProjects], + ); + useEffect(() => { if (isReposLoaded && project?.repos && !isLoading && !isLoadingProjects) { const checkIfTabShouldClose = (tab: TabType | null) => tab?.type === TabTypesEnum.FILE && !project.repos.find((r) => r.repo.ref === tab.repoRef); - setActiveLeftTab((prev) => (checkIfTabShouldClose(prev) ? null : prev)); - setActiveRightTab((prev) => (checkIfTabShouldClose(prev) ? null : prev)); - setLeftTabs((prev) => prev.filter((t) => !checkIfTabShouldClose(t))); - setRightTabs((prev) => prev.filter((t) => !checkIfTabShouldClose(t))); + checkIfTabsShouldClose(checkIfTabShouldClose); + } + }, [isReposLoaded, project?.repos, checkIfTabsShouldClose]); + + useEffect(() => { + if ( + isChatsLoaded && + project?.conversations && + !isLoading && + !isLoadingProjects + ) { + const checkIfTabShouldClose = (tab: TabType | null) => + tab?.type === TabTypesEnum.CHAT && + !!tab.conversationId && + !project.conversations.find((r) => r.id === tab.conversationId); + checkIfTabsShouldClose(checkIfTabShouldClose); + } + }, [isChatsLoaded, project?.conversations, checkIfTabsShouldClose]); + + useEffect(() => { + if ( + isStudiosLoaded && + project?.studios && + !isLoading && + !isLoadingProjects + ) { + const checkIfTabShouldClose = (tab: TabType | null) => + tab?.type === TabTypesEnum.STUDIO && + !project.studios.find( + (r) => r.id.toString() === tab.studioId.toString(), + ); + checkIfTabsShouldClose(checkIfTabShouldClose); + } + }, [isStudiosLoaded, project?.studios, checkIfTabsShouldClose]); + + useEffect(() => { + if (isDocsLoaded && project?.docs && !isLoading && !isLoadingProjects) { + const checkIfTabShouldClose = (tab: TabType | null) => + tab?.type === TabTypesEnum.DOC && + !project.docs.find((r) => r.id === tab.docId); + checkIfTabsShouldClose(checkIfTabShouldClose); } - }, [isReposLoaded, project?.repos, isLoading, isLoadingProjects]); + }, [isDocsLoaded, project?.docs, checkIfTabsShouldClose]); const handlersContextValue = useMemo( () => ({ diff --git a/client/src/locales/en.json b/client/src/locales/en.json index ecb9728e91..695d29071d 100644 --- a/client/src/locales/en.json +++ b/client/src/locales/en.json @@ -712,6 +712,6 @@ "Go to current state": "Go to current state", "Continue from this state": "Continue from this state", "Restore session": "Restore session", - "<0>repoName has finished indexing and was added to the context of the current project. You can also use it in your other projects now.": "<0>repoName has finished indexing and was added to the context of the current project. You can also use it in your other projects now.", + "<0>repoName has finished indexing and was added to the context of the current project. You can also use it in your other projects now.": "<0>{{repoName}} has finished indexing and was added to the context of the current project. You can also use it in your other projects now.", "{{repoName}} is currently indexing as soon as it is finished it will be added to your project.": "{{repoName}} is currently indexing as soon as it is finished it will be added to your project." -} \ No newline at end of file +} diff --git a/client/src/locales/es.json b/client/src/locales/es.json index 3e24f5353f..93aa50d25f 100644 --- a/client/src/locales/es.json +++ b/client/src/locales/es.json @@ -675,8 +675,8 @@ "You can add 3 types of repositories, private, public and local.": "Puede agregar 3 tipos de repositorios, privados, públicos y locales.", "Indexing repositories": "Repositorios de indexación", "Skip": "Saltar", - "{{repoName}} has finished indexing and you can use it in your projects now.": "{{Reponame}} ha terminado de indexación y ahora puede usarla en sus proyectos.", - "{{repoName}} is currently indexing as soon as it is finished you will be able to add it to your project.": "{{Reponame}} actualmente está indexando tan pronto como esté terminado, podrá agregarlo a su proyecto.", + "{{repoName}} has finished indexing and you can use it in your projects now.": "{{repoName}} ha terminado de indexación y ahora puede usarla en sus proyectos.", + "{{repoName}} is currently indexing as soon as it is finished you will be able to add it to your project.": "{{repoName}} actualmente está indexando tan pronto como esté terminado, podrá agregarlo a su proyecto.", "Ask a question": "Hacer una pregunta", "Ask your first question": "Haz tu primera pregunta", "<0>Create a new conversation with bloop by hitting <2> on your keyboard or by pressing the <4> in the header bar.": "<0> Crea una nueva conversación con Bloop presionando <2> en tu teclado o presionando el <4> en la barra de encabezado. ", @@ -697,6 +697,6 @@ "Back to current": "Volver a la corriente", "Go to current state": "Ir al estado actual", "Continue from this state": "Continuar desde este estado", - "<0>repoName has finished indexing and was added to the context of the current project. You can also use it in your other projects now.": "<0> Reponame ha terminado de indexación y se agregó al contexto del proyecto actual. También puede usarlo en sus otros proyectos ahora.", - "{{repoName}} is currently indexing as soon as it is finished it will be added to your project.": "{{Reponame}} actualmente está indexando tan pronto como finalice, se agregará a su proyecto." -} \ No newline at end of file + "<0>repoName has finished indexing and was added to the context of the current project. You can also use it in your other projects now.": "<0>{{repoName}} ha terminado de indexación y se agregó al contexto del proyecto actual. También puede usarlo en sus otros proyectos ahora.", + "{{repoName}} is currently indexing as soon as it is finished it will be added to your project.": "{{repoName}} actualmente está indexando tan pronto como finalice, se agregará a su proyecto." +} diff --git a/client/src/locales/it.json b/client/src/locales/it.json index c6bddd2689..a6e79ddc45 100644 --- a/client/src/locales/it.json +++ b/client/src/locales/it.json @@ -660,6 +660,6 @@ "Back to current": "Torna alla corrente", "Go to current state": "Vai allo stato attuale", "Continue from this state": "Continua da questo stato", - "<0>repoName has finished indexing and was added to the context of the current project. You can also use it in your other projects now.": "<0> Reponame ha terminato l'indicizzazione ed è stato aggiunto al contesto dell'attuale progetto. Ora puoi anche usarlo nei tuoi altri progetti.", - "{{repoName}} is currently indexing as soon as it is finished it will be added to your project.": "{{Reponame}} sta attualmente indicizzando non appena sarà finito, verrà aggiunto al tuo progetto." -} \ No newline at end of file + "<0>repoName has finished indexing and was added to the context of the current project. You can also use it in your other projects now.": "<0>{{repoName}} ha terminato l'indicizzazione ed è stato aggiunto al contesto dell'attuale progetto. Ora puoi anche usarlo nei tuoi altri progetti.", + "{{repoName}} is currently indexing as soon as it is finished it will be added to your project.": "{{repoName}} sta attualmente indicizzando non appena sarà finito, verrà aggiunto al tuo progetto." +} diff --git a/client/src/locales/ja.json b/client/src/locales/ja.json index b39b0ca15b..28374a0c8f 100644 --- a/client/src/locales/ja.json +++ b/client/src/locales/ja.json @@ -658,7 +658,7 @@ "Bloop needs to index your repository first. This process takes a few seconds and happens only one time per repository.": "Bloopは最初にリポジトリをインデックス化する必要があります。 このプロセスには数秒かかり、リポジトリごとに1回しか発生しません。", "Skip": "スキップ", "Start by selecting again and pressing Enter (↵) on your keyboard.": "もう一度選択して、キーボードのEnter(‡)を押すことから始めます。", - "{{repoName}} is currently indexing as soon as it is finished you will be able to add it to your project.": "{{reponame}}は現在、完成したらすぐにインデックスを作成しています。プロジェクトに追加できるようになります。", + "{{repoName}} is currently indexing as soon as it is finished you will be able to add it to your project.": "{{repoName}}は現在、完成したらすぐにインデックスを作成しています。プロジェクトに追加できるようになります。", "Ask a question": "質問する", "Ask your first question": "あなたの最初の質問をしてください", "<0>Create a new conversation with bloop by hitting <2> on your keyboard or by pressing the <4> in the header bar.": "<0>キーボードで<2> を押すか、ヘッダーバーの<4> を押すことにより、Bloopとの新しい会話を作成します。", @@ -679,6 +679,6 @@ "Back to current": "現在に戻ります", "Go to current state": "現在の状態に移動します", "Continue from this state": "この状態から続けます", - "<0>repoName has finished indexing and was added to the context of the current project. You can also use it in your other projects now.": "<0>レプネームはインデックス作成が終了し、現在のプロジェクトのコンテキストに追加されました。 今すぐ他のプロジェクトで使用することもできます。", - "{{repoName}} is currently indexing as soon as it is finished it will be added to your project.": "{{reponame}}は現在、完了するとすぐにインデックスを作成しています。プロジェクトに追加されます。" -} \ No newline at end of file + "<0>repoName has finished indexing and was added to the context of the current project. You can also use it in your other projects now.": "<0>{{repoName}}はインデックス作成が終了し、現在のプロジェクトのコンテキストに追加されました。 今すぐ他のプロジェクトで使用することもできます。", + "{{repoName}} is currently indexing as soon as it is finished it will be added to your project.": "{{repoName}}は現在、完了するとすぐにインデックスを作成しています。プロジェクトに追加されます。" +} diff --git a/client/src/locales/zh-CN.json b/client/src/locales/zh-CN.json index 3568ca4977..c4e5559439 100644 --- a/client/src/locales/zh-CN.json +++ b/client/src/locales/zh-CN.json @@ -668,8 +668,8 @@ "You can add 3 types of repositories, private, public and local.": "您可以添加3种类型的存储库,即私人,公共和本地。", "Indexing repositories": "索引存储库", "Skip": "跳过", - "{{repoName}} has finished indexing and you can use it in your projects now.": "{{reponame}}已完成索引,您可以立即在项目中使用它。", - "{{repoName}} is currently indexing as soon as it is finished you will be able to add it to your project.": "{{reponame}}当前,一旦完成后,您就可以将其添加到项目中。", + "{{repoName}} has finished indexing and you can use it in your projects now.": "{{repoName}}已完成索引,您可以立即在项目中使用它。", + "{{repoName}} is currently indexing as soon as it is finished you will be able to add it to your project.": "{{repoName}}当前,一旦完成后,您就可以将其添加到项目中。", "Ask a question": "问一个问题", "Ask your first question": "问你的第一个问题", "<0>Create a new conversation with bloop by hitting <2> on your keyboard or by pressing the <4> in the header bar.": "<0>通过在键盘上击打<2> 或按下标题栏中的<4> 来创建一个新的对话。", @@ -690,6 +690,6 @@ "Back to current": "回到电流", "Go to current state": "进入当前状态", "Restore session": "还原会话", - "<0>repoName has finished indexing and was added to the context of the current project. You can also use it in your other projects now.": "<0> reponame 已完成索引,并已添加到当前项目的上下文中。 您现在也可以在其他项目中使用它。", - "{{repoName}} is currently indexing as soon as it is finished it will be added to your project.": "{{reponame}}当前索引一旦完成后,它将被添加到您的项目中。" -} \ No newline at end of file + "<0>repoName has finished indexing and was added to the context of the current project. You can also use it in your other projects now.": "<0>{{repoName}}已完成索引,并已添加到当前项目的上下文中。 您现在也可以在其他项目中使用它。", + "{{repoName}} is currently indexing as soon as it is finished it will be added to your project.": "{{repoName}}当前索引一旦完成后,它将被添加到您的项目中。" +}