backend /v1 frontend /api/v1 routing, sdks port 3000

This commit is contained in:
phact 2025-12-19 01:50:29 -05:00
parent 0db50a2357
commit 320973a426
9 changed files with 24 additions and 24 deletions

View file

@ -32,7 +32,7 @@ The SDK can be configured via environment variables or constructor arguments:
| Environment Variable | Constructor Argument | Description | | Environment Variable | Constructor Argument | Description |
|---------------------|---------------------|-------------| |---------------------|---------------------|-------------|
| `OPENRAG_API_KEY` | `api_key` | API key for authentication (required) | | `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 ```python
# Using environment variables # Using environment variables

View file

@ -66,7 +66,7 @@ class OpenRAGClient:
The client can be configured via constructor arguments or environment variables: The client can be configured via constructor arguments or environment variables:
- OPENRAG_API_KEY: API key for authentication - 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: Usage:
# Using environment variables # Using environment variables
@ -85,7 +85,7 @@ class OpenRAGClient:
await client.close() await client.close()
""" """
DEFAULT_BASE_URL = "http://localhost:8080" DEFAULT_BASE_URL = "http://localhost:3000"
def __init__( def __init__(
self, self,

View file

@ -33,7 +33,7 @@ The SDK can be configured via environment variables or constructor arguments:
| Environment Variable | Constructor Option | Description | | Environment Variable | Constructor Option | Description |
|---------------------|-------------------|-------------| |---------------------|-------------------|-------------|
| `OPENRAG_API_KEY` | `apiKey` | API key for authentication (required) | | `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 ```typescript
// Using environment variables // Using environment variables

View file

@ -73,7 +73,7 @@ interface RequestOptions {
* *
* The client can be configured via constructor arguments or environment variables: * The client can be configured via constructor arguments or environment variables:
* - OPENRAG_API_KEY: API key for authentication * - 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 * @example
* ```typescript * ```typescript
@ -89,7 +89,7 @@ interface RequestOptions {
* ``` * ```
*/ */
export class OpenRAGClient { 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 _apiKey: string;
private readonly _baseUrl: string; private readonly _baseUrl: string;

View file

@ -112,7 +112,7 @@ async def chat_create_endpoint(request: Request, chat_service, session_manager):
""" """
Send a chat message. Send a chat message.
POST /api/v1/chat POST /v1/chat
Request body: Request body:
{ {
@ -221,7 +221,7 @@ async def chat_list_endpoint(request: Request, chat_service, session_manager):
""" """
List all conversations for the authenticated user. List all conversations for the authenticated user.
GET /api/v1/chat GET /v1/chat
Response: 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 a specific conversation with full message history.
GET /api/v1/chat/{chat_id} GET /v1/chat/{chat_id}
Response: Response:
{ {
@ -339,7 +339,7 @@ async def chat_delete_endpoint(request: Request, chat_service, session_manager):
""" """
Delete a conversation. Delete a conversation.
DELETE /api/v1/chat/{chat_id} DELETE /v1/chat/{chat_id}
Response: Response:
{"success": true} {"success": true}

View file

@ -23,7 +23,7 @@ async def ingest_endpoint(
""" """
Ingest a document into the knowledge base. Ingest a document into the knowledge base.
POST /api/v1/documents/ingest POST /v1/documents/ingest
Request: multipart/form-data with "file" field 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 the status of an ingestion task.
GET /api/v1/tasks/{task_id} GET /v1/tasks/{task_id}
Response: Response:
{ {
@ -84,7 +84,7 @@ async def delete_document_endpoint(request: Request, document_service, session_m
""" """
Delete a document from the knowledge base. Delete a document from the knowledge base.
DELETE /api/v1/documents DELETE /v1/documents
Request body: Request body:
{ {

View file

@ -15,7 +15,7 @@ async def search_endpoint(request: Request, search_service, session_manager):
""" """
Perform semantic search on documents. Perform semantic search on documents.
POST /api/v1/search POST /v1/search
Request body: Request body:
{ {

View file

@ -15,7 +15,7 @@ async def get_settings_endpoint(request: Request):
""" """
Get current OpenRAG configuration (read-only). Get current OpenRAG configuration (read-only).
GET /api/v1/settings GET /v1/settings
Response: Response:
{ {

View file

@ -1313,7 +1313,7 @@ async def create_app():
# ===== Public API v1 Endpoints (API Key auth) ===== # ===== Public API v1 Endpoints (API Key auth) =====
# Chat endpoints # Chat endpoints
Route( Route(
"/api/v1/chat", "/v1/chat",
require_api_key(services["api_key_service"])( require_api_key(services["api_key_service"])(
partial( partial(
v1_chat.chat_create_endpoint, v1_chat.chat_create_endpoint,
@ -1324,7 +1324,7 @@ async def create_app():
methods=["POST"], methods=["POST"],
), ),
Route( Route(
"/api/v1/chat", "/v1/chat",
require_api_key(services["api_key_service"])( require_api_key(services["api_key_service"])(
partial( partial(
v1_chat.chat_list_endpoint, v1_chat.chat_list_endpoint,
@ -1335,7 +1335,7 @@ async def create_app():
methods=["GET"], methods=["GET"],
), ),
Route( Route(
"/api/v1/chat/{chat_id}", "/v1/chat/{chat_id}",
require_api_key(services["api_key_service"])( require_api_key(services["api_key_service"])(
partial( partial(
v1_chat.chat_get_endpoint, v1_chat.chat_get_endpoint,
@ -1346,7 +1346,7 @@ async def create_app():
methods=["GET"], methods=["GET"],
), ),
Route( Route(
"/api/v1/chat/{chat_id}", "/v1/chat/{chat_id}",
require_api_key(services["api_key_service"])( require_api_key(services["api_key_service"])(
partial( partial(
v1_chat.chat_delete_endpoint, v1_chat.chat_delete_endpoint,
@ -1358,7 +1358,7 @@ async def create_app():
), ),
# Search endpoint # Search endpoint
Route( Route(
"/api/v1/search", "/v1/search",
require_api_key(services["api_key_service"])( require_api_key(services["api_key_service"])(
partial( partial(
v1_search.search_endpoint, v1_search.search_endpoint,
@ -1370,7 +1370,7 @@ async def create_app():
), ),
# Documents endpoints # Documents endpoints
Route( Route(
"/api/v1/documents/ingest", "/v1/documents/ingest",
require_api_key(services["api_key_service"])( require_api_key(services["api_key_service"])(
partial( partial(
v1_documents.ingest_endpoint, v1_documents.ingest_endpoint,
@ -1383,7 +1383,7 @@ async def create_app():
methods=["POST"], methods=["POST"],
), ),
Route( Route(
"/api/v1/tasks/{task_id}", "/v1/tasks/{task_id}",
require_api_key(services["api_key_service"])( require_api_key(services["api_key_service"])(
partial( partial(
v1_documents.task_status_endpoint, v1_documents.task_status_endpoint,
@ -1394,7 +1394,7 @@ async def create_app():
methods=["GET"], methods=["GET"],
), ),
Route( Route(
"/api/v1/documents", "/v1/documents",
require_api_key(services["api_key_service"])( require_api_key(services["api_key_service"])(
partial( partial(
v1_documents.delete_document_endpoint, v1_documents.delete_document_endpoint,
@ -1406,7 +1406,7 @@ async def create_app():
), ),
# Settings endpoint (read-only) # Settings endpoint (read-only)
Route( Route(
"/api/v1/settings", "/v1/settings",
require_api_key(services["api_key_service"])( require_api_key(services["api_key_service"])(
partial(v1_settings.get_settings_endpoint) partial(v1_settings.get_settings_endpoint)
), ),