Merge pull request #2284 from continuedev/pe/hmr-fixes
fix: HMR issues with non-react component exports
This commit is contained in:
commit
bc5aeb32d2
32 changed files with 213 additions and 214 deletions
2
binary/package-lock.json
generated
2
binary/package-lock.json
generated
|
|
@ -48,7 +48,7 @@
|
|||
"@aws-sdk/client-sagemaker-runtime": "^3.621.0",
|
||||
"@aws-sdk/credential-providers": "^3.620.1",
|
||||
"@continuedev/config-types": "^1.0.10",
|
||||
"@continuedev/llm-info": "^1.0.1",
|
||||
"@continuedev/llm-info": "^1.0.2",
|
||||
"@mozilla/readability": "^0.5.0",
|
||||
"@octokit/rest": "^20.0.2",
|
||||
"@typescript-eslint/eslint-plugin": "^7.8.0",
|
||||
|
|
|
|||
|
|
@ -342,11 +342,11 @@ ${prompt}`;
|
|||
) {
|
||||
if (resp.url.includes("codestral.mistral.ai")) {
|
||||
throw new Error(
|
||||
`You are using a Mistral API key, which is not compatible with the Codestral API. Please either obtain a Codestral API key, or use the Mistral API by setting "apiBase" to "https://api.mistral.ai/v1" in config.json.`,
|
||||
'You are using a Mistral API key, which is not compatible with the Codestral API. Please either obtain a Codestral API key, or use the Mistral API by setting "apiBase" to "https://api.mistral.ai/v1" in config.json.',
|
||||
);
|
||||
} else {
|
||||
throw new Error(
|
||||
`You are using a Codestral API key, which is not compatible with the Mistral API. Please either obtain a Mistral API key, or use the the Codestral API by setting "apiBase" to "https://codestral.mistral.ai/v1" in config.json.`,
|
||||
'You are using a Codestral API key, which is not compatible with the Mistral API. Please either obtain a Mistral API key, or use the the Codestral API by setting "apiBase" to "https://codestral.mistral.ai/v1" in config.json.',
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
6
extensions/vscode/package-lock.json
generated
6
extensions/vscode/package-lock.json
generated
|
|
@ -1,12 +1,12 @@
|
|||
{
|
||||
"name": "continue",
|
||||
"version": "0.9.209",
|
||||
"version": "0.9.211",
|
||||
"lockfileVersion": 3,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "continue",
|
||||
"version": "0.9.209",
|
||||
"version": "0.9.211",
|
||||
"license": "Apache-2.0",
|
||||
"dependencies": {
|
||||
"@electron/rebuild": "^3.2.10",
|
||||
|
|
@ -99,7 +99,7 @@
|
|||
"@aws-sdk/client-sagemaker-runtime": "^3.621.0",
|
||||
"@aws-sdk/credential-providers": "^3.620.1",
|
||||
"@continuedev/config-types": "^1.0.10",
|
||||
"@continuedev/llm-info": "^1.0.1",
|
||||
"@continuedev/llm-info": "^1.0.2",
|
||||
"@mozilla/readability": "^0.5.0",
|
||||
"@octokit/rest": "^20.0.2",
|
||||
"@typescript-eslint/eslint-plugin": "^7.8.0",
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
"name": "continue",
|
||||
"icon": "media/icon.png",
|
||||
"author": "Continue Dev, Inc",
|
||||
"version": "0.9.210",
|
||||
"version": "0.9.211",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/continuedev/continue"
|
||||
|
|
|
|||
2
gui/package-lock.json
generated
2
gui/package-lock.json
generated
|
|
@ -92,7 +92,7 @@
|
|||
"@aws-sdk/client-sagemaker-runtime": "^3.621.0",
|
||||
"@aws-sdk/credential-providers": "^3.620.1",
|
||||
"@continuedev/config-types": "^1.0.10",
|
||||
"@continuedev/llm-info": "^1.0.1",
|
||||
"@continuedev/llm-info": "^1.0.2",
|
||||
"@mozilla/readability": "^0.5.0",
|
||||
"@octokit/rest": "^20.0.2",
|
||||
"@typescript-eslint/eslint-plugin": "^7.8.0",
|
||||
|
|
|
|||
|
|
@ -1,9 +1,10 @@
|
|||
import React, { useState } from "react";
|
||||
import ReactDOM from "react-dom";
|
||||
import { HeaderButton, StyledTooltip } from ".";
|
||||
import { HeaderButton } from ".";
|
||||
import { type PlacesType } from "react-tooltip";
|
||||
|
||||
import { v4 as uuidv4 } from "uuid";
|
||||
import { ToolTip } from "./gui/Tooltip";
|
||||
|
||||
interface HeaderButtonWithTextProps {
|
||||
text: string | undefined;
|
||||
|
|
@ -59,12 +60,9 @@ const HeaderButtonWithText = React.forwardRef<
|
|||
{props.text &&
|
||||
tooltipPortalDiv &&
|
||||
ReactDOM.createPortal(
|
||||
<StyledTooltip
|
||||
id={tooltipId}
|
||||
place={props.tooltipPlacement ?? "bottom"}
|
||||
>
|
||||
<ToolTip id={tooltipId} place={props.tooltipPlacement ?? "bottom"}>
|
||||
{props.text}
|
||||
</StyledTooltip>,
|
||||
</ToolTip>,
|
||||
tooltipPortalDiv,
|
||||
)}
|
||||
</>
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
import { InformationCircleIcon } from "@heroicons/react/24/outline";
|
||||
import ReactDOM from "react-dom";
|
||||
import { StyledTooltip } from ".";
|
||||
import { ToolTip } from "./gui/Tooltip";
|
||||
|
||||
const InfoHover = ({ msg }: { msg: string }) => {
|
||||
const id = `info-hover-${encodeURIComponent(msg)}`;
|
||||
|
|
@ -15,10 +15,10 @@ const InfoHover = ({ msg }: { msg: string }) => {
|
|||
/>
|
||||
{tooltipPortalDiv &&
|
||||
ReactDOM.createPortal(
|
||||
<StyledTooltip id={id} place="bottom">
|
||||
<ToolTip id={id} place="bottom">
|
||||
{msg}
|
||||
</StyledTooltip>,
|
||||
tooltipPortalDiv
|
||||
</ToolTip>,
|
||||
tooltipPortalDiv,
|
||||
)}
|
||||
</>
|
||||
);
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
import * as Tabs from "./tabs";
|
||||
import OnboardingCardTabs, { TabTitle } from "./components/OnboardingCardTabs";
|
||||
import { TabTitle, OnboardingCardTabs } from "./components/OnboardingCardTabs";
|
||||
import { XMarkIcon } from "@heroicons/react/24/outline";
|
||||
import styled from "styled-components";
|
||||
import { CloseButton, defaultBorderRadius, vscInputBackground } from "../";
|
||||
|
|
@ -20,14 +20,9 @@ export interface OnboardingCardState {
|
|||
activeTab?: TabTitle;
|
||||
}
|
||||
|
||||
export const defaultOnboardingCardState: OnboardingCardState = {
|
||||
show: false,
|
||||
activeTab: "Quickstart",
|
||||
};
|
||||
|
||||
export type OnboardingCardProps = Pick<OnboardingCardState, "activeTab">;
|
||||
|
||||
function OnboardingCard(props: OnboardingCardProps) {
|
||||
export function OnboardingCard(props: OnboardingCardProps) {
|
||||
const onboardingCard = useOnboardingCard();
|
||||
|
||||
function renderTabContent() {
|
||||
|
|
@ -60,5 +55,3 @@ function OnboardingCard(props: OnboardingCardProps) {
|
|||
</StyledCard>
|
||||
);
|
||||
}
|
||||
|
||||
export default OnboardingCard;
|
||||
|
|
|
|||
|
|
@ -2,8 +2,9 @@ import { CommandLineIcon } from "@heroicons/react/24/outline";
|
|||
import { useContext } from "react";
|
||||
import { IdeMessengerContext } from "../../../context/IdeMessenger";
|
||||
import ReactDOM from "react-dom";
|
||||
import { StyledActionButton, StyledTooltip } from "../..";
|
||||
import { StyledActionButton } from "../..";
|
||||
import OllamaCompletedStep from "./OllamaCompletedStep";
|
||||
import { ToolTip } from "../../gui/Tooltip";
|
||||
|
||||
interface OllamaModelDownloadProps {
|
||||
title: string;
|
||||
|
|
@ -39,9 +40,9 @@ function OllamaModelDownload({
|
|||
</StyledActionButton>
|
||||
{tooltipPortalDiv &&
|
||||
ReactDOM.createPortal(
|
||||
<StyledTooltip id={id} place="top">
|
||||
<ToolTip id={id} place="top">
|
||||
Copy into terminal
|
||||
</StyledTooltip>,
|
||||
</ToolTip>,
|
||||
tooltipPortalDiv,
|
||||
)}
|
||||
</>
|
||||
|
|
|
|||
|
|
@ -8,12 +8,7 @@ import { providers } from "../../../pages/AddNewModel/configs/providers";
|
|||
import { useCheckOllamaModels } from "../hooks/useCheckOllamaModels";
|
||||
import { StyledActionButton } from "../..";
|
||||
import OllamaCompletedStep from "./OllamaCompletedStep";
|
||||
|
||||
export enum OllamaConnectionStatuses {
|
||||
WaitingToDownload = "WaitingToDownload",
|
||||
Downloading = "Downloading",
|
||||
Verified = "Verified",
|
||||
}
|
||||
import { OllamaConnectionStatuses } from "../utils";
|
||||
|
||||
interface OllamaStatusProps {
|
||||
onConnectionVerified: () => void;
|
||||
|
|
@ -23,7 +18,7 @@ const {
|
|||
ollama: { downloadUrl },
|
||||
} = providers;
|
||||
|
||||
function OllamaStatus({ onConnectionVerified }: OllamaStatusProps) {
|
||||
export function OllamaStatus({ onConnectionVerified }: OllamaStatusProps) {
|
||||
const ideMessenger = useContext(IdeMessengerContext);
|
||||
|
||||
const [status, setStatus] = useState<OllamaConnectionStatuses>(
|
||||
|
|
@ -63,5 +58,3 @@ function OllamaStatus({ onConnectionVerified }: OllamaStatusProps) {
|
|||
);
|
||||
}
|
||||
}
|
||||
|
||||
export default OllamaStatus;
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
import styled from "styled-components";
|
||||
import { vscButtonBackground, vscForeground } from "../..";
|
||||
import { vscForeground } from "../..";
|
||||
import { hasPassedFTL } from "../../../util/freeTrial";
|
||||
|
||||
interface OnboardingCardTabsProps {
|
||||
|
|
@ -49,7 +49,7 @@ const TabList = styled.div`
|
|||
border-color: ${vscForeground};
|
||||
`;
|
||||
|
||||
function OnboardingCardTabs({
|
||||
export function OnboardingCardTabs({
|
||||
activeTab,
|
||||
onTabClick,
|
||||
}: OnboardingCardTabsProps) {
|
||||
|
|
@ -74,5 +74,3 @@ function OnboardingCardTabs({
|
|||
</TabList>
|
||||
);
|
||||
}
|
||||
|
||||
export default OnboardingCardTabs;
|
||||
|
|
|
|||
|
|
@ -1,4 +1,3 @@
|
|||
export * from "./OnboardingCard";
|
||||
export { default } from "./OnboardingCard";
|
||||
export * from "./utils";
|
||||
export * from "./hooks/useOnboardingCard";
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ import { setDefaultModel } from "../../../redux/slices/stateSlice";
|
|||
import { hasPassedFTL } from "../../../util/freeTrial";
|
||||
import AddModelButtonSubtext from "../../AddModelButtonSubtext";
|
||||
import OllamaModelDownload from "../components/OllamaModelDownload";
|
||||
import OllamaStatus from "../components/OllamaStatus";
|
||||
import { OllamaStatus } from "../components/OllamaStatus";
|
||||
import { useCheckOllamaModels, useSubmitOnboarding } from "../hooks";
|
||||
|
||||
function OnboardingLocalTab() {
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
import { getLocalStorage, setLocalStorage } from "../../util/localStorage";
|
||||
import { OnboardingCardState } from "./OnboardingCard";
|
||||
|
||||
// Note that there is no "NotStarted" status since the
|
||||
// local storage value is null until onboarding begins
|
||||
|
|
@ -20,3 +21,14 @@ export function isNewUserOnboarding() {
|
|||
|
||||
return onboardingStatus === undefined;
|
||||
}
|
||||
|
||||
export const defaultOnboardingCardState: OnboardingCardState = {
|
||||
show: false,
|
||||
activeTab: "Quickstart",
|
||||
};
|
||||
|
||||
export enum OllamaConnectionStatuses {
|
||||
WaitingToDownload = "WaitingToDownload",
|
||||
Downloading = "Downloading",
|
||||
Verified = "Verified",
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,12 +1,8 @@
|
|||
import ReactDOM from "react-dom";
|
||||
import styled from "styled-components";
|
||||
import {
|
||||
StyledTooltip,
|
||||
defaultBorderRadius,
|
||||
lightGray,
|
||||
vscForeground,
|
||||
} from "..";
|
||||
import { defaultBorderRadius, lightGray, vscForeground } from "..";
|
||||
import { getPlatform, isJetBrains } from "../../util";
|
||||
import { ToolTip } from "../gui/Tooltip";
|
||||
|
||||
const GridDiv = styled.div`
|
||||
display: grid;
|
||||
|
|
@ -51,9 +47,9 @@ function KeyDiv({ text }: { text: string }) {
|
|||
</StyledKeyDiv>
|
||||
{tooltipPortalDiv &&
|
||||
ReactDOM.createPortal(
|
||||
<StyledTooltip id={`header_button_${text}`} place="bottom">
|
||||
<ToolTip id={`header_button_${text}`} place="bottom">
|
||||
{keyToName[text]}
|
||||
</StyledTooltip>,
|
||||
</ToolTip>,
|
||||
tooltipPortalDiv,
|
||||
)}
|
||||
</>
|
||||
|
|
|
|||
24
gui/src/components/gui/Tooltip.tsx
Normal file
24
gui/src/components/gui/Tooltip.tsx
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
import { Tooltip } from "react-tooltip";
|
||||
import { vscInputBackground, vscBadgeBackground, vscForeground } from "..";
|
||||
import { getFontSize } from "../../util";
|
||||
|
||||
const TooltipStyles = {
|
||||
fontSize: `${getFontSize() - 2}px`,
|
||||
backgroundColor: vscInputBackground,
|
||||
boxShadow: `0px 0px 2px 1px ${vscBadgeBackground}`,
|
||||
color: vscForeground,
|
||||
padding: "2px 6px",
|
||||
zIndex: 1000,
|
||||
maxWidth: "80vw",
|
||||
textAlign: "center",
|
||||
overflow: "hidden",
|
||||
};
|
||||
|
||||
export function ToolTip(props: any) {
|
||||
const combinedStyles = {
|
||||
...TooltipStyles,
|
||||
...props.style,
|
||||
};
|
||||
|
||||
return <Tooltip {...props} style={combinedStyles} />;
|
||||
}
|
||||
|
|
@ -1,4 +1,3 @@
|
|||
import { Tooltip } from "react-tooltip";
|
||||
import styled, { keyframes } from "styled-components";
|
||||
import { getFontSize, isJetBrains } from "../util";
|
||||
|
||||
|
|
@ -197,27 +196,6 @@ export const CustomScrollbarDiv = styled.div`
|
|||
}
|
||||
`;
|
||||
|
||||
const TooltipStyles = {
|
||||
fontSize: `${getFontSize() - 2}px`,
|
||||
backgroundColor: vscInputBackground,
|
||||
boxShadow: `0px 0px 2px 1px ${vscBadgeBackground}`,
|
||||
color: vscForeground,
|
||||
padding: "2px 6px",
|
||||
zIndex: 1000,
|
||||
maxWidth: "80vw",
|
||||
textAlign: "center",
|
||||
overflow: "hidden",
|
||||
};
|
||||
|
||||
export function StyledTooltip(props: any) {
|
||||
const combinedStyles = {
|
||||
...TooltipStyles,
|
||||
...props.style, // Merge any additional styles passed via props
|
||||
};
|
||||
|
||||
return <Tooltip {...props} style={combinedStyles} />;
|
||||
}
|
||||
|
||||
export const TextArea = styled.textarea`
|
||||
padding: 8px;
|
||||
font-family: inherit;
|
||||
|
|
@ -3,7 +3,7 @@ import ReactDOM from "react-dom";
|
|||
import { useDispatch } from "react-redux";
|
||||
import { useNavigate } from "react-router-dom";
|
||||
import styled from "styled-components";
|
||||
import { StyledTooltip, lightGray, vscForeground } from "..";
|
||||
import { lightGray, vscForeground } from "..";
|
||||
import AddModelForm from "../../forms/AddModelForm";
|
||||
import {
|
||||
setDialogMessage,
|
||||
|
|
@ -11,6 +11,7 @@ import {
|
|||
} from "../../redux/slices/uiStateSlice";
|
||||
import { getFontSize } from "../../util";
|
||||
import { FREE_TRIAL_LIMIT_REQUESTS } from "../../util/freeTrial";
|
||||
import { ToolTip } from "../gui/Tooltip";
|
||||
|
||||
const ProgressBarWrapper = styled.div`
|
||||
width: 100px;
|
||||
|
|
@ -71,9 +72,9 @@ const ProgressBar = ({ completed, total }: ProgressBarProps) => {
|
|||
</div>
|
||||
{tooltipPortalDiv &&
|
||||
ReactDOM.createPortal(
|
||||
<StyledTooltip id="usage_progress_bar" place="top">
|
||||
<ToolTip id="usage_progress_bar" place="top">
|
||||
Configure a model above in order to continue
|
||||
</StyledTooltip>,
|
||||
</ToolTip>,
|
||||
tooltipPortalDiv,
|
||||
)}
|
||||
</>
|
||||
|
|
@ -117,9 +118,9 @@ const ProgressBar = ({ completed, total }: ProgressBarProps) => {
|
|||
|
||||
{tooltipPortalDiv &&
|
||||
ReactDOM.createPortal(
|
||||
<StyledTooltip id="usage_progress_bar" place="top">
|
||||
<ToolTip id="usage_progress_bar" place="top">
|
||||
{`Click to use your own API key or local LLM (required after ${FREE_TRIAL_LIMIT_REQUESTS} inputs)`}
|
||||
</StyledTooltip>,
|
||||
</ToolTip>,
|
||||
tooltipPortalDiv,
|
||||
)}
|
||||
</>
|
||||
|
|
|
|||
97
gui/src/components/mainInput/CodeBlockComponent.tsx
Normal file
97
gui/src/components/mainInput/CodeBlockComponent.tsx
Normal file
|
|
@ -0,0 +1,97 @@
|
|||
import { NodeViewWrapper } from "@tiptap/react";
|
||||
import { ContextItemWithId } from "core";
|
||||
import { useDispatch, useSelector } from "react-redux";
|
||||
import { vscBadgeBackground } from "..";
|
||||
import { setEditingContextItemAtIndex } from "../../redux/slices/stateSlice";
|
||||
import { RootState } from "../../redux/store";
|
||||
import CodeSnippetPreview from "../markdown/CodeSnippetPreview";
|
||||
|
||||
export const CodeBlockComponent = ({
|
||||
node,
|
||||
deleteNode,
|
||||
selected,
|
||||
editor,
|
||||
updateAttributes,
|
||||
}: any) => {
|
||||
const dispatch = useDispatch();
|
||||
const item: ContextItemWithId = node.attrs.item;
|
||||
|
||||
const contextItems = useSelector(
|
||||
(state: RootState) => state.state.contextItems,
|
||||
);
|
||||
return (
|
||||
<NodeViewWrapper className="code-block-with-content" as="p">
|
||||
<CodeSnippetPreview
|
||||
borderColor={
|
||||
item.id === contextItems[0]?.id
|
||||
? "#d0d"
|
||||
: selected
|
||||
? vscBadgeBackground
|
||||
: undefined
|
||||
}
|
||||
item={item}
|
||||
onDelete={() => {
|
||||
deleteNode();
|
||||
}}
|
||||
onEdit={async () => {
|
||||
dispatch(setEditingContextItemAtIndex({ item }));
|
||||
if (item.id === contextItems[0]?.id) {
|
||||
// Find and delete the /edit command
|
||||
let index = 0;
|
||||
for (const el of editor.getJSON().content) {
|
||||
if (el.type === "slashcommand") {
|
||||
if (el.attrs.id === "/edit") {
|
||||
editor
|
||||
.chain()
|
||||
.deleteRange({ from: index, to: index + 2 })
|
||||
.focus("end")
|
||||
.run();
|
||||
break;
|
||||
}
|
||||
}
|
||||
index += 1;
|
||||
}
|
||||
|
||||
updateAttributes({
|
||||
item: {
|
||||
...item,
|
||||
editing: false,
|
||||
},
|
||||
});
|
||||
} else {
|
||||
let index = 0;
|
||||
for (const el of editor.getJSON().content) {
|
||||
if (el.type === "codeBlock") {
|
||||
index += 2;
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
}
|
||||
editor
|
||||
.chain()
|
||||
.focus("end")
|
||||
.insertContent([
|
||||
{
|
||||
type: "slashcommand",
|
||||
attrs: { id: "/edit", label: "/edit" },
|
||||
},
|
||||
{ type: "text", text: " " },
|
||||
])
|
||||
.run();
|
||||
|
||||
updateAttributes({
|
||||
item: {
|
||||
...item,
|
||||
editing: true,
|
||||
},
|
||||
});
|
||||
|
||||
await new Promise((resolve) => setTimeout(resolve, 100));
|
||||
editor.commands.focus("end");
|
||||
}
|
||||
}}
|
||||
editing={item.id === contextItems[0]?.id}
|
||||
/>
|
||||
</NodeViewWrapper>
|
||||
);
|
||||
};
|
||||
|
|
@ -1,103 +1,8 @@
|
|||
import { mergeAttributes, Node } from "@tiptap/core";
|
||||
import { NodeViewWrapper, ReactNodeViewRenderer } from "@tiptap/react";
|
||||
import { ContextItemWithId } from "core";
|
||||
import { useDispatch, useSelector } from "react-redux";
|
||||
import { vscBadgeBackground } from "..";
|
||||
import { setEditingContextItemAtIndex } from "../../redux/slices/stateSlice";
|
||||
import { RootState } from "../../redux/store";
|
||||
import CodeSnippetPreview from "../markdown/CodeSnippetPreview";
|
||||
import { ReactNodeViewRenderer } from "@tiptap/react";
|
||||
import { CodeBlockComponent } from "./CodeBlockComponent";
|
||||
|
||||
const CodeBlockComponent = ({
|
||||
node,
|
||||
deleteNode,
|
||||
selected,
|
||||
editor,
|
||||
updateAttributes,
|
||||
}: any) => {
|
||||
const dispatch = useDispatch();
|
||||
const item: ContextItemWithId = node.attrs.item;
|
||||
|
||||
const contextItems = useSelector(
|
||||
(state: RootState) => state.state.contextItems,
|
||||
);
|
||||
return (
|
||||
<NodeViewWrapper className="code-block-with-content" as="p">
|
||||
<CodeSnippetPreview
|
||||
borderColor={
|
||||
item.id === contextItems[0]?.id
|
||||
? "#d0d"
|
||||
: selected
|
||||
? vscBadgeBackground
|
||||
: undefined
|
||||
}
|
||||
item={item}
|
||||
onDelete={() => {
|
||||
deleteNode();
|
||||
}}
|
||||
onEdit={async () => {
|
||||
dispatch(setEditingContextItemAtIndex({ item }));
|
||||
if (item.id === contextItems[0]?.id) {
|
||||
// Find and delete the /edit command
|
||||
let index = 0;
|
||||
for (const el of editor.getJSON().content) {
|
||||
if (el.type === "slashcommand") {
|
||||
if (el.attrs.id === "/edit") {
|
||||
editor
|
||||
.chain()
|
||||
.deleteRange({ from: index, to: index + 2 })
|
||||
.focus("end")
|
||||
.run();
|
||||
break;
|
||||
}
|
||||
}
|
||||
index += 1;
|
||||
}
|
||||
|
||||
updateAttributes({
|
||||
item: {
|
||||
...item,
|
||||
editing: false,
|
||||
},
|
||||
});
|
||||
} else {
|
||||
let index = 0;
|
||||
for (const el of editor.getJSON().content) {
|
||||
if (el.type === "codeBlock") {
|
||||
index += 2;
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
}
|
||||
editor
|
||||
.chain()
|
||||
.focus("end")
|
||||
.insertContent([
|
||||
{
|
||||
type: "slashcommand",
|
||||
attrs: { id: "/edit", label: "/edit" },
|
||||
},
|
||||
{ type: "text", text: " " },
|
||||
])
|
||||
.run();
|
||||
|
||||
updateAttributes({
|
||||
item: {
|
||||
...item,
|
||||
editing: true,
|
||||
},
|
||||
});
|
||||
|
||||
await new Promise((resolve) => setTimeout(resolve, 100));
|
||||
editor.commands.focus("end");
|
||||
}
|
||||
}}
|
||||
editing={item.id === contextItems[0]?.id}
|
||||
/>
|
||||
</NodeViewWrapper>
|
||||
);
|
||||
};
|
||||
|
||||
export default Node.create({
|
||||
export const CodeBlockExtension = Node.create({
|
||||
name: "codeBlock",
|
||||
|
||||
group: "block",
|
||||
|
|
|
|||
|
|
@ -202,7 +202,7 @@ function InputToolbar(props: InputToolbarProps) {
|
|||
}}
|
||||
className={"hover:underline cursor-pointer float-right"}
|
||||
>
|
||||
{getMetaKeyLabel()} ⏎ Use codebase
|
||||
{getMetaKeyLabel()} ⏎ Use @codebase
|
||||
</StyledSpan>
|
||||
)}
|
||||
<EnterButton
|
||||
|
|
|
|||
|
|
@ -47,7 +47,7 @@ import {
|
|||
isMetaEquivalentKeyPressed,
|
||||
isWebEnvironment,
|
||||
} from "../../util";
|
||||
import CodeBlockExtension from "./CodeBlockExtension";
|
||||
import { CodeBlockExtension } from "./CodeBlockExtension";
|
||||
import { SlashCommand } from "./CommandsExtension";
|
||||
import InputToolbar from "./InputToolbar";
|
||||
import { Mention } from "./MentionExtension";
|
||||
|
|
|
|||
|
|
@ -11,7 +11,8 @@ import { PackageDimension } from "../../pages/AddNewModel/configs/models";
|
|||
import { providers } from "../../pages/AddNewModel/configs/providers";
|
||||
import HeaderButtonWithText from "../HeaderButtonWithText";
|
||||
import InfoHover from "../InfoHover";
|
||||
import ModelProviderTag, { ModelProviderTags } from "./ModelProviderTag";
|
||||
import { ModelProviderTag } from "./ModelProviderTag";
|
||||
import { ModelProviderTags } from "./utils";
|
||||
|
||||
interface ModelCardProps {
|
||||
title: string;
|
||||
|
|
@ -42,11 +43,11 @@ const Div = styled.div<{ color: string; disabled: boolean; hovered: boolean }>`
|
|||
opacity: 0.5;
|
||||
`
|
||||
: props.hovered
|
||||
? `
|
||||
? `
|
||||
border: 1px solid ${props.color};
|
||||
background-color: ${props.color}22;
|
||||
cursor: pointer;`
|
||||
: ""}
|
||||
: ""}
|
||||
`;
|
||||
|
||||
const DimensionsDiv = styled.div`
|
||||
|
|
@ -147,7 +148,9 @@ function ModelCard(props: ModelCardProps) {
|
|||
<h3>{props.title}</h3>
|
||||
</div>
|
||||
|
||||
{props.tags?.map((tag, i) => <ModelProviderTag key={i} tag={tag} />)}
|
||||
{props.tags?.map((tag, i) => (
|
||||
<ModelProviderTag key={i} tag={tag} />
|
||||
))}
|
||||
|
||||
<p>{props.description}</p>
|
||||
|
||||
|
|
|
|||
|
|
@ -1,24 +1,11 @@
|
|||
import { defaultBorderRadius } from "..";
|
||||
|
||||
export enum ModelProviderTags {
|
||||
RequiresApiKey = "Requires API Key",
|
||||
Local = "Local",
|
||||
Free = "Free",
|
||||
OpenSource = "Open-Source",
|
||||
}
|
||||
import { MODEL_PROVIDER_TAG_COLORS, ModelProviderTags } from "./utils";
|
||||
|
||||
export interface ModelProviderTagProps {
|
||||
tag: ModelProviderTags;
|
||||
}
|
||||
|
||||
export const MODEL_PROVIDER_TAG_COLORS = {
|
||||
[ModelProviderTags.RequiresApiKey]: "#FF0000",
|
||||
[ModelProviderTags.Local]: "#00bb00",
|
||||
[ModelProviderTags.OpenSource]: "#0033FF",
|
||||
[ModelProviderTags.Free]: "#ffff00",
|
||||
};
|
||||
|
||||
export default function ModelProviderTag({ tag }: ModelProviderTagProps) {
|
||||
export function ModelProviderTag({ tag }: ModelProviderTagProps) {
|
||||
return (
|
||||
<span
|
||||
style={{
|
||||
|
|
|
|||
|
|
@ -194,7 +194,7 @@ function ModelOption({
|
|||
<CubeIcon className="w-4 h-4 mr-2 flex-shrink-0" />
|
||||
<span className="flex-grow">{option.title}</span>
|
||||
</div>
|
||||
<div className="flex items-center ml-2">
|
||||
<div className="flex items-center ml-5">
|
||||
<StyledCog6ToothIcon hovered={hovered} onClick={onClickGear} />
|
||||
{showDelete && (
|
||||
<StyledTrashIcon hovered={hovered} onClick={onClickDelete} />
|
||||
|
|
|
|||
|
|
@ -111,7 +111,7 @@ function ModelSelectionListbox({
|
|||
}: ModelSelectionListboxProps) {
|
||||
return (
|
||||
<StyledListbox value={selectedProvider} onChange={setSelectedProvider}>
|
||||
<div className="relative mt-1">
|
||||
<div className="relative mt-1 mb-2">
|
||||
<StyledListboxButton>
|
||||
<span className="flex items-center">
|
||||
{window.vscMediaUrl && selectedProvider.icon && (
|
||||
|
|
@ -160,7 +160,7 @@ function ModelSelectionListbox({
|
|||
<span className="text-md">{option.title}</span>
|
||||
|
||||
{selected ? (
|
||||
<span className="inset-y-0 ml-auto flex items-center pl-3 text-amber-600">
|
||||
<span className="inset-y-0 ml-auto flex items-center pl-3">
|
||||
<CheckIcon className="h-5 w-5" aria-hidden="true" />
|
||||
</span>
|
||||
) : null}
|
||||
|
|
|
|||
13
gui/src/components/modelSelection/utils.ts
Normal file
13
gui/src/components/modelSelection/utils.ts
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
export enum ModelProviderTags {
|
||||
RequiresApiKey = "Requires API Key",
|
||||
Local = "Local",
|
||||
Free = "Free",
|
||||
OpenSource = "Open-Source",
|
||||
}
|
||||
|
||||
export const MODEL_PROVIDER_TAG_COLORS = {
|
||||
[ModelProviderTags.RequiresApiKey]: "#FF0000",
|
||||
[ModelProviderTags.Local]: "#00bb00",
|
||||
[ModelProviderTags.OpenSource]: "#0033FF",
|
||||
[ModelProviderTags.Free]: "#ffff00",
|
||||
};
|
||||
|
|
@ -177,7 +177,9 @@ function AddModelForm({
|
|||
{selectedProvider.apiKeyUrl && (
|
||||
<div>
|
||||
<>
|
||||
<label className="block text-sm font-medium">API key</label>
|
||||
<label className="block text-sm font-medium mb-1">
|
||||
API key
|
||||
</label>
|
||||
<Input
|
||||
id="apiKey"
|
||||
className="w-full"
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@ import {
|
|||
} from "../../components";
|
||||
import StyledMarkdownPreview from "../../components/markdown/StyledMarkdownPreview";
|
||||
import ModelCard from "../../components/modelSelection/ModelCard";
|
||||
import ModelProviderTag from "../../components/modelSelection/ModelProviderTag";
|
||||
import { ModelProviderTag } from "../../components/modelSelection/ModelProviderTag";
|
||||
import { IdeMessengerContext } from "../../context/IdeMessenger";
|
||||
import { useNavigationListener } from "../../hooks/useNavigationListener";
|
||||
import { setDefaultModel } from "../../redux/slices/stateSlice";
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
import { ILLM, ModelProvider } from "core";
|
||||
import { ModelProviderTags } from "../../../components/modelSelection/ModelProviderTag";
|
||||
import { InputDescriptor } from "./providers";
|
||||
import { ModelProviderTags } from "../../../components/modelSelection/utils";
|
||||
|
||||
// A dimension is like parameter count - 7b, 13b, 34b, etc.
|
||||
// You would set options to the field that should be changed for that option in the params field of ModelPackage
|
||||
|
|
|
|||
|
|
@ -1,10 +1,10 @@
|
|||
import { ModelProvider } from "core";
|
||||
import { HTMLInputTypeAttribute } from "react";
|
||||
import { ModelProviderTags } from "../../../components/modelSelection/ModelProviderTag";
|
||||
import { FREE_TRIAL_LIMIT_REQUESTS } from "../../../util/freeTrial";
|
||||
import { completionParamsInputs } from "./completionParamsInputs";
|
||||
import type { ModelPackage } from "./models";
|
||||
import { models } from "./models";
|
||||
import { ModelProviderTags } from "../../../components/modelSelection/utils";
|
||||
|
||||
export interface InputDescriptor {
|
||||
inputType: HTMLInputTypeAttribute;
|
||||
|
|
@ -517,8 +517,9 @@ To get started, [register](https://dataplatform.cloud.ibm.com/registration/stepo
|
|||
inputType: "text",
|
||||
key: "watsonxFullUrl",
|
||||
label: "Full watsonx URL",
|
||||
placeholder: "http://us-south.dataplatform.cloud.ibm.com/m1/v1/text/generation_stream?version=2023-05-29",
|
||||
required: false
|
||||
placeholder:
|
||||
"http://us-south.dataplatform.cloud.ibm.com/m1/v1/text/generation_stream?version=2023-05-29",
|
||||
required: false,
|
||||
},
|
||||
// {
|
||||
// inputType: "text",
|
||||
|
|
@ -584,8 +585,7 @@ To get started, [register](https://dataplatform.cloud.ibm.com/registration/stepo
|
|||
title: "SambaNova Cloud",
|
||||
provider: "sambanova",
|
||||
refPage: "sambanova",
|
||||
description:
|
||||
"Use SambaNova Cloud for Llama3.1 fast inference performance",
|
||||
description: "Use SambaNova Cloud for Llama3.1 fast inference performance",
|
||||
icon: "sambanova.png",
|
||||
longDescription: `The SambaNova Cloud is a cloud platform for running large AI models with the world record Llama 3.1 70B/405B performance. You can sign up [here](https://cloud.sambanova.ai/)`,
|
||||
tags: [ModelProviderTags.RequiresApiKey, ModelProviderTags.OpenSource],
|
||||
|
|
@ -602,9 +602,7 @@ To get started, [register](https://dataplatform.cloud.ibm.com/registration/stepo
|
|||
},
|
||||
...completionParamsInputsConfigs,
|
||||
],
|
||||
packages: [
|
||||
models.llama31Chat,
|
||||
].map((p) => {
|
||||
packages: [models.llama31Chat].map((p) => {
|
||||
p.params.contextLength = 4096;
|
||||
return p;
|
||||
}),
|
||||
|
|
|
|||
|
|
@ -31,7 +31,8 @@ import TimelineItem from "../components/gui/TimelineItem";
|
|||
import ContinueInputBox from "../components/mainInput/ContinueInputBox";
|
||||
import { defaultInputModifiers } from "../components/mainInput/inputModifiers";
|
||||
import { TutorialCard } from "../components/mainInput/TutorialCard";
|
||||
import OnboardingCard, {
|
||||
import {
|
||||
OnboardingCard,
|
||||
useOnboardingCard,
|
||||
} from "../components/OnboardingCard";
|
||||
import { IdeMessengerContext } from "../context/IdeMessenger";
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue