yaze 0.3.2
Link to the Past ROM Editor
 
Loading...
Searching...
No Matches
ai_config_utils.h
Go to the documentation of this file.
1#ifndef YAZE_SRC_CLI_SERVICE_AI_AI_CONFIG_UTILS_H_
2#define YAZE_SRC_CLI_SERVICE_AI_AI_CONFIG_UTILS_H_
3
4#include <string>
5
6#include "absl/strings/match.h"
7
8namespace yaze {
9namespace cli {
10
11inline std::string NormalizeOpenAiBaseUrl(std::string base) {
12 if (base.empty()) {
13 return "https://api.openai.com";
14 }
15 while (!base.empty() && base.back() == '/') {
16 base.pop_back();
17 }
18 if (absl::EndsWith(base, "/v1")) {
19 base.resize(base.size() - 3);
20 while (!base.empty() && base.back() == '/') {
21 base.pop_back();
22 }
23 }
24 return base;
25}
26
27} // namespace cli
28} // namespace yaze
29
30#endif // YAZE_SRC_CLI_SERVICE_AI_AI_CONFIG_UTILS_H_
std::string NormalizeOpenAiBaseUrl(std::string base)