How applelamps/gpt works
Project Type & Purpose
• This is a browser‑only, single‑page application (SPA) frontend that mimics ChatGPT’s UI and connects directly to OpenAI APIs (gpt‑4o, o3‑mini, DALL·E 3, TTS).
• Purpose: Provide chat functionality, file‐based “knowledge” injection, Custom GPT management, TTS playback, and image generation—all with local persistence in localStorage.
File Structure Analysis
Top‑level:
• index.html – the shell that loads ES modules
• css/ – base.css, components.css, layout.css, styles.css
• js/ – main modules (api.js, state.js, parser.js, utils.js, chatStore.js), an events.js bus, UI components directory, customGpt directory
• template_custom_gpt.json – JSON schema for Custom GPT configs
• script.js/styles.css at root—for backward compatibility or loader scripts
js/components: header, sidebar, chatInput, messageList, notification, settingsModal, welcomeScreen
js/customGpt: creatorScreen, customGptManager (gptStore.js), knowledgeHandler
README Insights
• Dual‑API routing based on “effective” model
• Streaming support, markdown rendering via marked.js
• PDF text extraction via pdf.js
• localStorage‐backed persistence for chats and Custom GPT configs
• UI state (toggles, image‑gen mode, file attachments) is centralized in state.js