mirror of
https://github.com/danny-avila/LibreChat.git
synced 2026-02-18 16:38:10 +01:00
49 lines
1.1 KiB
TypeScript
49 lines
1.1 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 artifactsVisible = atom<boolean>({
|
||
|
|
key: 'artifactsVisible',
|
||
|
|
default: true,
|
||
|
|
effects: [
|
||
|
|
({ onSet, node }) => {
|
||
|
|
onSet(async (newValue) => {
|
||
|
|
logger.log('artifacts', 'Recoil Effect: Setting artifactsVisible', {
|
||
|
|
key: node.key,
|
||
|
|
newValue,
|
||
|
|
});
|
||
|
|
});
|
||
|
|
},
|
||
|
|
] as const,
|
||
|
|
});
|