@mmmbuto/zai-codex-bridge 0.1.2 → 0.1.3
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 -1
package/package.json
CHANGED
package/src/server.js
CHANGED
|
@@ -181,7 +181,9 @@ function translateChatToResponses(chatResponse) {
|
|
|
181
181
|
* Make upstream request to Z.AI
|
|
182
182
|
*/
|
|
183
183
|
async function makeUpstreamRequest(path, body, headers) {
|
|
184
|
-
|
|
184
|
+
// Remove leading slash from path to preserve base URL path
|
|
185
|
+
const cleanPath = path.startsWith('/') ? path.slice(1) : path;
|
|
186
|
+
const url = new URL(cleanPath, ZAI_BASE_URL);
|
|
185
187
|
|
|
186
188
|
const upstreamHeaders = {
|
|
187
189
|
'Content-Type': 'application/json',
|
|
@@ -191,6 +193,7 @@ async function makeUpstreamRequest(path, body, headers) {
|
|
|
191
193
|
log('info', 'Upstream request:', {
|
|
192
194
|
url: url.href,
|
|
193
195
|
path: path,
|
|
196
|
+
cleanPath: cleanPath,
|
|
194
197
|
base: ZAI_BASE_URL,
|
|
195
198
|
hasAuth: !!upstreamHeaders.Authorization
|
|
196
199
|
});
|