changes
This commit is contained in:
parent
8dc1301445
commit
3e8d5115f3
@ -1,5 +1,5 @@
|
||||
# Stage 1: Build the Vue App
|
||||
FROM node:18 AS builder
|
||||
FROM node:22-alpine AS builder
|
||||
|
||||
WORKDIR /app
|
||||
COPY package.json package-lock.json ./
|
||||
@ -17,7 +17,7 @@ RUN rm -rf ./*
|
||||
COPY --from=builder /app/dist ./
|
||||
|
||||
# Nginx Config
|
||||
# COPY nginx.conf /etc/nginx/conf.d/default.conf
|
||||
COPY docker/nginx.conf /etc/nginx/conf.d/default.conf
|
||||
|
||||
EXPOSE 80
|
||||
CMD ["nginx", "-g", "daemon off;"]
|
||||
|
||||
30
docker/nginx.conf
Normal file
30
docker/nginx.conf
Normal file
@ -0,0 +1,30 @@
|
||||
server {
|
||||
listen 80;
|
||||
|
||||
# Serve Vue frontend
|
||||
location / {
|
||||
root /usr/share/nginx/html;
|
||||
index index.html;
|
||||
try_files $uri /index.html;
|
||||
}
|
||||
|
||||
# Reverse proxy for API requests
|
||||
location /search {
|
||||
proxy_pass https://192.168.99.121/search; # Backend API address
|
||||
proxy_ssl_verify off;
|
||||
proxy_set_header Host $host;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
proxy_set_header X-Forwarded-Proto $scheme;
|
||||
|
||||
# CORS headers
|
||||
add_header 'Access-Control-Allow-Origin' '*' always;
|
||||
add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS, PUT, DELETE' always;
|
||||
add_header 'Access-Control-Allow-Headers' 'Authorization, Content-Type' always;
|
||||
|
||||
# Handle preflight OPTIONS requests
|
||||
if ($request_method = OPTIONS) {
|
||||
return 204;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -57,25 +57,26 @@ const goToSearchPage=()=>{
|
||||
}
|
||||
|
||||
onMounted(()=>{
|
||||
fetchData("/search","POST",query).then(response =>{
|
||||
console.log("macdonals query: ", query)
|
||||
console.log("macdonals query: ", query.search_type)
|
||||
let requestType="POST";
|
||||
if (query.search_type==="semantic"){
|
||||
requestType = "GET"
|
||||
}
|
||||
fetchData("/search",requestType,query).then(response =>{
|
||||
|
||||
console.log("response kk:", response)
|
||||
//console.log("responseData start dolphine: ", typeof responseData.value.data.length)
|
||||
console.log("responseData start dolphine: ", response)
|
||||
if (response.data.length===0){
|
||||
|
||||
console.log("responseData.value 12: ", responseData.value)
|
||||
|
||||
responseData.value=""
|
||||
console.log("responseData.value 13: ", responseData.value)
|
||||
|
||||
}
|
||||
else {
|
||||
responseData.value = response
|
||||
keys_of_a_data.value = Object.keys(response.data[0])
|
||||
|
||||
|
||||
const test = Object.keys(response.data[0].metadata)
|
||||
|
||||
const test2 = Object.keys(response.data[0].search)
|
||||
|
||||
keys_of_a_data.value.forEach((item, index)=>{
|
||||
|
||||
arr_col_items.value.push(...Object.keys(response.data[0][item]))
|
||||
@ -86,7 +87,7 @@ onMounted(()=>{
|
||||
const values:any[]=[]
|
||||
|
||||
Object.keys(item).forEach(key=>{
|
||||
console.log("key12: ", key)
|
||||
|
||||
values.push(...Object.values(item[key]))
|
||||
|
||||
})
|
||||
|
||||
@ -1,7 +0,0 @@
|
||||
<script setup lang="ts">
|
||||
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<p>Home page</p>
|
||||
</template>
|
||||
@ -1,5 +1,5 @@
|
||||
export const fetchData = async(endpoints="", requestType="GET", requestBody:Record<string,any>|null =null)=>{
|
||||
|
||||
console.log("superman,requestType, requestBody stars: ", requestType,requestBody)
|
||||
try{
|
||||
const options:RequestInit={
|
||||
method:requestType,
|
||||
@ -16,12 +16,14 @@ export const fetchData = async(endpoints="", requestType="GET", requestBody:Reco
|
||||
|
||||
}
|
||||
|
||||
let response;
|
||||
if (requestBody?.search_type==="semantic"){
|
||||
response = await fetch("/recommend", options)
|
||||
}
|
||||
else {
|
||||
|
||||
|
||||
console.log("callign endpoints: ", endpoints)
|
||||
// const response = await fetch(`${endpoints}`, options)
|
||||
const response = await fetch("https://192.168.99.121/search", options)
|
||||
|
||||
response = await fetch("/search", options)
|
||||
}
|
||||
if (!response.ok){
|
||||
throw new Error(`HTTP error! Status: ${response.status}`)
|
||||
}
|
||||
|
||||
@ -13,6 +13,11 @@ export default defineConfig({
|
||||
changeOrigin: true,
|
||||
secure: false, // Ignores SSL certificate issues
|
||||
},
|
||||
"/recommend": {
|
||||
target: "https://192.168.99.121",
|
||||
changeOrigin: true,
|
||||
secure: false, // Ignores SSL certificate issues
|
||||
},
|
||||
},
|
||||
},
|
||||
plugins: [
|
||||
|
||||
Loading…
Reference in New Issue
Block a user