mirror of
https://github.com/danny-avila/LibreChat.git
synced 2026-01-13 22:18:51 +01:00
* fix: Reset artifacts on unmount and remove useIdChangeEffect hook * feat: Replace SVG icons with Lucide icons for improved consistency * fix: Refactor artifact reset logic on unmount and conversation change * refactor: Rename artifactsVisible to artifactsVisibility for consistency * feat: Replace custom SVG icons with Lucide icons for improved consistency * feat: Add visibleArtifacts atom for managing visibility state * feat: Implement debounced visibility state management for artifacts * refactor: Add useIdChangeEffect hook to reset visible artifacts on conversation ID change * refactor: Remove unnecessary dependency from useMemo in TextPart component * refactor: Enhance artifact visibility management by incorporating location checks for search path * refactor: Improve transition effects for artifact visibility in Artifacts component * chore: Remove preprocessCodeArtifacts function and related tests * fix: Update regex for detecting enclosed artifacts in latest message * refactor: Update artifact visibility checks to be more generic (not just search) * chore: Enhance artifact visibility logging * refactor: Extract closeArtifacts function to improve button click handling * refactor: remove nested logic from use artifacts effect * refactor: Update regex for detecting enclosed artifacts to handle new line variations
63 lines
1.5 KiB
TypeScript
63 lines
1.5 KiB
TypeScript
import { atom } from 'recoil';
|
|
import { logger } from '~/utils';
|
|
import type { Artifact } from '~/common';
|
|
|
|
export const artifactsState = atom<Record<string, Artifact | undefined> | null>({
|
|
key: 'artifactsState',
|
|
default: null,
|
|
effects: [
|
|
({ onSet, node }) => {
|
|
onSet(async (newValue) => {
|
|
logger.log('artifacts', 'Recoil Effect: Setting artifactsState', {
|
|
key: node.key,
|
|
newValue,
|
|
});
|
|
});
|
|
},
|
|
] as const,
|
|
});
|
|
|
|
export const currentArtifactId = atom<string | null>({
|
|
key: 'currentArtifactId',
|
|
default: null,
|
|
effects: [
|
|
({ onSet, node }) => {
|
|
onSet(async (newValue) => {
|
|
logger.log('artifacts', 'Recoil Effect: Setting currentArtifactId', {
|
|
key: node.key,
|
|
newValue,
|
|
});
|
|
});
|
|
},
|
|
] as const,
|
|
});
|
|
|
|
export const artifactsVisibility = atom<boolean>({
|
|
key: 'artifactsVisibility',
|
|
default: true,
|
|
effects: [
|
|
({ onSet, node }) => {
|
|
onSet(async (newValue) => {
|
|
logger.log('artifacts', 'Recoil Effect: Setting artifactsVisibility', {
|
|
key: node.key,
|
|
newValue,
|
|
});
|
|
});
|
|
},
|
|
] as const,
|
|
});
|
|
|
|
export const visibleArtifacts = atom<Record<string, Artifact | undefined> | null>({
|
|
key: 'visibleArtifacts',
|
|
default: null,
|
|
effects: [
|
|
({ onSet, node }) => {
|
|
onSet(async (newValue) => {
|
|
logger.log('artifacts', 'Recoil Effect: Setting `visibleArtifacts`', {
|
|
key: node.key,
|
|
newValue,
|
|
});
|
|
});
|
|
},
|
|
] as const,
|
|
});
|