diff --git a/FriendZone/BE/README.md b/FriendZone/BE/README.md index 828939d..9b699e5 100644 --- a/FriendZone/BE/README.md +++ b/FriendZone/BE/README.md @@ -75,7 +75,7 @@ BE/ ## API Documentation -Replace `{{HOST}}` with your server's host URL (e.g., `http://localhost:8000`) +Replace `{{HOST}}` with your server's host URL (e.g., `http://localhost:8080`) ### 1. Authentication diff --git a/aider-genius/aider/website/docs/usage/not-code.md b/aider-genius/aider/website/docs/usage/not-code.md index 6a0bd81..ccdadea 100644 --- a/aider-genius/aider/website/docs/usage/not-code.md +++ b/aider-genius/aider/website/docs/usage/not-code.md @@ -62,7 +62,7 @@ Added Dockerfile and docker-compose.yml to the chat. ``` + USER appuser + HEALTHCHECK --interval=30s --timeout=3s \ -+ CMD curl -f http://localhost:8000/health || exit 1 ++ CMD curl -f http://localhost:8080/health || exit 1 ``` #### Expose port 5432 and add volume for postgres data diff --git a/jac-gpt/README.md b/jac-gpt/README.md index 0610cb6..d20b6ff 100644 --- a/jac-gpt/README.md +++ b/jac-gpt/README.md @@ -63,7 +63,7 @@ jac-gpt/ # MongoDB Configuration MONGODB_URI=mongodb://localhost:27017/ - MONGODB_DATABASE=jac_gpt + MONGODB_DATABASE=jaseci # Optional: Serper API for web search SERPER_API_KEY=your-serper-api-key-here @@ -86,7 +86,7 @@ jac-gpt/ jac serve server.jac ``` - The server will start on `http://localhost:8000` by default. + The server will start on `http://localhost:8080` by default. ### 2. React Client Setup @@ -112,7 +112,7 @@ jac-gpt/ Edit `.env` and update the configuration: ```env # JAC Server Configuration - VITE_API_URL=http://localhost:8000 + VITE_API_URL=http://localhost:8080 # Authentication (uses defaults if not provided) VITE_JAC_USER_EMAIL=test@mail.com diff --git a/jac-gpt/client/.env.example b/jac-gpt/client/.env.example index 974e12d..f1c280c 100644 --- a/jac-gpt/client/.env.example +++ b/jac-gpt/client/.env.example @@ -1,5 +1,5 @@ # API Configuration -VITE_API_URL=http://localhost:8000 +VITE_API_URL=http://localhost:8080 # Authentication Configuration (optional, will use defaults if not provided) VITE_JAC_USER_EMAIL=test@mail.com diff --git a/jac-gpt/client/Dockerfile b/jac-gpt/client/Dockerfile index 5146a0e..6da4596 100644 --- a/jac-gpt/client/Dockerfile +++ b/jac-gpt/client/Dockerfile @@ -14,7 +14,15 @@ RUN bun install COPY . . # Accept build arguments -ARG VITE_API_URL=http://localhost:8000 +# Accept build arguments +ARG VITE_API_URL=http://localhost:8080 +ARG VITE_JAC_USER_EMAIL=test@mail.com +ARG VITE_JAC_USER_PASSWORD=password + +# Set environment variables for the build +ENV VITE_API_URL=$VITE_API_URL +ENV VITE_JAC_USER_EMAIL=$VITE_JAC_USER_EMAIL +ENV VITE_JAC_USER_PASSWORD=$VITE_JAC_USER_PASSWORD # Build the application RUN bun run build diff --git a/jac-gpt/client/nginx.conf b/jac-gpt/client/nginx.conf index 9d7ebc1..7fbfb83 100644 --- a/jac-gpt/client/nginx.conf +++ b/jac-gpt/client/nginx.conf @@ -31,6 +31,25 @@ http { try_files $uri $uri/ /index.html; } + # Proxy API requests to the backend + location /api/ { + proxy_pass http://jac-server:8080/; + proxy_set_header Host $host; + proxy_set_header X-Real-IP $remote_addr; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + proxy_set_header X-Forwarded-Proto $scheme; + + # CORS headers + add_header Access-Control-Allow-Origin "*" always; + add_header Access-Control-Allow-Methods "GET, POST, PUT, DELETE, OPTIONS" always; + add_header Access-Control-Allow-Headers "Content-Type, Authorization" always; + + # Handle preflight requests + if ($request_method = 'OPTIONS') { + return 204; + } + } + # Cache static assets location ~* \.(js|css|png|jpg|jpeg|gif|ico|svg|woff|woff2|ttf|eot)$ { expires 1y; diff --git a/jac-gpt/client/src/components/AdminDashboard.tsx b/jac-gpt/client/src/components/AdminDashboard.tsx index bfb519e..abd9440 100644 --- a/jac-gpt/client/src/components/AdminDashboard.tsx +++ b/jac-gpt/client/src/components/AdminDashboard.tsx @@ -73,7 +73,7 @@ const AdminDashboard = () => { const fetchUsers = async () => { try { console.log('🔍 Fetching users with requester_email:', user?.email); - console.log('🔍 API URL:', import.meta.env.VITE_API_URL || 'http://localhost:8000'); + console.log('🔍 API URL:', import.meta.env.VITE_API_URL || 'http://localhost:8080'); // Get auth token for headers const token = localStorage.getItem('auth_token'); @@ -88,7 +88,7 @@ const AdminDashboard = () => { console.log('🔍 Added Authorization header'); } - const response = await fetch(`${import.meta.env.VITE_API_URL || 'http://localhost:8000'}/walker/get_all_users`, { + const response = await fetch(`${import.meta.env.VITE_API_URL || 'http://localhost:8080'}/walker/get_all_users`, { method: 'POST', headers, body: JSON.stringify({ requester_email: user?.email }), @@ -138,7 +138,7 @@ const AdminDashboard = () => { console.log('🔍 Added Authorization header'); } - const response = await fetch(`${import.meta.env.VITE_API_URL || 'http://localhost:8000'}/walker/get_all_sessions_admin`, { + const response = await fetch(`${import.meta.env.VITE_API_URL || 'http://localhost:8080'}/walker/get_all_sessions_admin`, { method: 'POST', headers, body: JSON.stringify({ requester_email: user?.email }), @@ -186,7 +186,7 @@ const AdminDashboard = () => { headers['Authorization'] = `Bearer ${token}`; } - const response = await fetch(`${import.meta.env.VITE_API_URL || 'http://localhost:8000'}/walker/get_session_messages_admin`, { + const response = await fetch(`${import.meta.env.VITE_API_URL || 'http://localhost:8080'}/walker/get_session_messages_admin`, { method: 'POST', headers, body: JSON.stringify({ @@ -230,7 +230,7 @@ const AdminDashboard = () => { // First get all sessions with their messages for (const session of sessions) { try { - const response = await fetch(`${import.meta.env.VITE_API_URL || 'http://localhost:8000'}/walker/get_session_messages_admin`, { + const response = await fetch(`${import.meta.env.VITE_API_URL || 'http://localhost:8080'}/walker/get_session_messages_admin`, { method: 'POST', headers, body: JSON.stringify({ diff --git a/jac-gpt/client/src/contexts/AuthContext.tsx b/jac-gpt/client/src/contexts/AuthContext.tsx index 2e4626f..2fae45b 100644 --- a/jac-gpt/client/src/contexts/AuthContext.tsx +++ b/jac-gpt/client/src/contexts/AuthContext.tsx @@ -72,7 +72,7 @@ export const AuthProvider: React.FC = ({ children }) => { // Always fetch the latest user profile to ensure correct role try { - const profileResponse = await fetch(`${import.meta.env.VITE_API_URL || 'http://localhost:8000'}/walker/get_user_profile`, { + const profileResponse = await fetch(`${import.meta.env.VITE_API_URL || 'http://localhost:8080'}/walker/get_user_profile`, { method: 'POST', headers: { 'Content-Type': 'application/json', @@ -121,7 +121,7 @@ export const AuthProvider: React.FC = ({ children }) => { // First, try the built-in JAC Cloud login endpoint try { - response = await fetch(`${import.meta.env.VITE_API_URL || 'http://localhost:8000'}/user/login`, { + response = await fetch(`${import.meta.env.VITE_API_URL || 'http://localhost:8080'}/user/login`, { method: 'POST', headers: { 'Content-Type': 'application/json', @@ -143,7 +143,7 @@ export const AuthProvider: React.FC = ({ children }) => { if (token) { // Fetch the complete user profile from our custom endpoint to get correct role try { - const profileResponse = await fetch(`${import.meta.env.VITE_API_URL || 'http://localhost:8000'}/walker/get_user_profile`, { + const profileResponse = await fetch(`${import.meta.env.VITE_API_URL || 'http://localhost:8080'}/walker/get_user_profile`, { method: 'POST', headers: { 'Content-Type': 'application/json', @@ -233,7 +233,7 @@ export const AuthProvider: React.FC = ({ children }) => { }; // Use JAC Cloud's built-in register endpoint - const response = await fetch(`${import.meta.env.VITE_API_URL || 'http://localhost:8000'}/user/register`, { + const response = await fetch(`${import.meta.env.VITE_API_URL || 'http://localhost:8080'}/user/register`, { method: 'POST', headers: { 'Content-Type': 'application/json', @@ -254,7 +254,7 @@ export const AuthProvider: React.FC = ({ children }) => { // Save location data if available if (location) { try { - await fetch(`${import.meta.env.VITE_API_URL || 'http://localhost:8000'}/walker/save_user_location`, { + await fetch(`${import.meta.env.VITE_API_URL || 'http://localhost:8080'}/walker/save_user_location`, { method: 'POST', headers: { 'Content-Type': 'application/json', diff --git a/jac-gpt/client/src/pages/ForgotPassword.tsx b/jac-gpt/client/src/pages/ForgotPassword.tsx index 224fc58..bfb9f3d 100644 --- a/jac-gpt/client/src/pages/ForgotPassword.tsx +++ b/jac-gpt/client/src/pages/ForgotPassword.tsx @@ -19,7 +19,7 @@ const ForgotPassword = () => { setIsLoading(true); try { - const response = await fetch(`${import.meta.env.VITE_API_URL || 'http://localhost:8000'}/user/forgot_password`, { + const response = await fetch(`${import.meta.env.VITE_API_URL || 'http://localhost:8080'}/user/forgot_password`, { method: 'POST', headers: { 'Content-Type': 'application/json', diff --git a/jac-gpt/client/src/pages/ResetPassword.tsx b/jac-gpt/client/src/pages/ResetPassword.tsx index cbc962d..dd97403 100644 --- a/jac-gpt/client/src/pages/ResetPassword.tsx +++ b/jac-gpt/client/src/pages/ResetPassword.tsx @@ -52,7 +52,7 @@ const ResetPassword = () => { setIsLoading(true); try { - const response = await fetch(`${import.meta.env.VITE_API_URL || 'http://localhost:8000'}/user/reset_password`, { + const response = await fetch(`${import.meta.env.VITE_API_URL || 'http://localhost:8080'}/user/reset_password`, { method: 'POST', headers: { 'Content-Type': 'application/json', diff --git a/jac-gpt/client/src/pages/VerifyEmail.tsx b/jac-gpt/client/src/pages/VerifyEmail.tsx index d64eeef..750785c 100644 --- a/jac-gpt/client/src/pages/VerifyEmail.tsx +++ b/jac-gpt/client/src/pages/VerifyEmail.tsx @@ -23,7 +23,7 @@ const VerifyEmail = () => { const verifyEmail = async () => { try { - const response = await fetch(`${import.meta.env.VITE_API_URL || 'http://localhost:8000'}/user/verify`, { + const response = await fetch(`${import.meta.env.VITE_API_URL || 'http://localhost:8080'}/user/verify`, { method: 'POST', headers: { 'Content-Type': 'application/json', diff --git a/jac-gpt/client/src/services/documentation.ts b/jac-gpt/client/src/services/documentation.ts index b852b5e..3e68438 100644 --- a/jac-gpt/client/src/services/documentation.ts +++ b/jac-gpt/client/src/services/documentation.ts @@ -16,7 +16,7 @@ class DocumentationService { private baseUrl: string; constructor() { - this.baseUrl = 'http://localhost:8000'; + this.baseUrl = 'http://localhost:8080'; } /** diff --git a/jac-gpt/client/src/services/jacServer.ts b/jac-gpt/client/src/services/jacServer.ts index c3cf061..3bbf39f 100644 --- a/jac-gpt/client/src/services/jacServer.ts +++ b/jac-gpt/client/src/services/jacServer.ts @@ -23,7 +23,7 @@ class JacServerService { private defaultPassword: string; constructor() { - this.baseUrl = import.meta.env.VITE_API_URL || 'http://localhost:8000'; + this.baseUrl = import.meta.env.VITE_API_URL || 'http://localhost:8080'; this.defaultEmail = import.meta.env.VITE_JAC_USER_EMAIL || 'test@mail.com'; this.defaultPassword = import.meta.env.VITE_JAC_USER_PASSWORD || 'password'; } diff --git a/jac-gpt/docker-compose.prod.yml b/jac-gpt/docker-compose.prod.yml index 6cfbc8c..6603c40 100644 --- a/jac-gpt/docker-compose.prod.yml +++ b/jac-gpt/docker-compose.prod.yml @@ -12,7 +12,7 @@ services: environment: - OPENAI_API_KEY=${OPENAI_API_KEY} - DATABASE_HOST=mongodb+srv://v30793620:qFT9ofgVU2GPN5oA@cluster0.ry1lymm.mongodb.net/?retryWrites=true&w=majority&appName=Cluster0 - - DATABASE_NAME=jac_gpt + - DATABASE_NAME=jaseci - PYTHONUNBUFFERED=1 - PYTHONDONTWRITEBYTECODE=1 - JAC_ENV=production diff --git a/jac-gpt/docker-compose.yml b/jac-gpt/docker-compose.yml index 87b15fb..8556e25 100644 --- a/jac-gpt/docker-compose.yml +++ b/jac-gpt/docker-compose.yml @@ -8,10 +8,12 @@ services: restart: unless-stopped ports: - "8080:8080" + env_file: + - ./server/.env environment: - OPENAI_API_KEY=${OPENAI_API_KEY:-your_openai_api_key_here} - DATABASE_HOST=mongodb+srv://v30793620:qFT9ofgVU2GPN5oA@cluster0.ry1lymm.mongodb.net/?retryWrites=true&w=majority&appName=Cluster0 - - DATABASE_NAME=jac_gpt + - DATABASE_NAME=jaseci - PYTHONUNBUFFERED=1 - PYTHONDONTWRITEBYTECODE=1 volumes: @@ -20,6 +22,12 @@ services: - jac_server_logs:/app/logs networks: - jac-gpt-network + healthcheck: + test: ["CMD", "curl", "-f", "http://localhost:8080/docs"] + interval: 30s + timeout: 10s + retries: 3 + start_period: 40s # React Frontend (Webapp) jac-webapp: @@ -27,19 +35,22 @@ services: context: ./client dockerfile: Dockerfile args: - VITE_API_URL: http://localhost:8080 + - VITE_API_URL=/api + - VITE_JAC_USER_EMAIL=test@mail.com + - VITE_JAC_USER_PASSWORD=password container_name: jac-gpt-webapp restart: unless-stopped ports: - "3000:80" # Use port 3000 to avoid conflict with system nginx - environment: - - VITE_API_URL=http://localhost:8080 - - VITE_JAC_USER_EMAIL=${VITE_JAC_USER_EMAIL:-test@mail.com} - - VITE_JAC_USER_PASSWORD=${VITE_JAC_USER_PASSWORD:-password} depends_on: - jac-server networks: - jac-gpt-network + healthcheck: + test: ["CMD", "curl", "-f", "http://localhost:80"] + interval: 30s + timeout: 10s + retries: 3 volumes: jac_server_data: diff --git a/jac-gpt/server/.env.sample b/jac-gpt/server/.env.sample index 3f354ab..b9fa614 100644 --- a/jac-gpt/server/.env.sample +++ b/jac-gpt/server/.env.sample @@ -3,4 +3,4 @@ OPENAI_API_KEY=your_openai_api_key_here # Database configuration DATABASE_HOST=mongodb://localhost:27017 -DATABASE_NAME=jac_gpt_prod4 +DATABASE_NAME=jaseci diff --git a/jac-gpt/server/Dockerfile b/jac-gpt/server/Dockerfile index 29eeffd..32bfcfd 100644 --- a/jac-gpt/server/Dockerfile +++ b/jac-gpt/server/Dockerfile @@ -31,5 +31,9 @@ RUN mkdir -p /app/data /app/logs # Expose port 8000 (default for jac serve) EXPOSE 8080 +# Set environment variables for CORS +ENV CORS_ORIGINS="http://localhost:3000,http://127.0.0.1:3000" +ENV CORS_ALLOW_CREDENTIALS="true" + # Set the default command to serve the jac application CMD ["jac", "serve", "server.jac", "--host", "0.0.0.0", "--port", "8080"] diff --git a/jac-gpt/server/database.jac b/jac-gpt/server/database.jac index 92db8c2..863f889 100644 --- a/jac-gpt/server/database.jac +++ b/jac-gpt/server/database.jac @@ -31,7 +31,7 @@ obj MongoDB { print("DATABASE_HOST not found! Falling back to localhost..."); mongo_uri = "mongodb://localhost:27017/"; } - db_name = os.getenv("DATABASE_NAME", "jac_gpt_2"); + db_name = os.getenv("DATABASE_NAME", "jaseci"); print(f"Attempting to connect to MongoDB with URI: {mongo_uri[:50]}..."); print(f"Database name: {db_name}"); diff --git a/jac-gpt/server/docs/index.html b/jac-gpt/server/docs/index.html index 57dad31..be9de36 100644 --- a/jac-gpt/server/docs/index.html +++ b/jac-gpt/server/docs/index.html @@ -1965,7 +1965,7 @@

An Intellectual Journey

{ type: 'success', text: '🌐 Task Manager API Ready!' }, { type: 'success', text: '✅ POST /create_task - Create a new task' }, { type: 'success', text: '✅ GET /get_tasks - List all tasks' }, - { type: 'info', text: '🚀 Server running at http://localhost:8000' }, + { type: 'info', text: '🚀 Server running at http://localhost:8080' }, { type: 'info', text: '📚 API docs available at /docs' }, { type: 'success', text: '⚡ Auto-scaling enabled - 0 to 1000 instances' }, { type: 'success', text: '💾 Persistent storage configured and ready' } diff --git a/jac-gpt/server/docs/jac_book/chapter_12.md b/jac-gpt/server/docs/jac_book/chapter_12.md index fb7f47e..0230d01 100644 --- a/jac-gpt/server/docs/jac_book/chapter_12.md +++ b/jac-gpt/server/docs/jac_book/chapter_12.md @@ -93,7 +93,7 @@ Your walker is now automatically available as a REST API endpoint! To test the API, you can use `curl` or any HTTP client: ```bash -curl -X POST http://localhost:8000/walker/get_weather \ +curl -X POST http://localhost:8080/walker/get_weather \ -H "Content-Type: application/json" \ -d '{"city": "New York"}' ``` @@ -233,7 +233,7 @@ jac serve simple_notebook.jac We can now test the API using `curl` or any HTTP client via the POST method. The `create_note` walker will accept a JSON request body with `title`, `content`, and `author` fields, and return a response indicating the note was created. ```bash -curl -X POST http://localhost:8000/walker/create_note \ +curl -X POST http://localhost:8080/walker/create_note \ -H "Content-Type: application/json" \ -d '{ "title": "My First Note", @@ -260,7 +260,7 @@ curl -X POST http://localhost:8000/walker/create_note \ To retrieve all notes, we can use the `get_notes` walker: ```bash -curl -X POST http://localhost:8000/walker/get_notes \ +curl -X POST http://localhost:8080/walker/get_notes \ -H "Content-Type: application/json" \ -d '{}' ``` @@ -289,7 +289,7 @@ walker get_notes { The `get_notes` walker can now be accessed via a GET request at the endpoint `/walker/get_notes`. ```bash -curl -X GET http://localhost:8000/walker/get_notes \ +curl -X GET http://localhost:8080/walker/get_notes \ -H "Content-Type: application/json" \ -d '{}' ``` @@ -362,7 +362,7 @@ Jac automatically validates request parameters based on walker attribute types. ```bash # Valid request -curl -X POST http://localhost:8000/walker/create_note \ +curl -X POST http://localhost:8080/walker/create_note \ -H "Content-Type: application/json" \ -d '{ "title": "Important Meeting", @@ -373,7 +373,7 @@ curl -X POST http://localhost:8000/walker/create_note \ }' # Invalid request - priority out of range -curl -X POST http://localhost:8000/walker/create_note \ +curl -X POST http://localhost:8080/walker/create_note \ -H "Content-Type: application/json" \ -d '{ "title": "Test", @@ -524,27 +524,27 @@ Walkers naturally map to REST operations, creating intuitive API patterns for co ```bash # Create a note -curl -X POST http://localhost:8000/walker/create_note \ +curl -X POST http://localhost:8080/walker/create_note \ -H "Content-Type: application/json" \ -d '{"title": "Shopping List", "content": "Milk, Bread, Eggs", "author": "Alice"}' # List all notes -curl -X POST http://localhost:8000/walker/list_notes \ +curl -X POST http://localhost:8080/walker/list_notes \ -H "Content-Type: application/json" \ -d '{}' # Get specific note (replace with actual ID) -curl -X POST http://localhost:8000/walker/get_note \ +curl -X POST http://localhost:8080/walker/get_note \ -H "Content-Type: application/json" \ -d '{"note_id": "note_123"}' # Update a note -curl -X POST http://localhost:8000/walker/update_note \ +curl -X POST http://localhost:8080/walker/update_note \ -H "Content-Type: application/json" \ -d '{"note_id": "note_123", "priority": 5}' # Delete a note -curl -X POST http://localhost:8000/walker/delete_note \ +curl -X POST http://localhost:8080/walker/delete_note \ -H "Content-Type: application/json" \ -d '{"note_id": "note_123"}' ``` @@ -661,7 +661,7 @@ Let's add basic permission checking to demonstrate multi-user patterns: ```bash # Create a shared note -curl -X POST http://localhost:8000/walker/create_shared_note \ +curl -X POST http://localhost:8080/walker/create_shared_note \ -H "Content-Type: application/json" \ -d '{ "title": "Team Meeting Notes", @@ -672,12 +672,12 @@ curl -X POST http://localhost:8000/walker/create_shared_note \ }' # Get notes for a user -curl -X POST http://localhost:8000/walker/get_user_notes \ +curl -X POST http://localhost:8080/walker/get_user_notes \ -H "Content-Type: application/json" \ -d '{"user": "Bob"}' # Share note with another user -curl -X POST http://localhost:8000/walker/share_note \ +curl -X POST http://localhost:8080/walker/share_note \ -H "Content-Type: application/json" \ -d '{ "note_id": "note_123", diff --git a/jac-gpt/server/docs/jac_book/chapter_13.md b/jac-gpt/server/docs/jac_book/chapter_13.md index 57cf031..0ddb429 100644 --- a/jac-gpt/server/docs/jac_book/chapter_13.md +++ b/jac-gpt/server/docs/jac_book/chapter_13.md @@ -265,33 +265,33 @@ pip install -r requirements.txt # Start the service with database persistence jac serve main.jac -# Service starts on http://localhost:8000 -# API documentation available at http://localhost:8000/docs +# Service starts on http://localhost:8080 +# API documentation available at http://localhost:8080/docs ``` ### Testing Persistence ```bash # First request - Create counter -curl -X POST http://localhost:8000/walker/get_counter \ +curl -X POST http://localhost:8080/walker/get_counter \ -H "Content-Type: application/json" \ -d '{}' # Response: {"returns": [{"value": 0, "status": "created"}]} # Increment the counter -curl -X POST http://localhost:8000/walker/increment_counter \ +curl -X POST http://localhost:8080/walker/increment_counter \ -H "Content-Type: application/json" \ -d '{}' # Response: {"returns": [{"value": 1, "previous": 0}]} # Increment again -curl -X POST http://localhost:8000/walker/increment_counter \ +curl -X POST http://localhost:8080/walker/increment_counter \ -H "Content-Type: application/json" \ -d '{}' # Response: {"returns": [{"value": 2, "previous": 1}]} # Check counter value -curl -X POST http://localhost:8000/walker/get_counter \ +curl -X POST http://localhost:8080/walker/get_counter \ -H "Content-Type: application/json" \ -d '{}' # Response: {"returns": [{"value": 2, "status": "existing"}]} @@ -299,7 +299,7 @@ curl -X POST http://localhost:8000/walker/get_counter \ # Restart the service (Ctrl+C, then jac serve main.jac again) # Counter value persists after restart -curl -X POST http://localhost:8000/walker/get_counter \ +curl -X POST http://localhost:8080/walker/get_counter \ -H "Content-Type: application/json" \ -d '{}' # Response: {"returns": [{"value": 2, "status": "existing"}]} @@ -416,27 +416,27 @@ Let's enhance our counter to track increment history: jac serve main.jac # Multiple increments to build history -curl -X POST http://localhost:8000/walker/increment_with_history \ +curl -X POST http://localhost:8080/walker/increment_with_history \ -H "Content-Type: application/json" \ -d '{}' -curl -X POST http://localhost:8000/walker/increment_with_history \ +curl -X POST http://localhost:8080/walker/increment_with_history \ -H "Content-Type: application/json" \ -d '{}' -curl -X POST http://localhost:8000/walker/increment_with_history \ +curl -X POST http://localhost:8080/walker/increment_with_history \ -H "Content-Type: application/json" \ -d '{}' # Check counter with complete history -curl -X POST http://localhost:8000/walker/get_counter_with_history \ +curl -X POST http://localhost:8080/walker/get_counter_with_history \ -H "Content-Type: application/json" \ -d '{}' # Response includes value and complete history array # Restart service - history persists # jac serve main.jac (after restart) -curl -X POST http://localhost:8000/walker/get_counter_with_history \ +curl -X POST http://localhost:8080/walker/get_counter_with_history \ -H "Content-Type: application/json" \ -d '{}' # All history entries remain intact @@ -567,25 +567,25 @@ The automatic persistence enables building sophisticated stateful applications. ```bash # Create multiple counters -curl -X POST "http://localhost:8000/walker/create_counter" \ +curl -X POST "http://localhost:8080/walker/create_counter" \ -H "Content-Type: application/json" \ -d '{"name": "page_views"}' -curl -X POST "http://localhost:8000/walker/create_counter" \ +curl -X POST "http://localhost:8080/walker/create_counter" \ -H "Content-Type: application/json" \ -d '{"name": "user_signups"}' # Increment specific counters -curl -X POST "http://localhost:8000/walker/increment_named_counter" \ +curl -X POST "http://localhost:8080/walker/increment_named_counter" \ -H "Content-Type: application/json" \ -d '{"name": "page_views", "amount": 5}' -curl -X POST "http://localhost:8000/walker/increment_named_counter" \ +curl -X POST "http://localhost:8080/walker/increment_named_counter" \ -H "Content-Type: application/json" \ -d '{"name": "user_signups", "amount": 2}' # View all counters -curl -X POST http://localhost:8000/walker/get_all_counters \ +curl -X POST http://localhost:8080/walker/get_all_counters \ -H "Content-Type: application/json" \ -d '{}' # Response: {"returns": [{"counters": [{"name": "page_views", "value": 5}, {"name": "user_signups", "value": 2}], "total": 7}]} diff --git a/jac-gpt/server/docs/jac_book/chapter_14.md b/jac-gpt/server/docs/jac_book/chapter_14.md index db0486a..87ac016 100644 --- a/jac-gpt/server/docs/jac_book/chapter_14.md +++ b/jac-gpt/server/docs/jac_book/chapter_14.md @@ -278,7 +278,7 @@ jac serve user_notebook.jac ```bash # Create a note for Alice -curl -X POST http://localhost:8000/walker/create_note \ +curl -X POST http://localhost:8080/walker/create_note \ -H "Content-Type: application/json" \ -d '{ "title": "Alice Private Note", @@ -287,7 +287,7 @@ curl -X POST http://localhost:8000/walker/create_note \ }' # Create a note for Bob -curl -X POST http://localhost:8000/walker/create_note \ +curl -X POST http://localhost:8080/walker/create_note \ -H "Content-Type: application/json" \ -d '{ "title": "Bob Note", @@ -296,7 +296,7 @@ curl -X POST http://localhost:8000/walker/create_note \ }' # Get Alice's notes only -curl -X POST http://localhost:8000/walker/list_my_notes \ +curl -X POST http://localhost:8080/walker/list_my_notes \ -H "Content-Type: application/json" \ -d '{"user_id": "alice@example.com"}' ``` @@ -435,7 +435,7 @@ Multi-user applications often need controlled sharing of data between users. Let ```bash # Alice creates a note -curl -X POST http://localhost:8000/walker/create_note \ +curl -X POST http://localhost:8080/walker/create_note \ -H "Content-Type: application/json" \ -d '{ "title": "Team Project", @@ -444,7 +444,7 @@ curl -X POST http://localhost:8000/walker/create_note \ }' # Alice shares note with Bob -curl -X POST http://localhost:8000/walker/share_note \ +curl -X POST http://localhost:8080/walker/share_note \ -H "Content-Type: application/json" \ -d '{ "note_id": "note_123", @@ -453,7 +453,7 @@ curl -X POST http://localhost:8000/walker/share_note \ }' # Bob views accessible notes -curl -X POST http://localhost:8000/walker/get_accessible_notes \ +curl -X POST http://localhost:8080/walker/get_accessible_notes \ -H "Content-Type: application/json" \ -d '{"user_id": "bob@example.com"}' ``` @@ -753,12 +753,12 @@ Different applications require different access control models. Let's implement ```bash # Check user role -curl -X POST http://localhost:8000/walker/check_user_role \ +curl -X POST http://localhost:8080/walker/check_user_role \ -H "Content-Type: application/json" \ -d '{"user_id": "alice@example.com"}' # Create a note requiring editor role -curl -X POST http://localhost:8000/walker/create_role_based_note \ +curl -X POST http://localhost:8080/walker/create_role_based_note \ -H "Content-Type: application/json" \ -d '{ "title": "Editor Note", @@ -769,7 +769,7 @@ curl -X POST http://localhost:8000/walker/create_role_based_note \ }' # Get notes filtered by role -curl -X POST http://localhost:8000/walker/get_role_filtered_notes \ +curl -X POST http://localhost:8080/walker/get_role_filtered_notes \ -H "Content-Type: application/json" \ -d '{"user_id": "alice@example.com"}' ``` diff --git a/jac-gpt/server/docs/jac_book/chapter_15.md b/jac-gpt/server/docs/jac_book/chapter_15.md index 9d8e1c4..f73d5b5 100644 --- a/jac-gpt/server/docs/jac_book/chapter_15.md +++ b/jac-gpt/server/docs/jac_book/chapter_15.md @@ -416,17 +416,17 @@ Test with curl (all walker endpoints are POST): ```bash # Join a room first -curl -X POST http://localhost:8000/walker/join_room \ +curl -X POST http://localhost:8080/walker/join_room \ -H "Content-Type: application/json" \ -d '{"room_name": "general", "username": "alice"}' # Send a message -curl -X POST http://localhost:8000/walker/send_message \ +curl -X POST http://localhost:8080/walker/send_message \ -H "Content-Type: application/json" \ -d '{"room_name": "general", "username": "alice", "message": "Hello everyone!"}' # Get chat history -curl -X POST http://localhost:8000/walker/get_chat_history \ +curl -X POST http://localhost:8080/walker/get_chat_history \ -H "Content-Type: application/json" \ -d '{"room_name": "general", "limit": 10}' ``` @@ -553,7 +553,7 @@ Webhooks enable your Jac applications to receive real-time notifications from ex Test webhook locally: ```bash -curl -X POST http://localhost:8000/walker/receive_webhook \ +curl -X POST http://localhost:8080/walker/receive_webhook \ -H "Content-Type: application/json" \ -d '{ "source": "github", @@ -827,12 +827,12 @@ Automated tasks are essential for maintenance, cleanup, and periodic operations. ```bash # Run cleanup manually -curl -X POST http://localhost:8000/walker/cleanup_inactive_rooms \ +curl -X POST http://localhost:8080/walker/cleanup_inactive_rooms \ -H "Content-Type: application/json" \ -d '{"max_age_hours": 48}' # Generate daily stats -curl -X POST http://localhost:8000/walker/generate_daily_stats \ +curl -X POST http://localhost:8080/walker/generate_daily_stats \ -H "Content-Type: application/json" \ -d '{}' ``` diff --git a/jac-gpt/server/docs/jac_book/chapter_18.md b/jac-gpt/server/docs/jac_book/chapter_18.md index b416798..e5a76f0 100644 --- a/jac-gpt/server/docs/jac_book/chapter_18.md +++ b/jac-gpt/server/docs/jac_book/chapter_18.md @@ -105,7 +105,7 @@ Let's start with our weather API and show how it progresses from development to jac serve weather_api.jac --port 8000 # Test the endpoints - curl -X POST http://localhost:8000/walker/get_weather \ + curl -X POST http://localhost:8080/walker/get_weather \ -H "Content-Type: application/json" \ -d '{"city": "New York"}' ``` @@ -184,7 +184,7 @@ Docker packaging makes your Jac applications portable and consistent across envi - weather_data:/app/data restart: unless-stopped healthcheck: - test: ["CMD", "curl", "-f", "http://localhost:8000/walker/health_check", "-X", "POST", "-H", "Content-Type: application/json", "-d", "{}"] + test: ["CMD", "curl", "-f", "http://localhost:8080/walker/health_check", "-X", "POST", "-H", "Content-Type: application/json", "-d", "{}"] interval: 30s timeout: 10s retries: 3 @@ -213,12 +213,12 @@ docker-compose up -d docker-compose logs -f weather-api # Test the containerized API -curl -X POST http://localhost:8000/walker/get_weather \ +curl -X POST http://localhost:8080/walker/get_weather \ -H "Content-Type: application/json" \ -d '{"city": "London"}' # Check health -curl -X POST http://localhost:8000/walker/health_check \ +curl -X POST http://localhost:8080/walker/health_check \ -H "Content-Type: application/json" \ -d '{}' ``` diff --git a/jac-gpt/server/docs/jac_book/chapter_19.md b/jac-gpt/server/docs/jac_book/chapter_19.md index 4c14a1d..0472520 100644 --- a/jac-gpt/server/docs/jac_book/chapter_19.md +++ b/jac-gpt/server/docs/jac_book/chapter_19.md @@ -715,17 +715,17 @@ When deploying to Jac Cloud, consider performance implications of distributed ex jac serve distributed_friends.jac # Generate test data -curl -X POST http://localhost:8000/walker/generate_test_network \ +curl -X POST http://localhost:8080/walker/generate_test_network \ -H "Content-Type: application/json" \ -d '{"person_count": 1000, "avg_friends": 10}' # Run performance benchmarks -curl -X POST http://localhost:8000/walker/run_performance_suite \ +curl -X POST http://localhost:8080/walker/run_performance_suite \ -H "Content-Type: application/json" \ -d '{"test_count": 5, "test_persons": ["Person1", "Person50", "Person100"]}' # Check system health -curl -X POST http://localhost:8000/walker/performance_health_check \ +curl -X POST http://localhost:8080/walker/performance_health_check \ -H "Content-Type: application/json" \ -d '{}' ``` diff --git a/jac-gpt/server/docs/learn/examples/littleX/full_guide.md b/jac-gpt/server/docs/learn/examples/littleX/full_guide.md index 90f7365..004a10c 100644 --- a/jac-gpt/server/docs/learn/examples/littleX/full_guide.md +++ b/jac-gpt/server/docs/learn/examples/littleX/full_guide.md @@ -894,7 +894,7 @@ Using tools like Swagger or Postman, you can test these APIs to confirm their fu `jac serve filename.jac` run using command line. 2. Access Swagger Docs -Open your browser and navigate to http://localhost:8000/docs +Open your browser and navigate to http://localhost:8080/docs 3. Test an API Endpoint - Click on an endpoint diff --git a/jac-gpt/server/docs/learn/examples/rag_chatbot/Tutorial.md b/jac-gpt/server/docs/learn/examples/rag_chatbot/Tutorial.md index e2e73aa..bf1970f 100644 --- a/jac-gpt/server/docs/learn/examples/rag_chatbot/Tutorial.md +++ b/jac-gpt/server/docs/learn/examples/rag_chatbot/Tutorial.md @@ -145,7 +145,7 @@ The backend demonstrates Object Spatial Programming with nodes and walkers. It u - `POST /walker/upload_file` — Upload any supported file type (requires Bearer token) - `POST /walker/interact` — Chat endpoint with multimodal support (requires Bearer token) -See `http://localhost:8000/docs` for full Swagger API documentation. +See `http://localhost:8080/docs` for full Swagger API documentation. ## 12. Advanced Features - **Multimodal Capabilities**: Chat with images and videos using GPT-4o-mini's vision capabilities diff --git a/jac-gpt/server/docs/learn/examples/rag_chatbot/solution/client.jac b/jac-gpt/server/docs/learn/examples/rag_chatbot/solution/client.jac index 15da4ee..65dac97 100644 --- a/jac-gpt/server/docs/learn/examples/rag_chatbot/solution/client.jac +++ b/jac-gpt/server/docs/learn/examples/rag_chatbot/solution/client.jac @@ -31,7 +31,7 @@ def bootstrap_frontend(token: str) { "session_id": st.session_state.session_id }; response = requests.post( - "http://localhost:8000/walker/upload_file", + "http://localhost:8080/walker/upload_file", json=payload, headers={"Authorization": f"Bearer {token}"} ); @@ -72,7 +72,7 @@ def bootstrap_frontend(token: str) { payload["file_path"] = st.session_state.last_uploaded_file_path; } response = requests.post( - "http://localhost:8000/walker/interact", + "http://localhost:8080/walker/interact", json=payload, headers={"Authorization": f"Bearer {token}"} ); @@ -92,7 +92,7 @@ def bootstrap_frontend(token: str) { with entry { - INSTANCE_URL = "http://localhost:8000"; + INSTANCE_URL = "http://localhost:8080"; TEST_USER_EMAIL = "test@mail.com"; TEST_USER_PASSWORD = "password"; diff --git a/jac-gpt/server/docs/learn/jac-cloud/env_vars.md b/jac-gpt/server/docs/learn/jac-cloud/env_vars.md index 2cdc27c..2e010c2 100644 --- a/jac-gpt/server/docs/learn/jac-cloud/env_vars.md +++ b/jac-gpt/server/docs/learn/jac-cloud/env_vars.md @@ -159,7 +159,7 @@ export LOGGER_USE_UTC="true" # Use UTC timestamps | `RESTRICT_UNVERIFIED_USER` | Require email verification | `false` | `true` | | `VERIFICATION_CODE_TIMEOUT` | Verification code expiration (hours) | `24` | `48` | | `RESET_CODE_TIMEOUT` | Password reset code expiration (hours) | `24` | `1` | -| `SENDGRID_HOST` | Host for verification links | `http://localhost:8000` | `https://api.example.com` | +| `SENDGRID_HOST` | Host for verification links | `http://localhost:8080` | `https://api.example.com` | | `SENDGRID_API_KEY` | SendGrid API key | `null` | `SG.your-api-key` | ### Logging Configuration diff --git a/jac-gpt/server/docs/learn/jac-cloud/introduction.md b/jac-gpt/server/docs/learn/jac-cloud/introduction.md index dfcc633..98fee6b 100644 --- a/jac-gpt/server/docs/learn/jac-cloud/introduction.md +++ b/jac-gpt/server/docs/learn/jac-cloud/introduction.md @@ -59,7 +59,7 @@ jac run main.jac jac serve main.jac ``` -Your application will be available at `http://localhost:8000` with automatic API documentation at `http://localhost:8000/docs`. +Your application will be available at `http://localhost:8080` with automatic API documentation at `http://localhost:8080/docs`. ## How Jac Cloud Works diff --git a/jac-gpt/server/docs/learn/jac-cloud/quickstart.md b/jac-gpt/server/docs/learn/jac-cloud/quickstart.md index 8eb3e0b..16af94c 100644 --- a/jac-gpt/server/docs/learn/jac-cloud/quickstart.md +++ b/jac-gpt/server/docs/learn/jac-cloud/quickstart.md @@ -24,8 +24,8 @@ jac serve main.jac --host 0.0.0.0 --port 8080 --reload Once started, your API will be available at: -- **API Endpoint**: `http://localhost:8000` -- **Interactive Documentation**: `http://localhost:8000/docs` +- **API Endpoint**: `http://localhost:8080` +- **Interactive Documentation**: `http://localhost:8080/docs` ## Understanding Walker Endpoints @@ -105,7 +105,7 @@ walker my_walker { ## Examples for Beginners ### Basic Endpoint Example - Time Service -Let's create a simple endpoint that returns the current time. For this example, we create a walker named `public_info` which provides one rest method `get` at the url `http://localhost:8000/walker/public_info`. The ability `get_current_time` will return the current timestamp in ISO format via the use of the `report` statement. +Let's create a simple endpoint that returns the current time. For this example, we create a walker named `public_info` which provides one rest method `get` at the url `http://localhost:8080/walker/public_info`. The ability `get_current_time` will return the current timestamp in ISO format via the use of the `report` statement. ```jac import from datetime {datetime} diff --git a/jac-gpt/server/docs/learn/jac-mtllm/litellm_proxy.md b/jac-gpt/server/docs/learn/jac-mtllm/litellm_proxy.md index b0448d6..9109512 100644 --- a/jac-gpt/server/docs/learn/jac-mtllm/litellm_proxy.md +++ b/jac-gpt/server/docs/learn/jac-mtllm/litellm_proxy.md @@ -16,7 +16,7 @@ from mtllm import Model llm = Model( model_name="gpt-4o", # The model name to be used api_key="your_litellm_api_key", # LiteLLM proxy server key - proxy_url="http://localhost:8000", # URL of the LiteLLM proxy server + proxy_url="http://localhost:8080", # URL of the LiteLLM proxy server ) ``` diff --git a/task_manager/byllm/FE/README.md b/task_manager/byllm/FE/README.md index 0f3c0df..63811a4 100644 --- a/task_manager/byllm/FE/README.md +++ b/task_manager/byllm/FE/README.md @@ -20,7 +20,7 @@ This is the Streamlit-based frontend for the byllm task manager and chat assista ``` 3. **Make sure the backend is running** - - The frontend expects the backend to be available at `http://localhost:8000` + - The frontend expects the backend to be available at `http://localhost:8080` ## Screenshots diff --git a/task_manager/byllm/FE/app.py b/task_manager/byllm/FE/app.py index 34028d8..456550a 100644 --- a/task_manager/byllm/FE/app.py +++ b/task_manager/byllm/FE/app.py @@ -96,7 +96,7 @@ """, unsafe_allow_html=True) # --- CONSTANTS --- -BASE_URL = "http://localhost:8000" +BASE_URL = "http://localhost:8080" TASK_MANAGER_ENDPOINT = f"{BASE_URL}/walker/task_manager" GET_ALL_TASKS_ENDPOINT = f"{BASE_URL}/walker/get_all_tasks" diff --git a/task_manager/jivas/FE/README.md b/task_manager/jivas/FE/README.md index c5b4c9a..5739f75 100644 --- a/task_manager/jivas/FE/README.md +++ b/task_manager/jivas/FE/README.md @@ -20,7 +20,7 @@ This is the Streamlit-based frontend for the Jivas task manager and chat assista ``` 3. **Make sure the backend is running** - - The frontend expects the backend to be available at `http://localhost:8000` + - The frontend expects the backend to be available at `http://localhost:8080` ## Screenshots diff --git a/task_manager/jivas/FE/app.py b/task_manager/jivas/FE/app.py index 6c46c24..3f5f8a9 100644 --- a/task_manager/jivas/FE/app.py +++ b/task_manager/jivas/FE/app.py @@ -96,7 +96,7 @@ """, unsafe_allow_html=True) # --- CONSTANTS --- -BASE_URL = "http://localhost:8000" +BASE_URL = "http://localhost:8080" LOGIN_ENDPOINT = f"{BASE_URL}/user/login" CHAT_ENDPOINT = f"{BASE_URL}/interact" TASKS_ENDPOINT = f"{BASE_URL}/action/walker/tasks_handling_action/list_tasks" diff --git a/task_manager/jivas/jivas/README.md b/task_manager/jivas/jivas/README.md index 5d9f010..fb54195 100644 --- a/task_manager/jivas/jivas/README.md +++ b/task_manager/jivas/jivas/README.md @@ -80,7 +80,7 @@ jvcli server initagents Once the server is running and the agent is initialized, you can interact with it by sending a request to: ```bash -POST http://localhost:8000/walker/interact/interact +POST http://localhost:8080/walker/interact/interact ``` **Sample JSON Payload** @@ -102,7 +102,7 @@ POST http://localhost:8000/walker/interact/interact To enable LLM-based responses, set your OpenAI API key using the following request: ```bash -POST http://localhost:8000/walker/update_action +POST http://localhost:8080/walker/update_action ``` **Sample JSON Payload**