a3f0b49112
Replace the stubbed chat API with a real WebSocket hook that connects to /ws/chat and supports DM creation, messaging, session join/leave, and history retrieval. Keep REST stub functions for backward compatibility with existing pages that require listChatSessions/getChatSessionById imports.
26 lines
539 B
TypeScript
26 lines
539 B
TypeScript
import type { NextConfig } from "next"
|
|
|
|
const nextConfig: NextConfig = {
|
|
async rewrites() {
|
|
// 仅在开发环境启用 API 代理
|
|
if (process.env.NODE_ENV !== "development") {
|
|
return []
|
|
}
|
|
|
|
const backendUrl = process.env.NEXT_PUBLIC_BACKEND_URL || "http://localhost:18080"
|
|
|
|
return [
|
|
{
|
|
source: "/api/:path*",
|
|
destination: `${backendUrl}/api/:path*`,
|
|
},
|
|
{
|
|
source: "/healthz",
|
|
destination: `${backendUrl}/healthz`,
|
|
},
|
|
]
|
|
},
|
|
}
|
|
|
|
export default nextConfig
|