From 7f0536607ed418b7bfcc4d1d7182318cc91d9097 Mon Sep 17 00:00:00 2001 From: Pixel <54180211+pixelsortr@users.noreply.github.com> Date: Mon, 6 May 2024 03:28:28 -0300 Subject: [PATCH 1/2] add PySide6 docs to preindexed docs (#1236) --- core/indexing/docs/preIndexedDocs.ts | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/core/indexing/docs/preIndexedDocs.ts b/core/indexing/docs/preIndexedDocs.ts index a09e1e1cf..1a1d9ecbb 100644 --- a/core/indexing/docs/preIndexedDocs.ts +++ b/core/indexing/docs/preIndexedDocs.ts @@ -226,6 +226,11 @@ const configs: SiteIndexingConfig[] = [ startUrl: "https://developer.wordpress.org/reference/", rootUrl: "https://developer.wordpress.org/reference/", }, + { + title: "PySide6", + startUrl: "https://doc.qt.io/qtforpython-6/quickstart.html", + rootUrl: "https://doc.qt.io/qtforpython-6/api.html", + }, ]; export default configs; From 6803dc5533023c8da6bf9b3ec093dc9726161e74 Mon Sep 17 00:00:00 2001 From: Justin Milner <42585006+justinmilner1@users.noreply.github.com> Date: Mon, 6 May 2024 02:41:40 -0400 Subject: [PATCH 2/2] =?UTF-8?q?CON-232=20bring=20custom=20docs=20to=20top,?= =?UTF-8?q?=20alphabetize=20doc=20results,=20make=20scrol=E2=80=A6=20(#123?= =?UTF-8?q?9)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * CON-232 bring custom docs to top, alphabetize doc results, make scrollable * CON-232 cleanup --------- Co-authored-by: Justin Milner --- core/context/providers/DocsContextProvider.ts | 18 +++++++++++++++++- gui/src/components/mainInput/MentionList.tsx | 2 ++ gui/src/hooks/useSubmenuContextProviders.tsx | 2 +- 3 files changed, 20 insertions(+), 2 deletions(-) diff --git a/core/context/providers/DocsContextProvider.ts b/core/context/providers/DocsContextProvider.ts index 46d563e9f..6e5fd7e5f 100644 --- a/core/context/providers/DocsContextProvider.ts +++ b/core/context/providers/DocsContextProvider.ts @@ -24,7 +24,6 @@ class DocsContextProvider extends BaseContextProvider { extras: ContextProviderExtras, ): Promise { const { retrieveDocs } = await import("../../indexing/docs/db"); - const embeddingsProvider = new TransformersJsEmbeddingsProvider(); const [vector] = await embeddingsProvider.embed([extras.fullInput]); @@ -102,6 +101,23 @@ class DocsContextProvider extends BaseContextProvider { id: config.startUrl, })), ); + + // Sort submenuItems such that the objects with titles which don't occur in configs occur first, and alphabetized + submenuItems.sort((a, b) => { + const aTitleInConfigs = !!configs.find(config => config.title === a.title); + const bTitleInConfigs = !!configs.find(config => config.title === b.title); + + // Primary criterion: Items not in configs come first + if (!aTitleInConfigs && bTitleInConfigs) { + return -1; + } else if (aTitleInConfigs && !bTitleInConfigs) { + return 1; + } else { + // Secondary criterion: Alphabetical order when both items are in the same category + return a.title.localeCompare(b.title); + } + }); + return submenuItems; } } diff --git a/gui/src/components/mainInput/MentionList.tsx b/gui/src/components/mainInput/MentionList.tsx index ba6e23f3c..3e8a9417e 100644 --- a/gui/src/components/mainInput/MentionList.tsx +++ b/gui/src/components/mainInput/MentionList.tsx @@ -108,6 +108,8 @@ const ItemsDiv = styled.div` 0px 10px 20px rgba(0, 0, 0, 0.1); font-size: 0.9rem; overflow-x: hidden; + overflow-y: auto; + max-height: 330px; padding: 0.2rem; position: relative; diff --git a/gui/src/hooks/useSubmenuContextProviders.tsx b/gui/src/hooks/useSubmenuContextProviders.tsx index 8a21abc4e..cf70b7ea0 100644 --- a/gui/src/hooks/useSubmenuContextProviders.tsx +++ b/gui/src/hooks/useSubmenuContextProviders.tsx @@ -13,7 +13,7 @@ const MINISEARCH_OPTIONS = { fuzzy: 2, }; -const MAX_LENGTH = 10; +const MAX_LENGTH = 70; function useSubmenuContextProviders() { // TODO: Refresh periodically