mirror of
https://github.com/danny-avila/LibreChat.git
synced 2025-12-19 09:50:15 +01:00
refactor: remove artifacts toggle
This commit is contained in:
parent
46f034250d
commit
f884c2cfcd
5 changed files with 9 additions and 36 deletions
|
|
@ -23,7 +23,6 @@ export default function Presentation({
|
||||||
}) {
|
}) {
|
||||||
const { data: startupConfig } = useGetStartupConfig();
|
const { data: startupConfig } = useGetStartupConfig();
|
||||||
const artifacts = useRecoilValue(store.artifactsState);
|
const artifacts = useRecoilValue(store.artifactsState);
|
||||||
const codeArtifacts = useRecoilValue(store.codeArtifacts);
|
|
||||||
const hideSidePanel = useRecoilValue(store.hideSidePanel);
|
const hideSidePanel = useRecoilValue(store.hideSidePanel);
|
||||||
const artifactsVisible = useRecoilValue(store.artifactsVisible);
|
const artifactsVisible = useRecoilValue(store.artifactsVisible);
|
||||||
|
|
||||||
|
|
@ -91,13 +90,11 @@ export default function Presentation({
|
||||||
defaultCollapsed={defaultCollapsed}
|
defaultCollapsed={defaultCollapsed}
|
||||||
fullPanelCollapse={fullCollapse}
|
fullPanelCollapse={fullCollapse}
|
||||||
artifacts={
|
artifacts={
|
||||||
artifactsVisible === true &&
|
artifactsVisible === true && Object.keys(artifacts ?? {}).length > 0 ? (
|
||||||
codeArtifacts === true &&
|
<EditorProvider>
|
||||||
Object.keys(artifacts ?? {}).length > 0 ? (
|
<Artifacts />
|
||||||
<EditorProvider>
|
</EditorProvider>
|
||||||
<Artifacts />
|
) : null
|
||||||
</EditorProvider>
|
|
||||||
) : null
|
|
||||||
}
|
}
|
||||||
>
|
>
|
||||||
<main className="flex h-full flex-col overflow-y-auto" role="main">
|
<main className="flex h-full flex-col overflow-y-auto" role="main">
|
||||||
|
|
|
||||||
|
|
@ -5,18 +5,9 @@ import { useLocalize } from '~/hooks';
|
||||||
import store from '~/store';
|
import store from '~/store';
|
||||||
|
|
||||||
export default function CodeArtifacts() {
|
export default function CodeArtifacts() {
|
||||||
const [codeArtifacts, setCodeArtifacts] = useRecoilState<boolean>(store.codeArtifacts);
|
const localize = useLocalize();
|
||||||
const [includeShadcnui, setIncludeShadcnui] = useRecoilState<boolean>(store.includeShadcnui);
|
const [includeShadcnui, setIncludeShadcnui] = useRecoilState<boolean>(store.includeShadcnui);
|
||||||
const [customPromptMode, setCustomPromptMode] = useRecoilState<boolean>(store.customPromptMode);
|
const [customPromptMode, setCustomPromptMode] = useRecoilState<boolean>(store.customPromptMode);
|
||||||
const localize = useLocalize();
|
|
||||||
|
|
||||||
const handleCodeArtifactsChange = (value: boolean) => {
|
|
||||||
setCodeArtifacts(value);
|
|
||||||
if (!value) {
|
|
||||||
setIncludeShadcnui(false);
|
|
||||||
setCustomPromptMode(false);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
const handleIncludeShadcnuiChange = (value: boolean) => {
|
const handleIncludeShadcnuiChange = (value: boolean) => {
|
||||||
setIncludeShadcnui(value);
|
setIncludeShadcnui(value);
|
||||||
|
|
@ -33,20 +24,13 @@ export default function CodeArtifacts() {
|
||||||
<div className="space-y-4">
|
<div className="space-y-4">
|
||||||
<h3 className="text-lg font-medium">{localize('com_ui_artifacts')}</h3>
|
<h3 className="text-lg font-medium">{localize('com_ui_artifacts')}</h3>
|
||||||
<div className="space-y-2">
|
<div className="space-y-2">
|
||||||
<SwitchItem
|
|
||||||
id="codeArtifacts"
|
|
||||||
label={localize('com_ui_artifacts_toggle')}
|
|
||||||
checked={codeArtifacts}
|
|
||||||
onCheckedChange={handleCodeArtifactsChange}
|
|
||||||
hoverCardText="com_nav_info_code_artifacts"
|
|
||||||
/>
|
|
||||||
<SwitchItem
|
<SwitchItem
|
||||||
id="includeShadcnui"
|
id="includeShadcnui"
|
||||||
label={localize('com_ui_include_shadcnui')}
|
label={localize('com_ui_include_shadcnui')}
|
||||||
checked={includeShadcnui}
|
checked={includeShadcnui}
|
||||||
onCheckedChange={handleIncludeShadcnuiChange}
|
onCheckedChange={handleIncludeShadcnuiChange}
|
||||||
hoverCardText="com_nav_info_include_shadcnui"
|
hoverCardText="com_nav_info_include_shadcnui"
|
||||||
disabled={!codeArtifacts || customPromptMode}
|
disabled={customPromptMode}
|
||||||
/>
|
/>
|
||||||
<SwitchItem
|
<SwitchItem
|
||||||
id="customPromptMode"
|
id="customPromptMode"
|
||||||
|
|
@ -54,7 +38,6 @@ export default function CodeArtifacts() {
|
||||||
checked={customPromptMode}
|
checked={customPromptMode}
|
||||||
onCheckedChange={handleCustomPromptModeChange}
|
onCheckedChange={handleCustomPromptModeChange}
|
||||||
hoverCardText="com_nav_info_custom_prompt_mode"
|
hoverCardText="com_nav_info_custom_prompt_mode"
|
||||||
disabled={!codeArtifacts}
|
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
|
|
@ -64,7 +64,6 @@ export default function useChatFunctions({
|
||||||
setSubmission: SetterOrUpdater<TSubmission | null>;
|
setSubmission: SetterOrUpdater<TSubmission | null>;
|
||||||
setLatestMessage?: SetterOrUpdater<TMessage | null>;
|
setLatestMessage?: SetterOrUpdater<TMessage | null>;
|
||||||
}) {
|
}) {
|
||||||
const codeArtifacts = useRecoilValue(store.codeArtifacts);
|
|
||||||
const includeShadcnui = useRecoilValue(store.includeShadcnui);
|
const includeShadcnui = useRecoilValue(store.includeShadcnui);
|
||||||
const customPromptMode = useRecoilValue(store.customPromptMode);
|
const customPromptMode = useRecoilValue(store.customPromptMode);
|
||||||
const resetLatestMultiMessage = useResetRecoilState(store.latestMessageFamily(index + 1));
|
const resetLatestMultiMessage = useResetRecoilState(store.latestMessageFamily(index + 1));
|
||||||
|
|
@ -170,7 +169,7 @@ export default function useChatFunctions({
|
||||||
endpointType,
|
endpointType,
|
||||||
overrideConvoId,
|
overrideConvoId,
|
||||||
overrideUserMessageId,
|
overrideUserMessageId,
|
||||||
artifacts: getArtifactsMode({ codeArtifacts, includeShadcnui, customPromptMode }),
|
artifacts: getArtifactsMode({ includeShadcnui, customPromptMode }),
|
||||||
},
|
},
|
||||||
convo,
|
convo,
|
||||||
) as TEndpointOption;
|
) as TEndpointOption;
|
||||||
|
|
@ -228,7 +227,6 @@ export default function useChatFunctions({
|
||||||
conversationId,
|
conversationId,
|
||||||
unfinished: false,
|
unfinished: false,
|
||||||
isCreatedByUser: false,
|
isCreatedByUser: false,
|
||||||
isEdited: isEditOrContinue,
|
|
||||||
iconURL: convo?.iconURL,
|
iconURL: convo?.iconURL,
|
||||||
model: convo?.model,
|
model: convo?.model,
|
||||||
error: false,
|
error: false,
|
||||||
|
|
|
||||||
|
|
@ -42,7 +42,6 @@ const localStorageAtoms = {
|
||||||
// Beta features settings
|
// Beta features settings
|
||||||
modularChat: atomWithLocalStorage('modularChat', true),
|
modularChat: atomWithLocalStorage('modularChat', true),
|
||||||
LaTeXParsing: atomWithLocalStorage('LaTeXParsing', true),
|
LaTeXParsing: atomWithLocalStorage('LaTeXParsing', true),
|
||||||
codeArtifacts: atomWithLocalStorage('codeArtifacts', false),
|
|
||||||
includeShadcnui: atomWithLocalStorage('includeShadcnui', false),
|
includeShadcnui: atomWithLocalStorage('includeShadcnui', false),
|
||||||
customPromptMode: atomWithLocalStorage('customPromptMode', false),
|
customPromptMode: atomWithLocalStorage('customPromptMode', false),
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -6,17 +6,13 @@ import type {
|
||||||
} from '@codesandbox/sandpack-react';
|
} from '@codesandbox/sandpack-react';
|
||||||
|
|
||||||
export const getArtifactsMode = ({
|
export const getArtifactsMode = ({
|
||||||
codeArtifacts,
|
|
||||||
includeShadcnui,
|
includeShadcnui,
|
||||||
customPromptMode,
|
customPromptMode,
|
||||||
}: {
|
}: {
|
||||||
codeArtifacts: boolean;
|
|
||||||
includeShadcnui: boolean;
|
includeShadcnui: boolean;
|
||||||
customPromptMode: boolean;
|
customPromptMode: boolean;
|
||||||
}): ArtifactModes | undefined => {
|
}): ArtifactModes | undefined => {
|
||||||
if (!codeArtifacts) {
|
if (customPromptMode) {
|
||||||
return undefined;
|
|
||||||
} else if (customPromptMode) {
|
|
||||||
return ArtifactModes.CUSTOM;
|
return ArtifactModes.CUSTOM;
|
||||||
} else if (includeShadcnui) {
|
} else if (includeShadcnui) {
|
||||||
return ArtifactModes.SHADCNUI;
|
return ArtifactModes.SHADCNUI;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue