This is an automated email from the ASF dual-hosted git repository.
hsluoyz pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/casbin-gateway.git
The following commit(s) were added to refs/heads/master by this push:
new 75a58c5 fix(channel): restore the deleted upstream url helpers
75a58c5 is described below
commit 75a58c53140a75ff78375abea618fe163b5c3935
Author: Yang Luo <[email protected]>
AuthorDate: Mon Aug 17 11:30:52 2026 +0800
fix(channel): restore the deleted upstream url helpers
---
web/src/ChannelEditPage.js | 27 +++++++++++++++++++++++++++
1 file changed, 27 insertions(+)
diff --git a/web/src/ChannelEditPage.js b/web/src/ChannelEditPage.js
index 84022cc..eb899bc 100644
--- a/web/src/ChannelEditPage.js
+++ b/web/src/ChannelEditPage.js
@@ -29,6 +29,33 @@ const BASE_URL_PRESETS = {
custom: ["https://oneapi.example.com", "https://api.deepseek.com/v1",
"https://api.moonshot.cn/v1"],
};
+// The types the gateway forwards as OpenAI-formatted requests.
+const OPENAI_COMPATIBLE_TYPES = ["openai", "custom"];
+
+// Mirrors object.BuildOpenAiUrl on the server.
+function buildOpenAiUrl(baseUrl, endpoint) {
+ let url;
+ try {
+ url = new URL(baseUrl);
+ } catch {
+ return "";
+ }
+ if (url.protocol !== "http:" && url.protocol !== "https:") {
+ return "";
+ }
+
+ let path = url.pathname.replace(/\/+$/, "");
+ if (path.endsWith(endpoint)) {
+ path = path.slice(0, path.length - endpoint.length);
+ }
+ if (!path.endsWith("/v1")) {
+ path += "/v1";
+ }
+
+ url.pathname = path + endpoint;
+ return url.toString();
+}
+
const MODEL_PRESETS = {
openai: ["gpt-5.5", "gpt-5", "gpt-5-mini", "o3", "o4-mini"],
claude: ["claude-sonnet-5", "claude-opus-4-8", "claude-haiku-4-5"],
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]