From 320973a4260978a19c16d2de5da058975ebcebf9 Mon Sep 17 00:00:00 2001 From: phact Date: Fri, 19 Dec 2025 01:50:29 -0500 Subject: [PATCH] backend /v1 frontend /api/v1 routing, sdks port 3000 --- sdks/python/README.md | 2 +- sdks/python/openrag_sdk/client.py | 4 ++-- sdks/typescript/README.md | 2 +- sdks/typescript/src/client.ts | 4 ++-- src/api/v1/chat.py | 8 ++++---- src/api/v1/documents.py | 6 +++--- src/api/v1/search.py | 2 +- src/api/v1/settings.py | 2 +- src/main.py | 18 +++++++++--------- 9 files changed, 24 insertions(+), 24 deletions(-) diff --git a/sdks/python/README.md b/sdks/python/README.md index d947ae2d..664a81d6 100644 --- a/sdks/python/README.md +++ b/sdks/python/README.md @@ -32,7 +32,7 @@ The SDK can be configured via environment variables or constructor arguments: | Environment Variable | Constructor Argument | Description | |---------------------|---------------------|-------------| | `OPENRAG_API_KEY` | `api_key` | API key for authentication (required) | -| `OPENRAG_URL` | `base_url` | Base URL for the API (default: `http://localhost:8080`) | +| `OPENRAG_URL` | `base_url` | Base URL for the OpenRAG frontend (default: `http://localhost:3000`) | ```python # Using environment variables diff --git a/sdks/python/openrag_sdk/client.py b/sdks/python/openrag_sdk/client.py index a38f11c1..5a04d969 100644 --- a/sdks/python/openrag_sdk/client.py +++ b/sdks/python/openrag_sdk/client.py @@ -66,7 +66,7 @@ class OpenRAGClient: The client can be configured via constructor arguments or environment variables: - OPENRAG_API_KEY: API key for authentication - - OPENRAG_URL: Base URL for the OpenRAG API (default: http://localhost:8080) + - OPENRAG_URL: Base URL for the OpenRAG frontend (default: http://localhost:3000) Usage: # Using environment variables @@ -85,7 +85,7 @@ class OpenRAGClient: await client.close() """ - DEFAULT_BASE_URL = "http://localhost:8080" + DEFAULT_BASE_URL = "http://localhost:3000" def __init__( self, diff --git a/sdks/typescript/README.md b/sdks/typescript/README.md index 6067e478..9526ca92 100644 --- a/sdks/typescript/README.md +++ b/sdks/typescript/README.md @@ -33,7 +33,7 @@ The SDK can be configured via environment variables or constructor arguments: | Environment Variable | Constructor Option | Description | |---------------------|-------------------|-------------| | `OPENRAG_API_KEY` | `apiKey` | API key for authentication (required) | -| `OPENRAG_URL` | `baseUrl` | Base URL for the API (default: `http://localhost:8080`) | +| `OPENRAG_URL` | `baseUrl` | Base URL for the OpenRAG frontend (default: `http://localhost:3000`) | ```typescript // Using environment variables diff --git a/sdks/typescript/src/client.ts b/sdks/typescript/src/client.ts index 35cb32c0..dfecf5e7 100644 --- a/sdks/typescript/src/client.ts +++ b/sdks/typescript/src/client.ts @@ -73,7 +73,7 @@ interface RequestOptions { * * The client can be configured via constructor arguments or environment variables: * - OPENRAG_API_KEY: API key for authentication - * - OPENRAG_URL: Base URL for the OpenRAG API (default: http://localhost:8080) + * - OPENRAG_URL: Base URL for the OpenRAG frontend (default: http://localhost:3000) * * @example * ```typescript @@ -89,7 +89,7 @@ interface RequestOptions { * ``` */ export class OpenRAGClient { - private static readonly DEFAULT_BASE_URL = "http://localhost:8080"; + private static readonly DEFAULT_BASE_URL = "http://localhost:3000"; private readonly _apiKey: string; private readonly _baseUrl: string; diff --git a/src/api/v1/chat.py b/src/api/v1/chat.py index 003ea5d1..4a8d3e3d 100644 --- a/src/api/v1/chat.py +++ b/src/api/v1/chat.py @@ -112,7 +112,7 @@ async def chat_create_endpoint(request: Request, chat_service, session_manager): """ Send a chat message. - POST /api/v1/chat + POST /v1/chat Request body: { @@ -221,7 +221,7 @@ async def chat_list_endpoint(request: Request, chat_service, session_manager): """ List all conversations for the authenticated user. - GET /api/v1/chat + GET /v1/chat Response: { @@ -268,7 +268,7 @@ async def chat_get_endpoint(request: Request, chat_service, session_manager): """ Get a specific conversation with full message history. - GET /api/v1/chat/{chat_id} + GET /v1/chat/{chat_id} Response: { @@ -339,7 +339,7 @@ async def chat_delete_endpoint(request: Request, chat_service, session_manager): """ Delete a conversation. - DELETE /api/v1/chat/{chat_id} + DELETE /v1/chat/{chat_id} Response: {"success": true} diff --git a/src/api/v1/documents.py b/src/api/v1/documents.py index 7d03c8e2..f2a30c3c 100644 --- a/src/api/v1/documents.py +++ b/src/api/v1/documents.py @@ -23,7 +23,7 @@ async def ingest_endpoint( """ Ingest a document into the knowledge base. - POST /api/v1/documents/ingest + POST /v1/documents/ingest Request: multipart/form-data with "file" field @@ -57,7 +57,7 @@ async def task_status_endpoint(request: Request, task_service, session_manager): """ Get the status of an ingestion task. - GET /api/v1/tasks/{task_id} + GET /v1/tasks/{task_id} Response: { @@ -84,7 +84,7 @@ async def delete_document_endpoint(request: Request, document_service, session_m """ Delete a document from the knowledge base. - DELETE /api/v1/documents + DELETE /v1/documents Request body: { diff --git a/src/api/v1/search.py b/src/api/v1/search.py index 6a523fc1..807fef21 100644 --- a/src/api/v1/search.py +++ b/src/api/v1/search.py @@ -15,7 +15,7 @@ async def search_endpoint(request: Request, search_service, session_manager): """ Perform semantic search on documents. - POST /api/v1/search + POST /v1/search Request body: { diff --git a/src/api/v1/settings.py b/src/api/v1/settings.py index a4a329d7..24efcc5b 100644 --- a/src/api/v1/settings.py +++ b/src/api/v1/settings.py @@ -15,7 +15,7 @@ async def get_settings_endpoint(request: Request): """ Get current OpenRAG configuration (read-only). - GET /api/v1/settings + GET /v1/settings Response: { diff --git a/src/main.py b/src/main.py index a18e7f58..bdfa2e05 100644 --- a/src/main.py +++ b/src/main.py @@ -1313,7 +1313,7 @@ async def create_app(): # ===== Public API v1 Endpoints (API Key auth) ===== # Chat endpoints Route( - "/api/v1/chat", + "/v1/chat", require_api_key(services["api_key_service"])( partial( v1_chat.chat_create_endpoint, @@ -1324,7 +1324,7 @@ async def create_app(): methods=["POST"], ), Route( - "/api/v1/chat", + "/v1/chat", require_api_key(services["api_key_service"])( partial( v1_chat.chat_list_endpoint, @@ -1335,7 +1335,7 @@ async def create_app(): methods=["GET"], ), Route( - "/api/v1/chat/{chat_id}", + "/v1/chat/{chat_id}", require_api_key(services["api_key_service"])( partial( v1_chat.chat_get_endpoint, @@ -1346,7 +1346,7 @@ async def create_app(): methods=["GET"], ), Route( - "/api/v1/chat/{chat_id}", + "/v1/chat/{chat_id}", require_api_key(services["api_key_service"])( partial( v1_chat.chat_delete_endpoint, @@ -1358,7 +1358,7 @@ async def create_app(): ), # Search endpoint Route( - "/api/v1/search", + "/v1/search", require_api_key(services["api_key_service"])( partial( v1_search.search_endpoint, @@ -1370,7 +1370,7 @@ async def create_app(): ), # Documents endpoints Route( - "/api/v1/documents/ingest", + "/v1/documents/ingest", require_api_key(services["api_key_service"])( partial( v1_documents.ingest_endpoint, @@ -1383,7 +1383,7 @@ async def create_app(): methods=["POST"], ), Route( - "/api/v1/tasks/{task_id}", + "/v1/tasks/{task_id}", require_api_key(services["api_key_service"])( partial( v1_documents.task_status_endpoint, @@ -1394,7 +1394,7 @@ async def create_app(): methods=["GET"], ), Route( - "/api/v1/documents", + "/v1/documents", require_api_key(services["api_key_service"])( partial( v1_documents.delete_document_endpoint, @@ -1406,7 +1406,7 @@ async def create_app(): ), # Settings endpoint (read-only) Route( - "/api/v1/settings", + "/v1/settings", require_api_key(services["api_key_service"])( partial(v1_settings.get_settings_endpoint) ),