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

Commit ab408c9

Browse files
committed
feat: prelight handler for inferences endpoints
1 parent 0a9a1bd commit ab408c9

File tree

1 file changed

+10
-12
lines changed

1 file changed

+10
-12
lines changed

controllers/prelight.h

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -4,17 +4,15 @@
44

55
using namespace drogon;
66

7-
class prelight : public drogon::HttpController<prelight>
8-
{
9-
public:
10-
METHOD_LIST_BEGIN
11-
// use METHOD_ADD to add your custom processing function here;
12-
// METHOD_ADD(prelight::get, "/{2}/{1}", Get); // path is /prelight/{arg2}/{arg1}
13-
// METHOD_ADD(prelight::your_method_name, "/{1}/{2}/list", Get); // path is /prelight/{arg1}/{arg2}/list
14-
// ADD_METHOD_TO(prelight::your_method_name, "/absolute/path/{1}/{2}/list", Get); // path is /absolute/path/{arg1}/{arg2}/list
7+
class prelight : public drogon::HttpController<prelight> {
8+
public:
9+
METHOD_LIST_BEGIN
10+
ADD_METHOD_TO(prelight::handlePrelight, "/v1/chat/completions", Options);
11+
ADD_METHOD_TO(prelight::handlePrelight, "/v1/embeddings", Options);
12+
ADD_METHOD_TO(prelight::handlePrelight, "/v1/audio/transcriptions", Options);
13+
ADD_METHOD_TO(prelight::handlePrelight, "/v1/audio/translations", Options);
14+
METHOD_LIST_END
1515

16-
METHOD_LIST_END
17-
// your declaration of processing function maybe like this:
18-
// void get(const HttpRequestPtr& req, std::function<void (const HttpResponsePtr &)> &&callback, int p1, std::string p2);
19-
// void your_method_name(const HttpRequestPtr& req, std::function<void (const HttpResponsePtr &)> &&callback, double p1, int p2) const;
16+
void handlePrelight(const HttpRequestPtr &req,
17+
std::function<void(const HttpResponsePtr &)> &&callback);
2018
};

0 commit comments

Comments
 (0)