Dallin's feedback
This commit is contained in:
parent
daff4ccd4f
commit
206fbbee8c
7 changed files with 89 additions and 92 deletions
|
|
@ -5,7 +5,6 @@ import { SubmenuContextProvidersProvider } from "./context/SubmenuContextProvide
|
|||
import { VscThemeProvider } from "./context/VscTheme";
|
||||
import useSetup from "./hooks/useSetup";
|
||||
import ConfigPage from "./pages/config";
|
||||
import ConfigErrorPage from "./pages/config-error";
|
||||
import ErrorPage from "./pages/error";
|
||||
import Chat from "./pages/gui";
|
||||
import History from "./pages/history";
|
||||
|
|
@ -34,10 +33,6 @@ const router = createMemoryRouter([
|
|||
path: "/stats",
|
||||
element: <Stats />,
|
||||
},
|
||||
{
|
||||
path: ROUTES.CONFIG_ERROR,
|
||||
element: <ConfigErrorPage />,
|
||||
},
|
||||
{
|
||||
path: ROUTES.CONFIG,
|
||||
element: <ConfigPage />,
|
||||
|
|
|
|||
|
|
@ -4,12 +4,13 @@ import {
|
|||
ChevronLeftIcon,
|
||||
CubeIcon,
|
||||
EllipsisHorizontalIcon,
|
||||
ExclamationTriangleIcon,
|
||||
PencilIcon,
|
||||
Squares2X2Icon,
|
||||
WrenchScrewdriverIcon,
|
||||
} from "@heroicons/react/24/outline";
|
||||
import { vscBadgeBackground, vscBadgeForeground } from "../..";
|
||||
import ConfigErrorIndicator from "../../../pages/gui/ConfigError";
|
||||
import { vscBadgeForeground } from "../..";
|
||||
import { useAppSelector } from "../../../redux/hooks";
|
||||
import { fontSize } from "../../../util";
|
||||
import AssistantSelect from "../../modelSelection/platform/AssistantSelect";
|
||||
import HoverItem from "../InputToolbar/HoverItem";
|
||||
|
|
@ -37,9 +38,14 @@ const sections: Section[] = [
|
|||
{ id: "prompts", tooltip: "Prompts", icon: ChatBubbleLeftIcon },
|
||||
{ id: "tools", tooltip: "Tools", icon: WrenchScrewdriverIcon },
|
||||
{ id: "mcp", tooltip: "MCP", icon: Squares2X2Icon },
|
||||
{ id: "error", tooltip: "Errors", icon: ExclamationTriangleIcon },
|
||||
];
|
||||
|
||||
function BlockSettingsToolbarIcon(props: BlockSettingsToolbarIcon) {
|
||||
function BlockSettingsToolbarIcon(
|
||||
props: BlockSettingsToolbarIcon & { sectionId?: string },
|
||||
) {
|
||||
const isErrorSection = props.sectionId === "error";
|
||||
|
||||
return (
|
||||
<HoverItem px={0} onClick={props.onClick}>
|
||||
<div
|
||||
|
|
@ -51,13 +57,18 @@ function BlockSettingsToolbarIcon(props: BlockSettingsToolbarIcon) {
|
|||
props.onClick();
|
||||
}
|
||||
}}
|
||||
style={{
|
||||
backgroundColor: props.isSelected ? vscBadgeBackground : undefined,
|
||||
}}
|
||||
className={`relative flex select-none items-center rounded-full px-1 transition-all duration-200 focus:outline-none focus-visible:ring-2 focus-visible:ring-blue-500/50 ${props.className || ""}`}
|
||||
className={`${
|
||||
props.isSelected
|
||||
? isErrorSection
|
||||
? "bg-red-600"
|
||||
: "bg-badge"
|
||||
: undefined
|
||||
} relative flex select-none items-center rounded-full px-1 transition-all duration-200 focus:outline-none focus-visible:ring-2 focus-visible:ring-blue-500/50 ${props.className || ""}`}
|
||||
>
|
||||
<props.icon
|
||||
className="h-[13px] w-[13px] flex-shrink-0 hover:brightness-125"
|
||||
className={`h-[13px] w-[13px] flex-shrink-0 hover:brightness-125 ${
|
||||
isErrorSection ? "text-red-600" : ""
|
||||
}`}
|
||||
style={{
|
||||
color: props.isSelected ? vscBadgeForeground : undefined,
|
||||
}}
|
||||
|
|
@ -89,6 +100,8 @@ export function BlockSettingsTopToolbar() {
|
|||
setSelectedSection,
|
||||
} = useLump();
|
||||
|
||||
const configError = useAppSelector((store) => store.config.configError);
|
||||
|
||||
const handleEllipsisClick = () => {
|
||||
if (isToolbarExpanded) {
|
||||
setSelectedSection(null);
|
||||
|
|
@ -96,6 +109,12 @@ export function BlockSettingsTopToolbar() {
|
|||
toggleToolbar();
|
||||
};
|
||||
|
||||
const visibleSections = sections.filter(
|
||||
(section) =>
|
||||
section.id !== "error" ||
|
||||
(section.id === "error" && configError && configError?.length > 0),
|
||||
);
|
||||
|
||||
return (
|
||||
<div className="flex w-full items-center justify-between">
|
||||
<div className="flex flex-row">
|
||||
|
|
@ -110,13 +129,13 @@ export function BlockSettingsTopToolbar() {
|
|||
onClick={handleEllipsisClick}
|
||||
/>
|
||||
<div
|
||||
className="flex overflow-hidden transition-all duration-200"
|
||||
style={{ width: isToolbarExpanded ? `160px` : "0px" }}
|
||||
className={`${isToolbarExpanded ? "w-min" : "w-0"} flex overflow-hidden transition-all duration-200`}
|
||||
>
|
||||
<div className="flex">
|
||||
{sections.map((section) => (
|
||||
{visibleSections.map((section) => (
|
||||
<BlockSettingsToolbarIcon
|
||||
key={section.id}
|
||||
sectionId={section.id}
|
||||
icon={section.icon}
|
||||
tooltip={section.tooltip}
|
||||
isSelected={selectedSection === section.id}
|
||||
|
|
@ -133,7 +152,6 @@ export function BlockSettingsTopToolbar() {
|
|||
</div>
|
||||
<div className="flex gap-0.5">
|
||||
<AssistantSelect />
|
||||
<ConfigErrorIndicator />
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
|
|
|
|||
54
gui/src/components/mainInput/Lump/sections/ErrorSection.tsx
Normal file
54
gui/src/components/mainInput/Lump/sections/ErrorSection.tsx
Normal file
|
|
@ -0,0 +1,54 @@
|
|||
import {
|
||||
ExclamationCircleIcon,
|
||||
ExclamationTriangleIcon,
|
||||
} from "@heroicons/react/24/outline";
|
||||
import { useAppSelector } from "../../../../redux/hooks";
|
||||
|
||||
export function ErrorSection() {
|
||||
const configError = useAppSelector((state) => state.config.configError);
|
||||
|
||||
const sortedErrors = configError
|
||||
? [...configError].sort((a, b) => (b.fatal ? 1 : 0) - (a.fatal ? 1 : 0))
|
||||
: [];
|
||||
|
||||
return (
|
||||
<div className="gap-2 divide-x-0 divide-y-2 divide-solid divide-zinc-700 px-4">
|
||||
<div className="py-5">
|
||||
<h3 className="mb-2 mt-0 font-semibold">Config Errors</h3>
|
||||
<p className="text-md mb-4">
|
||||
Please resolve the following errors in your assistant configuration.
|
||||
</p>
|
||||
<div className="flex flex-col gap-5">
|
||||
{sortedErrors.length > 0 ? (
|
||||
<ul className="m-0 list-none space-y-4 p-0">
|
||||
{sortedErrors.map((error, index) => (
|
||||
<li
|
||||
key={index}
|
||||
className={`flex items-start rounded-md p-2 text-sm shadow-md ${
|
||||
error.fatal
|
||||
? "bg-red-100 text-red-800"
|
||||
: "bg-yellow-100 text-yellow-800"
|
||||
}`}
|
||||
>
|
||||
{error.fatal ? (
|
||||
<ExclamationCircleIcon className="mr-2 h-5 w-5" />
|
||||
) : (
|
||||
<ExclamationTriangleIcon className="mr-2 h-5 w-5" />
|
||||
)}
|
||||
<p className="m-0 whitespace-pre-wrap">
|
||||
<strong>{error.fatal ? "Fatal Error:" : "Warning:"}</strong>{" "}
|
||||
{error.message}
|
||||
</p>
|
||||
</li>
|
||||
))}
|
||||
</ul>
|
||||
) : (
|
||||
<p className="rounded-md bg-green-100 p-4 text-sm text-green-700">
|
||||
No configuration errors found.
|
||||
</p>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
|
@ -1,6 +1,7 @@
|
|||
import { useLump } from "../LumpContext";
|
||||
import { ContextSection } from "./ContextSection";
|
||||
import DocsSection from "./docs/DocsSection";
|
||||
import { ErrorSection } from "./ErrorSection";
|
||||
import { MCPSection } from "./MCPSection";
|
||||
import { ModelsSection } from "./ModelsSection";
|
||||
import { PromptsSection } from "./PromptsSection";
|
||||
|
|
@ -28,6 +29,8 @@ export function SelectedSection() {
|
|||
return <ToolPoliciesSection />;
|
||||
case "mcp":
|
||||
return <MCPSection />;
|
||||
case "error":
|
||||
return <ErrorSection />;
|
||||
default:
|
||||
return null;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,74 +0,0 @@
|
|||
import {
|
||||
ArrowLeftIcon,
|
||||
ExclamationCircleIcon,
|
||||
ExclamationTriangleIcon,
|
||||
} from "@heroicons/react/24/outline";
|
||||
import { useNavigate } from "react-router-dom";
|
||||
import { vscBackground } from "../../components";
|
||||
import { useAppSelector } from "../../redux/hooks";
|
||||
import { ROUTES } from "../../util/navigation";
|
||||
|
||||
export default function ConfigErrorPage() {
|
||||
const navigate = useNavigate();
|
||||
const configError = useAppSelector((state) => state.config.configError);
|
||||
|
||||
const sortedErrors = configError
|
||||
? [...configError].sort((a, b) => (b.fatal ? 1 : 0) - (a.fatal ? 1 : 0))
|
||||
: [];
|
||||
|
||||
return (
|
||||
<div className="overflow-y-scroll">
|
||||
<div
|
||||
onClick={() => navigate(ROUTES.HOME)}
|
||||
className="sticky top-0 m-0 flex cursor-pointer items-center border-0 border-b border-solid border-b-zinc-700 bg-inherit p-0"
|
||||
style={{
|
||||
backgroundColor: vscBackground,
|
||||
}}
|
||||
>
|
||||
<ArrowLeftIcon className="ml-3 inline-block h-3 w-3 cursor-pointer" />
|
||||
<span className="m-2 inline-block text-sm font-bold">Chat</span>
|
||||
</div>
|
||||
|
||||
<div className="gap-2 divide-x-0 divide-y-2 divide-solid divide-zinc-700 px-4">
|
||||
<div className="py-5">
|
||||
<h3 className="mb-2 mt-0 text-xl">Config Errors</h3>
|
||||
<p className="text-md mb-4">
|
||||
Please resolve the following errors in your assistant configuration.
|
||||
</p>
|
||||
<div className="flex flex-col gap-5">
|
||||
{sortedErrors.length > 0 ? (
|
||||
<ul className="m-0 list-none space-y-4 p-0">
|
||||
{sortedErrors.map((error, index) => (
|
||||
<li
|
||||
key={index}
|
||||
className={`flex items-start rounded-md p-2 text-sm shadow-md ${
|
||||
error.fatal
|
||||
? "bg-red-100 text-red-800"
|
||||
: "bg-yellow-100 text-yellow-800"
|
||||
}`}
|
||||
>
|
||||
{error.fatal ? (
|
||||
<ExclamationCircleIcon className="mr-2 h-5 w-5" />
|
||||
) : (
|
||||
<ExclamationTriangleIcon className="mr-2 h-5 w-5" />
|
||||
)}
|
||||
<p className="m-0 whitespace-pre-wrap">
|
||||
<strong>
|
||||
{error.fatal ? "Fatal Error:" : "Warning:"}
|
||||
</strong>{" "}
|
||||
{error.message}
|
||||
</p>
|
||||
</li>
|
||||
))}
|
||||
</ul>
|
||||
) : (
|
||||
<p className="rounded-md bg-green-100 p-4 text-sm text-green-700">
|
||||
No configuration errors found.
|
||||
</p>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
|
@ -25,7 +25,7 @@ const ConfigErrorIndicator = () => {
|
|||
text="Config error"
|
||||
onClick={onClickError}
|
||||
>
|
||||
<ExclamationTriangleIcon className="h-3.5 w-3.5 text-red-600" />
|
||||
<ExclamationTriangleIcon className="h-[13px] w-[13px] flex-shrink-0 text-red-600 hover:brightness-125" />
|
||||
</HeaderButtonWithToolTip>
|
||||
);
|
||||
};
|
||||
|
|
|
|||
|
|
@ -43,6 +43,7 @@ module.exports = {
|
|||
"list-active": "var(--vscode-list-activeSelectionBackground, #1bbe84)",
|
||||
"list-active-foreground":
|
||||
"var(--vscode-quickInputList-focusForeground, var(--vscode-editor-foreground))",
|
||||
badge: "var(--vscode-badge-background, #1bbe84)",
|
||||
},
|
||||
},
|
||||
},
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue