File size: 2,263 Bytes
ccf1a85
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
import { Router } from 'express';

const router = Router();

/**
 * Fallback routes for file upload functionality when uploads are disabled
 * (e.g., in production environments without persistent storage)
 */

router.post('/upload', async (req, res) => {
  res.status(503).json({
    success: false,
    error: 'File uploads disabled',
    message: 'File uploads are currently disabled in this environment. This is typically the case in demo environments or spaces without persistent storage.',
    suggestion: 'You can still use the search functionality with external sources, or deploy the application with persistent storage to enable document uploads.'
  });
});

router.post('/process/:id', async (req, res) => {
  res.status(503).json({
    success: false,
    error: 'Document processing disabled',
    message: 'Document processing is disabled when file uploads are not available.'
  });
});

router.post('/process/batch', async (req, res) => {
  res.status(503).json({
    success: false,
    error: 'Batch processing disabled',
    message: 'Batch processing is disabled when file uploads are not available.'
  });
});

router.post('/index/build', async (req, res) => {
  res.status(503).json({
    success: false,
    error: 'Index building disabled',
    message: 'Vector index building is disabled when document uploads are not available.'
  });
});

router.post('/search/vector', async (req, res) => {
  res.status(503).json({
    success: false,
    error: 'Vector search disabled',
    message: 'Vector search is disabled when no documents have been uploaded and processed.'
  });
});

router.get('/list', async (req, res) => {
  res.json({
    success: true,
    documents: [],
    totalCount: 0,
    message: 'No documents available - file uploads are disabled in this environment'
  });
});

router.get('/status/:id', async (req, res) => {
  res.status(404).json({
    success: false,
    error: 'Document not found',
    message: 'Document processing is disabled in this environment'
  });
});

router.delete('/:id', async (req, res) => {
  res.status(503).json({
    success: false,
    error: 'Document deletion disabled',
    message: 'Document operations are disabled when file uploads are not available.'
  });
});

export default router;