Merge branch 'preview' of https://github.com/continuedev/continue into preview

This commit is contained in:
Nate Sesti 2024-05-06 10:06:10 -07:00
commit c3971a472e
4 changed files with 25 additions and 2 deletions

View file

@ -24,7 +24,6 @@ class DocsContextProvider extends BaseContextProvider {
extras: ContextProviderExtras,
): Promise<ContextItem[]> {
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;
}
}

View file

@ -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;

View file

@ -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;

View file

@ -13,7 +13,7 @@ const MINISEARCH_OPTIONS = {
fuzzy: 2,
};
const MAX_LENGTH = 10;
const MAX_LENGTH = 70;
function useSubmenuContextProviders() {
// TODO: Refresh periodically