backend /v1 frontend /api/v1 routing, sdks port 3000
This commit is contained in:
parent
0db50a2357
commit
320973a426
9 changed files with 24 additions and 24 deletions
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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,
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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}
|
||||
|
|
|
|||
|
|
@ -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:
|
||||
{
|
||||
|
|
|
|||
|
|
@ -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:
|
||||
{
|
||||
|
|
|
|||
|
|
@ -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:
|
||||
{
|
||||
|
|
|
|||
18
src/main.py
18
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)
|
||||
),
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue