Spaces:
Running
Running
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>
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
|
| 6 |
-
//
|
| 7 |
-
const
|
| 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 = [
|