Skip to content
This repository was archived by the owner on Jul 4, 2025. It is now read-only.

Commit 086de70

Browse files
authored
Merge pull request #1640 from janhq/j/fix-cors
fix: cors
2 parents 58fc107 + 229be62 commit 086de70

31 files changed

+830
-255
lines changed

docs/static/openapi/cortex.json

Lines changed: 127 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1142,7 +1142,8 @@
11421142
"required": true,
11431143
"schema": {
11441144
"type": "string",
1145-
"enum": ["onnxruntime", "llama-cpp", "tensorrt-llm"]
1145+
"enum": ["llama-cpp", "onnxruntime", "tensorrt-llm"],
1146+
"default": "llama-cpp"
11461147
},
11471148
"description": "The type of engine"
11481149
}
@@ -1200,7 +1201,8 @@
12001201
"required": true,
12011202
"schema": {
12021203
"type": "string",
1203-
"enum": ["onnxruntime", "llama-cpp", "tensorrt-llm"]
1204+
"enum": ["llama-cpp", "onnxruntime", "tensorrt-llm"],
1205+
"default": "llama-cpp"
12041206
},
12051207
"description": "The type of engine"
12061208
},
@@ -1245,7 +1247,8 @@
12451247
"required": true,
12461248
"schema": {
12471249
"type": "string",
1248-
"enum": ["onnxruntime", "llama-cpp", "tensorrt-llm"]
1250+
"enum": ["llama-cpp", "onnxruntime", "tensorrt-llm"],
1251+
"default": "llama-cpp"
12491252
},
12501253
"description": "The type of engine"
12511254
},
@@ -1335,7 +1338,8 @@
13351338
"required": true,
13361339
"schema": {
13371340
"type": "string",
1338-
"enum": ["onnxruntime", "llama-cpp", "tensorrt-llm"]
1341+
"enum": ["llama-cpp", "onnxruntime", "tensorrt-llm"],
1342+
"default": "llama-cpp"
13391343
},
13401344
"description": "The type of engine"
13411345
}
@@ -1378,7 +1382,8 @@
13781382
"required": true,
13791383
"schema": {
13801384
"type": "string",
1381-
"enum": ["onnxruntime", "llama-cpp", "tensorrt-llm"]
1385+
"enum": ["llama-cpp", "onnxruntime", "tensorrt-llm"],
1386+
"default": "llama-cpp"
13821387
},
13831388
"description": "The type of engine"
13841389
},
@@ -1433,7 +1438,8 @@
14331438
"required": true,
14341439
"schema": {
14351440
"type": "string",
1436-
"enum": ["onnxruntime", "llama-cpp", "tensorrt-llm"]
1441+
"enum": ["llama-cpp", "onnxruntime", "tensorrt-llm"],
1442+
"default": "llama-cpp"
14371443
},
14381444
"description": "The name of the engine to update"
14391445
}
@@ -1468,7 +1474,8 @@
14681474
"required": true,
14691475
"schema": {
14701476
"type": "string",
1471-
"enum": ["onnxruntime", "llama-cpp", "tensorrt-llm"]
1477+
"enum": ["llama-cpp", "onnxruntime", "tensorrt-llm"],
1478+
"default": "llama-cpp"
14721479
},
14731480
"description": "The name of the engine to update"
14741481
}
@@ -1505,7 +1512,8 @@
15051512
"required": true,
15061513
"schema": {
15071514
"type": "string",
1508-
"enum": ["onnxruntime", "llama-cpp", "tensorrt-llm"]
1515+
"enum": ["llama-cpp", "onnxruntime", "tensorrt-llm"],
1516+
"default": "llama-cpp"
15091517
},
15101518
"description": "The name of the engine to update"
15111519
}
@@ -1530,6 +1538,111 @@
15301538
},
15311539
"tags": ["Engines"]
15321540
}
1541+
},
1542+
"/v1/configs": {
1543+
"get": {
1544+
"summary": "Get Configurations",
1545+
"description": "Retrieves the current configuration settings of the Cortex server.",
1546+
"responses": {
1547+
"200": {
1548+
"description": "Successful response",
1549+
"content": {
1550+
"application/json": {
1551+
"schema": {
1552+
"type": "object",
1553+
"properties": {
1554+
"allowed_origins": {
1555+
"type": "array",
1556+
"items": {
1557+
"type": "string"
1558+
},
1559+
"example": ["http://localhost:39281", "https://cortex.so"]
1560+
},
1561+
"cors": {
1562+
"type": "boolean",
1563+
"example": false
1564+
}
1565+
}
1566+
},
1567+
"example": {
1568+
"allowed_origins": [
1569+
"http://localhost:39281",
1570+
"https://cortex.so"
1571+
],
1572+
"cors": false
1573+
}
1574+
}
1575+
}
1576+
}
1577+
},
1578+
"tags": ["Configurations"]
1579+
},
1580+
"patch": {
1581+
"tags": ["Configurations"],
1582+
"summary": "Update configuration settings",
1583+
"requestBody": {
1584+
"required": true,
1585+
"content": {
1586+
"application/json": {
1587+
"schema": {
1588+
"type": "object",
1589+
"properties": {
1590+
"cors": {
1591+
"type": "boolean",
1592+
"description": "Indicates whether CORS is enabled.",
1593+
"example": false
1594+
},
1595+
"allowed_origins": {
1596+
"type": "array",
1597+
"items": {
1598+
"type": "string"
1599+
},
1600+
"description": "List of allowed origins.",
1601+
"example": ["http://localhost:39281", "https://cortex.so"]
1602+
}
1603+
}
1604+
}
1605+
}
1606+
}
1607+
},
1608+
"responses": {
1609+
"200": {
1610+
"description": "Configuration updated successfully",
1611+
"content": {
1612+
"application/json": {
1613+
"schema": {
1614+
"type": "object",
1615+
"properties": {
1616+
"config": {
1617+
"type": "object",
1618+
"properties": {
1619+
"allowed_origins": {
1620+
"type": "array",
1621+
"items": {
1622+
"type": "string"
1623+
},
1624+
"example": [
1625+
"http://localhost:39281",
1626+
"https://cortex.so"
1627+
]
1628+
},
1629+
"cors": {
1630+
"type": "boolean",
1631+
"example": false
1632+
}
1633+
}
1634+
},
1635+
"message": {
1636+
"type": "string",
1637+
"example": "Configuration updated successfully"
1638+
}
1639+
}
1640+
}
1641+
}
1642+
}
1643+
}
1644+
}
1645+
}
15331646
}
15341647
},
15351648
"info": {
@@ -1559,6 +1672,10 @@
15591672
"name": "Server",
15601673
"description": "These endpoints manage the lifecycle of Server, including heath check and shutdown."
15611674
},
1675+
{
1676+
"name": "Configuration",
1677+
"description": "These endpoints manage the configuration of the Cortex server."
1678+
},
15621679
{
15631680
"name": "Messages",
15641681
"description": "These endpoints manage the retrieval and storage of conversation content, including responses from LLMs and other metadata related to chat interactions."
@@ -1587,7 +1704,8 @@
15871704
"Running Models",
15881705
"Processes",
15891706
"Status",
1590-
"Server"
1707+
"Server",
1708+
"Configurations"
15911709
]
15921710
}
15931711
],

engine/CMakeLists.txt

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -30,11 +30,6 @@ if(MSVC)
3030
)
3131
endif()
3232

33-
if(DEBUG)
34-
message(STATUS "CORTEX-CPP DEBUG IS ON")
35-
add_compile_definitions(ALLOW_ALL_CORS)
36-
endif()
37-
3833
if(NOT DEFINED CORTEX_VARIANT)
3934
set(CORTEX_VARIANT "prod")
4035
endif()

engine/addon.cc

Lines changed: 0 additions & 83 deletions
This file was deleted.

engine/cli/CMakeLists.txt

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,11 +28,6 @@ if(MSVC)
2828
)
2929
endif()
3030

31-
if(DEBUG)
32-
message(STATUS "CORTEX-CPP DEBUG IS ON")
33-
add_compile_definitions(ALLOW_ALL_CORS)
34-
endif()
35-
3631
if(NOT DEFINED CORTEX_VARIANT)
3732
set(CORTEX_VARIANT "prod")
3833
endif()

0 commit comments

Comments
 (0)