Skip to content

Commit

Permalink
Add functionality to drop baseURL if it is set to http://0.0.0.0
Browse files Browse the repository at this point in the history
  • Loading branch information
treo committed Jan 20, 2024
1 parent 5942733 commit 2b58d0c
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/lib/backend/OpenAI.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,11 @@ export function createBackend(configuration: BackendConfiguration, model: string
const temperature = 0.7;

function request(payload: any) {
return fetch(`${configuration.url}/chat/completions`, {
let baseUrl = configuration.url;
if(baseUrl.startsWith("http://0.0.0.0")){
baseUrl = "";
}
return fetch(`${baseUrl}/chat/completions`, {
method: 'POST',
body: JSON.stringify(payload),
headers: {
Expand Down

0 comments on commit 2b58d0c

Please sign in to comment.