Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding changes for web to work. #314

Merged
merged 1 commit into from
Jan 27, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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();

};
};
Loading