| 1 | import type { NextConfig } from "next"; |
| 2 | |
| 3 | const nextConfig: NextConfig = { |
| 4 | async rewrites() { |
| 5 | return [ |
| 6 | { |
| 7 | source: '/code/:path*', |
| 8 | destination: 'http://127.0.0.1:8000/code/:path*', |
| 9 | }, |
| 10 | { |
| 11 | source: '/api/sessions', |
| 12 | destination: 'http://127.0.0.1:8000/api/sessions', |
| 13 | }, |
| 14 | { |
| 15 | source: '/api/sessions/:path*', |
| 16 | destination: 'http://127.0.0.1:8000/api/sessions/:path*', |
| 17 | }, |
| 18 | // 工作流 API |
| 19 | { |
| 20 | source: '/api/project/:path*', |
| 21 | destination: 'http://127.0.0.1:8000/api/project/:path*', |
| 22 | }, |
| 23 | { |
| 24 | source: '/api/stages', |
| 25 | destination: 'http://127.0.0.1:8000/api/stages', |
| 26 | }, |
| 27 | { |
| 28 | source: '/api/upload_media', |
| 29 | destination: 'http://127.0.0.1:8000/api/upload_media', |
| 30 | }, |
| 31 | { |
| 32 | source: '/api/models', |
| 33 | destination: 'http://127.0.0.1:8000/api/models', |
| 34 | }, |
| 35 | { |
| 36 | source: '/api/config', |
| 37 | destination: 'http://127.0.0.1:8000/api/config', |
| 38 | }, |
| 39 | { |
| 40 | source: '/api/cache/:path*', |
| 41 | destination: 'http://127.0.0.1:8000/api/cache/:path*', |
| 42 | }, |
| 43 | // 一键 pipeline API |
| 44 | { |
| 45 | source: '/api/pipelines', |
| 46 | destination: 'http://127.0.0.1:8000/api/pipelines', |
| 47 | }, |
| 48 | { |
| 49 | source: '/api/pipelines/:path*', |
| 50 | destination: 'http://127.0.0.1:8000/api/pipelines/:path*', |
| 51 | }, |
| 52 | { |
| 53 | source: '/api/tasks', |
| 54 | destination: 'http://127.0.0.1:8000/api/tasks', |
| 55 | }, |
| 56 | { |
| 57 | source: '/api/tasks/:path*', |
| 58 | destination: 'http://127.0.0.1:8000/api/tasks/:path*', |
| 59 | }, |
| 60 | // 临时工作台 API |
| 61 | { |
| 62 | source: '/api/sandbox/:path*', |
| 63 | destination: 'http://127.0.0.1:8000/api/sandbox/:path*', |
| 64 | }, |
| 65 | ]; |
| 66 | }, |
| 67 | }; |
| 68 | |
| 69 | export default nextConfig; |
| 70 |