Skip to content

Commit

Permalink
fix(server): compatible with gateway.ai.cloudflare.com (#2029)
Browse files Browse the repository at this point in the history
  • Loading branch information
mylukin committed Mar 6, 2024
1 parent 15903fa commit c520580
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions service/src/chatgpt/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,13 @@ let api: ChatGPTAPI | ChatGPTUnofficialProxyAPI
}
}

if (isNotEmptyString(OPENAI_API_BASE_URL))
options.apiBaseUrl = `${OPENAI_API_BASE_URL}/v1`
if (isNotEmptyString(OPENAI_API_BASE_URL)) {
// if find /v1 in OPENAI_API_BASE_URL then use it
if (OPENAI_API_BASE_URL.includes('/v1'))
options.apiBaseUrl = `${OPENAI_API_BASE_URL}`
else
options.apiBaseUrl = `${OPENAI_API_BASE_URL}/v1`
}

setupProxy(options)

Expand Down

0 comments on commit c520580

Please sign in to comment.