()
| 2199 | const formatBytes = (b: number) => b < 1024 ? `${b} B` : b < 1048576 ? `${(b / 1024).toFixed(1)} KB` : `${(b / 1048576).toFixed(1)} MB` |
| 2200 | |
| 2201 | const handleExport = () => { |
| 2202 | // Export everything persisted to localStorage — full self-custody backup. |
| 2203 | // STM modules excluded: transformer functions can't be serialized to JSON. |
| 2204 | // STM enabled/disabled state is restored from defaults on import. |
| 2205 | const exportData = { |
| 2206 | _version: 1, |
| 2207 | _exportedAt: new Date().toISOString(), |
| 2208 | _source: 'g0dm0d3', |
| 2209 | // Conversations (chat history) |
| 2210 | conversations: store.conversations, |
| 2211 | currentConversationId: store.currentConversationId, |
| 2212 | // Settings |
| 2213 | theme: store.theme, |
| 2214 | defaultModel: store.defaultModel, |
| 2215 | currentPersona: store.currentPersona, |
| 2216 | apiKey: store.apiKey, |
| 2217 | // Features |
| 2218 | autoTuneEnabled: store.autoTuneEnabled, |
| 2219 | autoTuneStrategy: store.autoTuneStrategy, |
| 2220 | autoTuneOverrides: store.autoTuneOverrides, |
| 2221 | feedbackState: store.feedbackState, |
| 2222 | parseltongueConfig: store.parseltongueConfig, |
| 2223 | // Memory system |
| 2224 | memories: store.memories, |
| 2225 | memoriesEnabled: store.memoriesEnabled, |
| 2226 | // System prompt |
| 2227 | customSystemPrompt: store.customSystemPrompt, |
| 2228 | useCustomSystemPrompt: store.useCustomSystemPrompt, |
| 2229 | // Mode config |
| 2230 | consortiumEnabled: store.consortiumEnabled, |
| 2231 | consortiumTier: store.consortiumTier, |
| 2232 | liquidResponseEnabled: store.liquidResponseEnabled, |
| 2233 | liquidMinDelta: store.liquidMinDelta, |
| 2234 | ultraplinianEnabled: store.ultraplinianEnabled, |
| 2235 | ultraplinianTier: store.ultraplinianTier, |
| 2236 | ultraplinianApiUrl: store.ultraplinianApiUrl, |
| 2237 | ultraplinianApiKey: store.ultraplinianApiKey, |
| 2238 | // Privacy |
| 2239 | datasetGenerationEnabled: store.datasetGenerationEnabled, |
| 2240 | noLogMode: store.noLogMode, |
| 2241 | showMagic: store.showMagic, |
| 2242 | promptsTried: store.promptsTried, |
| 2243 | } |
| 2244 | const data = JSON.stringify(exportData, null, 2) |
| 2245 | const blob = new Blob([data], { type: 'application/json' }) |
| 2246 | const url = URL.createObjectURL(blob) |
| 2247 | const a = document.createElement('a') |
| 2248 | a.href = url |
| 2249 | a.download = `g0dm0d3-backup-${new Date().toISOString().split('T')[0]}.json` |
| 2250 | a.click() |
| 2251 | URL.revokeObjectURL(url) |
| 2252 | } |
| 2253 | |
| 2254 | const handleFileSelect = (e: React.ChangeEvent<HTMLInputElement>) => { |
| 2255 | const file = e.target.files?.[0] |
nothing calls this directly
no outgoing calls
no test coverage detected