OpenAI icon indicating copy to clipboard operation
OpenAI copied to clipboard

Add pathPrefix to Configuration

Open batanus opened this issue 3 months ago • 1 comments

What

Add pathPrefix to OpenAI.Configuration.

Why

This is needed for reverse proxy servers - for example, if the proxy server has the next path: some-proxy-server.com/api, and it will be passed as host - func buildURL(path: String) -> URL method will crash because some-proxy-server.com/api is not a valid host.

The fix for this issue is to add pathPrefix, which will be added before each path when building a URL. So in provided example, some-proxy-server.com/api will be splitter to host: "some-proxy-server.com", pathPrefix: "/api"

Affected Areas

Added new property pathPrefix to OpenAI.Configuration

batanus avatar Apr 02 '24 14:04 batanus