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
8
namespace
yaze
{
9
namespace
cli {
10
11
inline
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_
yaze::cli::NormalizeOpenAiBaseUrl
std::string NormalizeOpenAiBaseUrl(std::string base)
Definition
ai_config_utils.h:11
yaze
Definition
patch_export_usage.cc:8
src
cli
service
ai
ai_config_utils.h
Generated by
1.10.0