Reubencf Claude commited on
Commit
9953d0a
·
1 Parent(s): 789c311

Revert Messages to use /tmp - no write permissions on HF Spaces

Browse files

- Hugging Face Spaces doesn't allow creating directories in /app
- /tmp works fine for temporary message storage
- Messages reset on rebuilds (acceptable for global chat)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>

Files changed (1) hide show
  1. app/api/messages/route.ts +3 -9
app/api/messages/route.ts CHANGED
@@ -2,15 +2,9 @@ import { NextResponse } from 'next/server'
2
  import fs from 'fs'
3
  import path from 'path'
4
 
5
- // Use persistent storage directory instead of /tmp
6
- // This ensures messages survive rebuilds and restarts
7
- const STORAGE_DIR = process.env.PERSISTENT_STORAGE_DIR || path.join(process.cwd(), 'data')
8
- const dataFilePath = path.join(STORAGE_DIR, 'messages.json')
9
-
10
- // Ensure the storage directory exists
11
- if (!fs.existsSync(STORAGE_DIR)) {
12
- fs.mkdirSync(STORAGE_DIR, { recursive: true })
13
- }
14
 
15
  // Simple bad word list (expand as needed)
16
  const BAD_WORDS = [
 
2
  import fs from 'fs'
3
  import path from 'path'
4
 
5
+ // Use /tmp for temporary message storage
6
+ // Messages will reset on rebuilds, which is fine for a global chat
7
+ const dataFilePath = path.join('/tmp', 'messages.json')
 
 
 
 
 
 
8
 
9
  // Simple bad word list (expand as needed)
10
  const BAD_WORDS = [