remove unused code
This commit is contained in:
parent
9e3e28d153
commit
09e1c3ce59
6 changed files with 0 additions and 512 deletions
|
|
@ -3,7 +3,6 @@ import Layout from "./components/Layout";
|
|||
import { SubmenuContextProvidersProvider } from "./context/SubmenuContextProviders";
|
||||
import { VscThemeProvider } from "./context/VscTheme";
|
||||
import useSetup from "./hooks/useSetup";
|
||||
import { AddNewModel, ConfigureProvider } from "./pages/AddNewModel";
|
||||
import ConfigPage from "./pages/config";
|
||||
import ConfigErrorPage from "./pages/config-error";
|
||||
import ErrorPage from "./pages/error";
|
||||
|
|
@ -34,14 +33,6 @@ const router = createMemoryRouter([
|
|||
path: "/stats",
|
||||
element: <Stats />,
|
||||
},
|
||||
{
|
||||
path: "/addModel",
|
||||
element: <AddNewModel />,
|
||||
},
|
||||
{
|
||||
path: "/addModel/provider/:providerName",
|
||||
element: <ConfigureProvider />,
|
||||
},
|
||||
{
|
||||
path: ROUTES.CONFIG_ERROR,
|
||||
element: <ConfigErrorPage />,
|
||||
|
|
|
|||
|
|
@ -6,7 +6,6 @@ import { AuthProvider } from "../context/Auth";
|
|||
import { LocalStorageProvider } from "../context/LocalStorage";
|
||||
import { useWebviewListener } from "../hooks/useWebviewListener";
|
||||
import { useAppDispatch, useAppSelector } from "../redux/hooks";
|
||||
import { selectUseHub } from "../redux/selectors";
|
||||
import { focusEdit, setEditStatus } from "../redux/slices/editModeState";
|
||||
import {
|
||||
addCodeToEdit,
|
||||
|
|
@ -250,21 +249,6 @@ const Layout = () => {
|
|||
}
|
||||
}, [location]);
|
||||
|
||||
const useHub = useAppSelector(selectUseHub);
|
||||
|
||||
// Existing users that have already seen the onboarding card
|
||||
// should be shown an intro card for hub.continue.dev
|
||||
// useEffect(() => {
|
||||
// if (useHub !== true) {
|
||||
// return;
|
||||
// }
|
||||
// const seenHubIntro = getLocalStorage("seenHubIntro");
|
||||
// if (!onboardingCard.show && !seenHubIntro) {
|
||||
// onboardingCard.setActiveTab("ExistingUserHubIntro");
|
||||
// }
|
||||
// setLocalStorage("seenHubIntro", true);
|
||||
// }, [onboardingCard.show, useHub]);
|
||||
|
||||
return (
|
||||
<LocalStorageProvider>
|
||||
<AuthProvider>
|
||||
|
|
|
|||
|
|
@ -1,238 +0,0 @@
|
|||
import { ArrowLeftIcon, Cog6ToothIcon } from "@heroicons/react/24/outline";
|
||||
import _ from "lodash";
|
||||
import React, { useContext } from "react";
|
||||
import { useDispatch } from "react-redux";
|
||||
import { Link, useNavigate } from "react-router-dom";
|
||||
import styled from "styled-components";
|
||||
import {
|
||||
defaultBorderRadius,
|
||||
lightGray,
|
||||
vscBackground,
|
||||
} from "../../components";
|
||||
import ModelCard from "../../components/modelSelection/ModelCard";
|
||||
import Toggle from "../../components/modelSelection/Toggle";
|
||||
import { IdeMessengerContext } from "../../context/IdeMessenger";
|
||||
import { useNavigationListener } from "../../hooks/useNavigationListener";
|
||||
import { setDefaultModel } from "../../redux/slices/configSlice";
|
||||
import { ModelPackage, models } from "./configs/models";
|
||||
import { providers } from "./configs/providers";
|
||||
import { CustomModelButton } from "./ConfigureProvider";
|
||||
|
||||
const IntroDiv = styled.div`
|
||||
padding: 8px 12px;
|
||||
border-radius: ${defaultBorderRadius};
|
||||
border: 1px solid ${lightGray};
|
||||
margin-top: 1rem;
|
||||
margin-bottom: 1rem;
|
||||
`;
|
||||
|
||||
const GridDiv = styled.div`
|
||||
display: grid;
|
||||
grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
|
||||
grid-gap: 1.25rem;
|
||||
justify-items: center;
|
||||
align-items: center;
|
||||
`;
|
||||
|
||||
/**
|
||||
* Used to display groupings in the Models tab
|
||||
*/
|
||||
const modelsByProvider: Record<string, ModelPackage[]> = {
|
||||
"Open AI": [models.gpt4turbo, models.gpt4o, models.gpt35turbo],
|
||||
Anthropic: [models.claude3Opus, models.claude3Sonnet, models.claude35Haiku],
|
||||
Mistral: [
|
||||
models.codestral,
|
||||
models.mistral7b,
|
||||
models.mistral8x7b,
|
||||
models.mistral8x22b,
|
||||
models.mistralSmall,
|
||||
models.mistralLarge,
|
||||
],
|
||||
Cohere: [models.commandR, models.commandRPlus],
|
||||
DeepSeek: [
|
||||
models.deepseekCoderApi,
|
||||
models.deepseekChatApi,
|
||||
models.deepseekReasonerApi,
|
||||
],
|
||||
Gemini: [models.geminiPro, models.gemini15Pro, models.gemini15Flash],
|
||||
"Open Source": [models.llama3Chat, models.mistralOs, models.deepseek],
|
||||
};
|
||||
|
||||
function AddNewModel() {
|
||||
const navigate = useNavigate();
|
||||
const dispatch = useDispatch();
|
||||
useNavigationListener();
|
||||
const ideMessenger = useContext(IdeMessengerContext);
|
||||
|
||||
const [providersSelected, setProvidersSelected] = React.useState(true);
|
||||
|
||||
return (
|
||||
<div className="mb-6 overflow-y-scroll">
|
||||
<div
|
||||
className="sticky top-0 m-0 flex items-center p-0"
|
||||
style={{
|
||||
borderBottom: `0.5px solid ${lightGray}`,
|
||||
backgroundColor: vscBackground,
|
||||
zIndex: 2,
|
||||
}}
|
||||
>
|
||||
<ArrowLeftIcon
|
||||
width="1.2em"
|
||||
height="1.2em"
|
||||
onClick={() => navigate("/")}
|
||||
className="ml-4 inline-block cursor-pointer"
|
||||
/>
|
||||
<h3 className="m-2 inline-block text-lg font-bold">Add a new model</h3>
|
||||
</div>
|
||||
<br />
|
||||
<div className="px-6">
|
||||
<IntroDiv>
|
||||
To add a new model you can either:
|
||||
<ul>
|
||||
<li>
|
||||
Start by selecting and configuring a provider, then choosing your
|
||||
model
|
||||
</li>
|
||||
<li>Select a specific model directly</li>
|
||||
</ul>
|
||||
<Link
|
||||
target="_blank"
|
||||
to="https://docs.continue.dev/model-setup/overview"
|
||||
>
|
||||
Visit our setup overview docs
|
||||
</Link>{" "}
|
||||
to learn more.
|
||||
</IntroDiv>
|
||||
|
||||
<div className="col-span-full py-4">
|
||||
<Toggle
|
||||
selected={providersSelected}
|
||||
optionOne={"Start with a provider"}
|
||||
optionTwo={"Select a specific model"}
|
||||
onClick={() => {
|
||||
setProvidersSelected((prev) => !prev);
|
||||
}}
|
||||
></Toggle>
|
||||
</div>
|
||||
|
||||
{providersSelected ? (
|
||||
<>
|
||||
<div className="col-span-full mb-8 text-center leading-relaxed">
|
||||
<h2 className="mb-0">Providers</h2>
|
||||
<p className="mt-2">
|
||||
Select a provider below, or configure your own in{" "}
|
||||
<code>config.json</code>
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<GridDiv>
|
||||
{Object.entries(providers).map(([providerName, modelInfo], i) =>
|
||||
modelInfo ? (
|
||||
<ModelCard
|
||||
key={`${providerName}-${i}`}
|
||||
title={modelInfo.title}
|
||||
description={modelInfo.description}
|
||||
tags={modelInfo.tags}
|
||||
icon={modelInfo.icon}
|
||||
refUrl={`https://docs.continue.dev/reference/Model%20Providers/${
|
||||
modelInfo.refPage || modelInfo.provider.toLowerCase()
|
||||
}`}
|
||||
onClick={(e) => {
|
||||
console.log(`/addModel/provider/${providerName}`);
|
||||
navigate(`/addModel/provider/${providerName}`);
|
||||
}}
|
||||
/>
|
||||
) : null,
|
||||
)}
|
||||
</GridDiv>
|
||||
</>
|
||||
) : (
|
||||
<>
|
||||
<div className="col-span-full text-center leading-relaxed">
|
||||
<h2 className="mb-0">Models</h2>
|
||||
<p className="mt-2">
|
||||
Select a model from the most popular options below, or configure
|
||||
your own in <code>config.json</code>
|
||||
</p>
|
||||
</div>
|
||||
|
||||
{Object.entries(modelsByProvider).map(
|
||||
([providerTitle, modelConfigsByProviderTitle]) => (
|
||||
<div className="mb-6 flex flex-col">
|
||||
<div className="mb-4 w-full items-center">
|
||||
<h3 className="">{providerTitle}</h3>
|
||||
<hr
|
||||
style={{
|
||||
height: "0px",
|
||||
width: "100%",
|
||||
color: lightGray,
|
||||
border: `1px solid ${lightGray}`,
|
||||
borderRadius: "2px",
|
||||
}}
|
||||
/>
|
||||
</div>
|
||||
|
||||
<GridDiv>
|
||||
{modelConfigsByProviderTitle.map((config) => (
|
||||
<ModelCard
|
||||
title={config.title}
|
||||
description={config.description}
|
||||
tags={config.tags}
|
||||
icon={config.icon}
|
||||
dimensions={config.dimensions}
|
||||
providerOptions={config.providerOptions}
|
||||
onClick={(e, dimensionChoices, selectedProvider) => {
|
||||
if (!selectedProvider) {
|
||||
return;
|
||||
}
|
||||
const model = {
|
||||
...config.params,
|
||||
..._.merge(
|
||||
{},
|
||||
...(config.dimensions?.map((dimension, i) => {
|
||||
if (!dimensionChoices?.[i]) return {};
|
||||
return {
|
||||
...dimension.options[dimensionChoices[i]],
|
||||
};
|
||||
}) || []),
|
||||
),
|
||||
provider: providers[selectedProvider]?.provider,
|
||||
};
|
||||
ideMessenger.post("config/addModel", { model });
|
||||
dispatch(
|
||||
setDefaultModel({
|
||||
title: model.title,
|
||||
force: true,
|
||||
}),
|
||||
);
|
||||
navigate("/");
|
||||
}}
|
||||
/>
|
||||
))}
|
||||
</GridDiv>
|
||||
</div>
|
||||
),
|
||||
)}
|
||||
</>
|
||||
)}
|
||||
|
||||
<CustomModelButton
|
||||
className="mt-12"
|
||||
disabled={false}
|
||||
onClick={(e) => {
|
||||
ideMessenger.post("config/openProfile", {
|
||||
profileId: undefined,
|
||||
});
|
||||
}}
|
||||
>
|
||||
<h3 className="my-2 text-center">
|
||||
<Cog6ToothIcon className="inline-block h-5 w-5 px-4 align-middle" />
|
||||
Open Assistant configuration
|
||||
</h3>
|
||||
</CustomModelButton>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
export default AddNewModel;
|
||||
|
|
@ -1,245 +0,0 @@
|
|||
import { ArrowLeftIcon } from "@heroicons/react/24/outline";
|
||||
import _ from "lodash";
|
||||
import { useCallback, useContext, useEffect, useState } from "react";
|
||||
import { FormProvider, useForm } from "react-hook-form";
|
||||
import { useDispatch } from "react-redux";
|
||||
import { useNavigate, useParams } from "react-router-dom";
|
||||
import styled from "styled-components";
|
||||
import {
|
||||
Input,
|
||||
defaultBorderRadius,
|
||||
lightGray,
|
||||
vscBackground,
|
||||
} from "../../components";
|
||||
import StyledMarkdownPreview from "../../components/markdown/StyledMarkdownPreview";
|
||||
import ModelCard from "../../components/modelSelection/ModelCard";
|
||||
import { ModelProviderTag } from "../../components/modelSelection/ModelProviderTag";
|
||||
import { IdeMessengerContext } from "../../context/IdeMessenger";
|
||||
import { useNavigationListener } from "../../hooks/useNavigationListener";
|
||||
import { updatedObj } from "../../util";
|
||||
import type { ProviderInfo } from "./configs/providers";
|
||||
import { providers } from "./configs/providers";
|
||||
import { setDefaultModel } from "../../redux/slices/configSlice";
|
||||
|
||||
const GridDiv = styled.div`
|
||||
display: grid;
|
||||
grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
|
||||
grid-gap: 2rem;
|
||||
padding: 1rem;
|
||||
justify-items: center;
|
||||
align-items: center;
|
||||
`;
|
||||
|
||||
export const CustomModelButton = styled.div<{ disabled: boolean }>`
|
||||
border: 1px solid ${lightGray};
|
||||
border-radius: ${defaultBorderRadius};
|
||||
padding: 4px 8px;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
transition: all 0.5s;
|
||||
|
||||
${(props) =>
|
||||
props.disabled
|
||||
? `
|
||||
opacity: 0.5;
|
||||
`
|
||||
: `
|
||||
&:hover {
|
||||
border: 1px solid #be1b55;
|
||||
background-color: #be1b5522;
|
||||
cursor: pointer;
|
||||
}
|
||||
`}
|
||||
`;
|
||||
|
||||
function ConfigureProvider() {
|
||||
useNavigationListener();
|
||||
const formMethods = useForm();
|
||||
const { providerName } = useParams();
|
||||
const ideMessenger = useContext(IdeMessengerContext);
|
||||
const dispatch = useDispatch();
|
||||
const navigate = useNavigate();
|
||||
const [modelInfo, setModelInfo] = useState<ProviderInfo | undefined>(
|
||||
undefined,
|
||||
);
|
||||
|
||||
useEffect(() => {
|
||||
if (providerName) {
|
||||
setModelInfo(providers[providerName]);
|
||||
}
|
||||
}, [providerName]);
|
||||
|
||||
const disableModelCards = useCallback(() => {
|
||||
return (
|
||||
modelInfo?.collectInputFor?.some((d) => {
|
||||
if (!d.required) return false;
|
||||
const val = formMethods.watch(d.key);
|
||||
return (
|
||||
typeof val === "undefined" || (typeof val === "string" && val === "")
|
||||
);
|
||||
}) || false
|
||||
);
|
||||
}, [modelInfo, formMethods]);
|
||||
|
||||
return (
|
||||
<FormProvider {...formMethods}>
|
||||
<div className="overflow-y-scroll">
|
||||
<div
|
||||
className="sticky top-0 m-0 flex items-center p-0"
|
||||
style={{
|
||||
borderBottom: `0.5px solid ${lightGray}`,
|
||||
backgroundColor: vscBackground,
|
||||
zIndex: 2,
|
||||
}}
|
||||
>
|
||||
<ArrowLeftIcon
|
||||
width="1.2em"
|
||||
height="1.2em"
|
||||
onClick={() => navigate("/addModel")}
|
||||
className="ml-4 inline-block cursor-pointer"
|
||||
/>
|
||||
<h3 className="m-2 inline-block text-lg font-bold">
|
||||
Configure provider
|
||||
</h3>
|
||||
</div>
|
||||
|
||||
<div className="px-2">
|
||||
<div style={{ display: "flex", alignItems: "center" }}>
|
||||
{window.vscMediaUrl && modelInfo?.icon && (
|
||||
<img
|
||||
src={`${window.vscMediaUrl}/logos/${modelInfo?.icon}`}
|
||||
height="24px"
|
||||
style={{ marginRight: "10px" }}
|
||||
/>
|
||||
)}
|
||||
<h2>{modelInfo?.title}</h2>
|
||||
</div>
|
||||
|
||||
{modelInfo?.tags?.map((tag, i) => (
|
||||
<ModelProviderTag key={i} tag={tag} />
|
||||
))}
|
||||
|
||||
<StyledMarkdownPreview
|
||||
className="mt-2"
|
||||
source={modelInfo?.longDescription || modelInfo?.description}
|
||||
/>
|
||||
<br />
|
||||
|
||||
{(modelInfo?.collectInputFor?.filter((d) => d.required).length || 0) >
|
||||
0 && (
|
||||
<>
|
||||
<h3 className="mb-2">Enter required parameters</h3>
|
||||
|
||||
{modelInfo?.collectInputFor
|
||||
?.filter((d) => d.required)
|
||||
.map((d, idx) => (
|
||||
<div key={idx} className="mb-2">
|
||||
<label htmlFor={d.key}>{d.label}</label>
|
||||
<Input
|
||||
type={d.inputType}
|
||||
id={d.key}
|
||||
className="m-2 rounded-md border-2 border-gray-200 p-2"
|
||||
placeholder={d.placeholder ?? d.label}
|
||||
defaultValue={d.defaultValue}
|
||||
min={d.min}
|
||||
max={d.max}
|
||||
step={d.step}
|
||||
{...formMethods.register(d.key, {
|
||||
required: true,
|
||||
})}
|
||||
/>
|
||||
</div>
|
||||
))}
|
||||
</>
|
||||
)}
|
||||
|
||||
{(modelInfo?.collectInputFor?.filter((d) => !d.required).length ||
|
||||
0) > 0 && (
|
||||
<details>
|
||||
<summary className="mb-2 cursor-pointer">
|
||||
<b>Advanced (optional)</b>
|
||||
</summary>
|
||||
|
||||
{modelInfo?.collectInputFor?.map((d, idx) => {
|
||||
if (d.required) return null;
|
||||
return (
|
||||
<div key={idx}>
|
||||
<label htmlFor={d.key}>{d.label}</label>
|
||||
<Input
|
||||
type={d.inputType}
|
||||
id={d.key}
|
||||
className="m-2 rounded-md border-2 border-gray-200 p-2"
|
||||
placeholder={d.placeholder ?? d.label}
|
||||
defaultValue={d.defaultValue}
|
||||
min={d.min}
|
||||
max={d.max}
|
||||
step={d.step}
|
||||
{...formMethods.register(d.key, {
|
||||
required: false,
|
||||
})}
|
||||
/>
|
||||
</div>
|
||||
);
|
||||
})}
|
||||
</details>
|
||||
)}
|
||||
|
||||
<h3 className="mb-2">Select a model preset</h3>
|
||||
</div>
|
||||
<GridDiv>
|
||||
{modelInfo?.packages.map((pkg, idx) => {
|
||||
return (
|
||||
<ModelCard
|
||||
key={idx}
|
||||
disabled={disableModelCards()}
|
||||
title={pkg.title}
|
||||
description={pkg.description}
|
||||
tags={pkg.tags}
|
||||
refUrl={pkg.refUrl}
|
||||
icon={pkg.icon || modelInfo.icon}
|
||||
dimensions={pkg.dimensions}
|
||||
onClick={(e, dimensionChoices) => {
|
||||
if (disableModelCards()) return;
|
||||
let formParams: any = {};
|
||||
for (const d of modelInfo.collectInputFor || []) {
|
||||
const val = formMethods.watch(d.key);
|
||||
if (val === "" || val === undefined || val === null) {
|
||||
continue;
|
||||
}
|
||||
formParams = updatedObj(formParams, {
|
||||
[d.key]: d.inputType === "text" ? val : parseFloat(val),
|
||||
});
|
||||
}
|
||||
|
||||
const model = {
|
||||
...pkg.params,
|
||||
...modelInfo.params,
|
||||
..._.merge(
|
||||
{},
|
||||
...(pkg.dimensions?.map((dimension, i) => {
|
||||
if (!dimensionChoices?.[i]) return {};
|
||||
return {
|
||||
...dimension.options[dimensionChoices[i]],
|
||||
};
|
||||
}) || []),
|
||||
),
|
||||
...formParams,
|
||||
provider: modelInfo.provider,
|
||||
};
|
||||
ideMessenger.post("config/addModel", { model });
|
||||
dispatch(
|
||||
setDefaultModel({ title: model.title, force: true }),
|
||||
);
|
||||
navigate("/");
|
||||
}}
|
||||
/>
|
||||
);
|
||||
})}
|
||||
</GridDiv>
|
||||
</div>
|
||||
</FormProvider>
|
||||
);
|
||||
}
|
||||
|
||||
export default ConfigureProvider;
|
||||
|
|
@ -1,2 +0,0 @@
|
|||
export { default as AddNewModel } from "./AddNewModel";
|
||||
export { default as ConfigureProvider } from "./ConfigureProvider";
|
||||
|
|
@ -15,8 +15,6 @@ type LocalStorageTypes = {
|
|||
showTutorialCard: boolean;
|
||||
shownProfilesIntroduction: boolean;
|
||||
disableIndexing: boolean;
|
||||
/** Indicates whether the user has seen any kind of onboarding card since hub.continue.dev */
|
||||
seenHubIntro: boolean;
|
||||
};
|
||||
|
||||
export enum LocalStorageKey {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue