@mmmbuto/zai-codex-bridge 0.1.3 → 0.1.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/server.js +4 -2
package/package.json
CHANGED
package/src/server.js
CHANGED
|
@@ -181,9 +181,11 @@ function translateChatToResponses(chatResponse) {
|
|
|
181
181
|
* Make upstream request to Z.AI
|
|
182
182
|
*/
|
|
183
183
|
async function makeUpstreamRequest(path, body, headers) {
|
|
184
|
-
//
|
|
184
|
+
// Ensure base URL ends with / for proper path concatenation
|
|
185
|
+
const baseUrl = ZAI_BASE_URL.endsWith('/') ? ZAI_BASE_URL : ZAI_BASE_URL + '/';
|
|
186
|
+
// Remove leading slash from path to avoid replacing base URL path
|
|
185
187
|
const cleanPath = path.startsWith('/') ? path.slice(1) : path;
|
|
186
|
-
const url = new URL(cleanPath,
|
|
188
|
+
const url = new URL(cleanPath, baseUrl);
|
|
187
189
|
|
|
188
190
|
const upstreamHeaders = {
|
|
189
191
|
'Content-Type': 'application/json',
|