Naveedtechlab commited on
Commit
cbdb737
·
1 Parent(s): 17ddf17

fix: Use relative URLs instead of localhost for HF Space deployment

Browse files
frontend/components/ChatPanel.tsx CHANGED
@@ -11,7 +11,7 @@
11
  import { useState, useRef, useEffect, FormEvent } from 'react';
12
  import { useTheme } from '../contexts/ThemeContext';
13
 
14
- const MCP_SERVER_URL = process.env.NEXT_PUBLIC_MCP_SERVER_URL || 'http://localhost:5000';
15
 
16
  interface Message {
17
  role: 'user' | 'assistant';
 
11
  import { useState, useRef, useEffect, FormEvent } from 'react';
12
  import { useTheme } from '../contexts/ThemeContext';
13
 
14
+ const MCP_SERVER_URL = process.env.NEXT_PUBLIC_MCP_SERVER_URL || '';
15
 
16
  interface Message {
17
  role: 'user' | 'assistant';
frontend/lib/api.ts CHANGED
@@ -2,7 +2,7 @@
2
  * API client utilities for backend communication with JWT handling.
3
  */
4
 
5
- const API_URL = process.env.NEXT_PUBLIC_API_URL || 'http://localhost:8000';
6
 
7
  export function getToken(): string | null {
8
  if (typeof window === 'undefined') return null;
 
2
  * API client utilities for backend communication with JWT handling.
3
  */
4
 
5
+ const API_URL = process.env.NEXT_PUBLIC_API_URL || '';
6
 
7
  export function getToken(): string | null {
8
  if (typeof window === 'undefined') return null;
frontend/lib/auth.ts CHANGED
@@ -5,7 +5,7 @@
5
  import { createAuthClient } from 'better-auth/react';
6
  import { jwtClient } from 'better-auth/client/plugins';
7
 
8
- const API_URL = process.env.NEXT_PUBLIC_API_URL || 'http://localhost:3000';
9
 
10
  export const authClient = createAuthClient({
11
  baseURL: API_URL,
 
5
  import { createAuthClient } from 'better-auth/react';
6
  import { jwtClient } from 'better-auth/client/plugins';
7
 
8
+ const API_URL = process.env.NEXT_PUBLIC_API_URL || '';
9
 
10
  export const authClient = createAuthClient({
11
  baseURL: API_URL,
frontend/next.config.js CHANGED
@@ -1,6 +1,22 @@
1
  /** @type {import('next').NextConfig} */
2
  const nextConfig = {
3
  reactStrictMode: true,
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
4
  }
5
 
6
- module.exports = nextConfig
 
1
  /** @type {import('next').NextConfig} */
2
  const nextConfig = {
3
  reactStrictMode: true,
4
+ async rewrites() {
5
+ return [
6
+ {
7
+ source: '/api/chat',
8
+ destination: 'http://localhost:5000/api/chat',
9
+ },
10
+ {
11
+ source: '/mcp/:path*',
12
+ destination: 'http://localhost:5000/:path*',
13
+ },
14
+ {
15
+ source: '/api/:path*',
16
+ destination: 'http://localhost:8000/api/:path*',
17
+ },
18
+ ];
19
+ },
20
  }
21
 
22
+ module.exports = nextConfig