Skip to content

Commit

Permalink
Merge pull request #314 from marlenezw/web_fix
Browse files Browse the repository at this point in the history
Adding changes for web to work.
  • Loading branch information
marlenezw authored Jan 27, 2025
2 parents b86811d + 2f91b14 commit 7e4d496
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 10 deletions.
2 changes: 1 addition & 1 deletion infra/ai.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,4 @@ deployments:
version: "2024-07-18"
sku:
name: "Standard"
capacity: 8
capacity: 10
8 changes: 3 additions & 5 deletions src/web/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,7 @@ WORKDIR /app
COPY --from=ui /app/dist/* ./
COPY --from=ui /app/dist/assets/* ./assets/

COPY ./nginx/nginx.conf /etc/nginx/conf.d/default.conf
COPY ./nginx/run_nginx.sh /bin/run_nginx.sh

EXPOSE 80
RUN ["chmod", "+x", "/bin/run_nginx.sh"]
CMD ["/bin/run_nginx.sh"]

COPY ./nginx/nginx.conf /nginx.conf.template
CMD ["/bin/sh" , "-c" , "envsubst < /nginx.conf.template > /etc/nginx/conf.d/default.conf && exec nginx -g 'daemon off;'"]
7 changes: 6 additions & 1 deletion src/web/nginx/nginx.conf
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,11 @@ server {
location / {
root /app;
index index.html index.htm;
try_files $uri $uri/ /index.html =404;
}

location /api {
proxy_ssl_server_name on;
proxy_http_version 1.1;
proxy_pass '${API_ENDPOINT}';
}
}
7 changes: 4 additions & 3 deletions src/web/src/store/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,11 +57,12 @@ export const startWritingTask = (

const url = `${
endpoint.endsWith("/") ? endpoint : endpoint + "/"
}api/article`;
}`;
console.log(url);

const callApi = async () => {
try {
const response = await fetch(url, configuration);
const response = await fetch("/api/article", configuration);
const reader = response.body?.getReader();
if (!reader) return;

Expand Down Expand Up @@ -96,4 +97,4 @@ export const startWritingTask = (

callApi();

};
};

0 comments on commit 7e4d496

Please sign in to comment.