Enhanced ChatGPT Clone: Features Agents, MCP, Skills, DeepSeek, Anthropic, AWS, OpenAI, Responses API, Azure, Groq, o1, GPT-5, Mistral, OpenRouter, Vertex AI, Gemini, Artifacts, AI model switching, message search, Code Interpreter, langchain, DALL-E-3, OpenAPI Actions, Functions, Secure Multi-User Auth, Presets, open-source for self-hosting. Active
TypeScript aianthropicartifactsawsazurechatgptchatgpt-cloneclaudeclonedeepseekgeminigooglegpt-5librechatmcpo1openairesponses-apivisionwebui
import { atom } from 'jotai';
export interface UndockedArtifactsTarget {
/** The popup hosting the pane. */
window: Window;
/** Its portal container, prepared before the pane is handed over. */
root: HTMLElement;
}
/**
* Where the artifacts pane currently lives, or `null` while it is docked in
* the side panel.
*
* The prepared container travels with the window so the host can portal into
* it on its first render: the pane's Recoil-backed registry only survives the
* move if the new instance mounts in the same commit the docked one unmounts.
* Clearing this atom is the single instruction to come home.
*/
export const undockedArtifacts = atom<UndockedArtifactsTarget | null>(null);
export const artifactsUndocked = atom((get) => get(undockedArtifacts) != null);
/**
* Which tab the pane is showing. The pane is a new instance in every host, so
* a user who undocks while reading code has to arrive in the window on the
* code tab — with the text they were typing — rather than back on the preview.
*/
export const artifactsActiveTab = atom<string>('preview');
/**
* The artifact the pane last opened, which is what makes the tab reset above
* mean "a different artifact" rather than "a new pane instance". Changing host
* remounts the pane, so an instance-local ref would read the artifact already
* on screen as freshly opened and send the user back to the preview — losing
* the tab this atom exists to carry.
*/
export const artifactsOpenedArtifactId = atom<string | null>(null);
/**
* Set when the user moves the pane from its own toolbar, either way. That
* button goes away with the toolbar it lived in, so the pane that takes over
* has to pick focus up again — a keyboard user would otherwise land on the
* document of whichever window they were sent to.
*/
export const artifactsPaneFocusRequest = atom(false);