Skip to content

Commit

Permalink
Merge pull request #1640 from janhq/j/fix-cors
Browse files Browse the repository at this point in the history
fix: cors
  • Loading branch information
namchuai authored Nov 7, 2024
2 parents 58fc107 + 229be62 commit 086de70
Show file tree
Hide file tree
Showing 31 changed files with 830 additions and 255 deletions.
136 changes: 127 additions & 9 deletions docs/static/openapi/cortex.json
Original file line number Diff line number Diff line change
Expand Up @@ -1142,7 +1142,8 @@
"required": true,
"schema": {
"type": "string",
"enum": ["onnxruntime", "llama-cpp", "tensorrt-llm"]
"enum": ["llama-cpp", "onnxruntime", "tensorrt-llm"],
"default": "llama-cpp"
},
"description": "The type of engine"
}
Expand Down Expand Up @@ -1200,7 +1201,8 @@
"required": true,
"schema": {
"type": "string",
"enum": ["onnxruntime", "llama-cpp", "tensorrt-llm"]
"enum": ["llama-cpp", "onnxruntime", "tensorrt-llm"],
"default": "llama-cpp"
},
"description": "The type of engine"
},
Expand Down Expand Up @@ -1245,7 +1247,8 @@
"required": true,
"schema": {
"type": "string",
"enum": ["onnxruntime", "llama-cpp", "tensorrt-llm"]
"enum": ["llama-cpp", "onnxruntime", "tensorrt-llm"],
"default": "llama-cpp"
},
"description": "The type of engine"
},
Expand Down Expand Up @@ -1335,7 +1338,8 @@
"required": true,
"schema": {
"type": "string",
"enum": ["onnxruntime", "llama-cpp", "tensorrt-llm"]
"enum": ["llama-cpp", "onnxruntime", "tensorrt-llm"],
"default": "llama-cpp"
},
"description": "The type of engine"
}
Expand Down Expand Up @@ -1378,7 +1382,8 @@
"required": true,
"schema": {
"type": "string",
"enum": ["onnxruntime", "llama-cpp", "tensorrt-llm"]
"enum": ["llama-cpp", "onnxruntime", "tensorrt-llm"],
"default": "llama-cpp"
},
"description": "The type of engine"
},
Expand Down Expand Up @@ -1433,7 +1438,8 @@
"required": true,
"schema": {
"type": "string",
"enum": ["onnxruntime", "llama-cpp", "tensorrt-llm"]
"enum": ["llama-cpp", "onnxruntime", "tensorrt-llm"],
"default": "llama-cpp"
},
"description": "The name of the engine to update"
}
Expand Down Expand Up @@ -1468,7 +1474,8 @@
"required": true,
"schema": {
"type": "string",
"enum": ["onnxruntime", "llama-cpp", "tensorrt-llm"]
"enum": ["llama-cpp", "onnxruntime", "tensorrt-llm"],
"default": "llama-cpp"
},
"description": "The name of the engine to update"
}
Expand Down Expand Up @@ -1505,7 +1512,8 @@
"required": true,
"schema": {
"type": "string",
"enum": ["onnxruntime", "llama-cpp", "tensorrt-llm"]
"enum": ["llama-cpp", "onnxruntime", "tensorrt-llm"],
"default": "llama-cpp"
},
"description": "The name of the engine to update"
}
Expand All @@ -1530,6 +1538,111 @@
},
"tags": ["Engines"]
}
},
"/v1/configs": {
"get": {
"summary": "Get Configurations",
"description": "Retrieves the current configuration settings of the Cortex server.",
"responses": {
"200": {
"description": "Successful response",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"allowed_origins": {
"type": "array",
"items": {
"type": "string"
},
"example": ["http://localhost:39281", "https://cortex.so"]
},
"cors": {
"type": "boolean",
"example": false
}
}
},
"example": {
"allowed_origins": [
"http://localhost:39281",
"https://cortex.so"
],
"cors": false
}
}
}
}
},
"tags": ["Configurations"]
},
"patch": {
"tags": ["Configurations"],
"summary": "Update configuration settings",
"requestBody": {
"required": true,
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"cors": {
"type": "boolean",
"description": "Indicates whether CORS is enabled.",
"example": false
},
"allowed_origins": {
"type": "array",
"items": {
"type": "string"
},
"description": "List of allowed origins.",
"example": ["http://localhost:39281", "https://cortex.so"]
}
}
}
}
}
},
"responses": {
"200": {
"description": "Configuration updated successfully",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"config": {
"type": "object",
"properties": {
"allowed_origins": {
"type": "array",
"items": {
"type": "string"
},
"example": [
"http://localhost:39281",
"https://cortex.so"
]
},
"cors": {
"type": "boolean",
"example": false
}
}
},
"message": {
"type": "string",
"example": "Configuration updated successfully"
}
}
}
}
}
}
}
}
}
},
"info": {
Expand Down Expand Up @@ -1559,6 +1672,10 @@
"name": "Server",
"description": "These endpoints manage the lifecycle of Server, including heath check and shutdown."
},
{
"name": "Configuration",
"description": "These endpoints manage the configuration of the Cortex server."
},
{
"name": "Messages",
"description": "These endpoints manage the retrieval and storage of conversation content, including responses from LLMs and other metadata related to chat interactions."
Expand Down Expand Up @@ -1587,7 +1704,8 @@
"Running Models",
"Processes",
"Status",
"Server"
"Server",
"Configurations"
]
}
],
Expand Down
5 changes: 0 additions & 5 deletions engine/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,6 @@ if(MSVC)
)
endif()

if(DEBUG)
message(STATUS "CORTEX-CPP DEBUG IS ON")
add_compile_definitions(ALLOW_ALL_CORS)
endif()

if(NOT DEFINED CORTEX_VARIANT)
set(CORTEX_VARIANT "prod")
endif()
Expand Down
83 changes: 0 additions & 83 deletions engine/addon.cc

This file was deleted.

5 changes: 0 additions & 5 deletions engine/cli/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,6 @@ if(MSVC)
)
endif()

if(DEBUG)
message(STATUS "CORTEX-CPP DEBUG IS ON")
add_compile_definitions(ALLOW_ALL_CORS)
endif()

if(NOT DEFINED CORTEX_VARIANT)
set(CORTEX_VARIANT "prod")
endif()
Expand Down
Loading

0 comments on commit 086de70

Please sign in to comment.