up testing api page
This commit is contained in:
parent
b9abd0883d
commit
74fa59a2e1
5 changed files with 177 additions and 7 deletions
83
sae-csc/deployment/Dockerfile
Normal file
83
sae-csc/deployment/Dockerfile
Normal file
|
@ -0,0 +1,83 @@
|
|||
# servir une application angular buildée
|
||||
|
||||
# qui utilise la lib sae Aero
|
||||
|
||||
# - relier la lib my_workspace
|
||||
|
||||
# - build de l'app angular
|
||||
|
||||
# - servir le build
|
||||
|
||||
# Use official Node.js LTS image
|
||||
|
||||
FROM node:24-alpine AS build
|
||||
|
||||
# Set working directory
|
||||
|
||||
WORKDIR /usr/src/app
|
||||
|
||||
# Create a non-root user
|
||||
|
||||
RUN addgroup -S appgroup && adduser -S appuser -G appgroup
|
||||
|
||||
# Copy package.json and package-lock.json as root and install dependencies
|
||||
|
||||
COPY package*.json ./
|
||||
|
||||
# Copy app source and fix ownership
|
||||
|
||||
COPY . .
|
||||
|
||||
RUN chown -R appuser:appgroup /usr/src/app
|
||||
|
||||
RUN pwd
|
||||
|
||||
RUN cd /usr/src/app/my-workspace/projects/sae-lib
|
||||
|
||||
RUN npm link
|
||||
|
||||
# Switch to non-root user
|
||||
|
||||
USER appuser
|
||||
|
||||
RUN pwd
|
||||
|
||||
RUN cd ../../../../../
|
||||
|
||||
RUN npm link sae-lib
|
||||
|
||||
RUN npm install
|
||||
|
||||
RUN npm run build
|
||||
|
||||
RUN echo "building done"
|
||||
|
||||
# Add healthcheck (tries every 30s, times out after 10s, fails after 3 retries)
|
||||
|
||||
# HEALTHCHECK --interval=30s --timeout=10s --retries=3 \
|
||||
|
||||
# CMD wget -qO- http://localhost:8080/ || exit 1
|
||||
|
||||
# ============================
|
||||
|
||||
# 🚀 Stage 2 — Serve with NGINX
|
||||
|
||||
# ============================
|
||||
|
||||
FROM nginx:1.29-alpine AS serve
|
||||
|
||||
# Remove default NGINX website
|
||||
|
||||
RUN rm -rf /usr/share/nginx/html/*
|
||||
|
||||
# Copy built Angular app from previous stage
|
||||
|
||||
COPY --from=build /app/dist/implem /usr/share/nginx/html
|
||||
|
||||
# Expose port 80
|
||||
|
||||
EXPOSE 80
|
||||
|
||||
# Start NGINX
|
||||
|
||||
CMD ["nginx", "-g", "daemon off;"]
|
|
@ -4,7 +4,7 @@
|
|||
<div class="columns">
|
||||
<div class="column">
|
||||
|
||||
/app/summarize_questions
|
||||
<!-- /app/summarize_questions
|
||||
/app/get_keyword_from_email
|
||||
/app/search_engine
|
||||
/app/query_simple
|
||||
|
@ -12,7 +12,33 @@
|
|||
/app/esm_detect
|
||||
/app/hardware_detect
|
||||
/app/esm_content_analyse
|
||||
/app/ai_filter
|
||||
/app/ai_filter -->
|
||||
|
||||
backend:
|
||||
<input [(ngModel)]="backend" type="text">
|
||||
|
||||
<sae-m-button [kind]="'primary'" class="button" label='summarize_questions' (click)="summarizeQuestions()">
|
||||
</sae-m-button>
|
||||
<sae-m-button [kind]="'primary'" class="button" label='get_keyword_from_email' (click)="getKeywordFromEmail()"></sae-m-button>
|
||||
|
||||
<sae-m-button [kind]="'primary'" class="button" label='search_engine' (click)="searchEngine()">
|
||||
</sae-m-button>
|
||||
<sae-m-button [kind]="'primary'" class="button" label='query_simple' (click)="querySimple()">
|
||||
|
||||
</sae-m-button>
|
||||
<sae-m-button [kind]="'primary'" class="button" label='dica_detect' (click)="dicaDetect()">
|
||||
</sae-m-button>
|
||||
|
||||
<sae-m-button [kind]="'primary'" class="button" label='esm_detect' (click)="esmDetect()">
|
||||
</sae-m-button>
|
||||
|
||||
<sae-m-button [kind]="'primary'" class="button" label='hardware_detect' (click)="hardwareDetect()">
|
||||
</sae-m-button>
|
||||
|
||||
<sae-m-button [kind]="'primary'" class="button" label='esm_content_analyse' (click)="esmContentAnalyse()">
|
||||
</sae-m-button>
|
||||
<sae-m-button [kind]="'primary'" class="button" label='ai_filter' (click)="aiFilter()">
|
||||
</sae-m-button>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
@ -35,14 +61,14 @@
|
|||
</section>
|
||||
<section>
|
||||
|
||||
<br>
|
||||
|
||||
<h2>
|
||||
Post /api/v1/messages
|
||||
</h2>
|
||||
|
||||
entrez votre message:
|
||||
<input [(ngModel)]="input" type="text">
|
||||
<br>
|
||||
|
||||
<sae-m-button
|
||||
(click)="sendMessage()"
|
||||
[kind]="'primary'"
|
||||
|
@ -52,7 +78,7 @@
|
|||
<sae-bot-talks [message]="message">
|
||||
</sae-bot-talks>
|
||||
</section>
|
||||
<br>
|
||||
|
||||
|
||||
</div>
|
||||
<div class="column">
|
||||
|
@ -78,7 +104,7 @@
|
|||
<section>
|
||||
|
||||
<h2>Envoi de fichier</h2>
|
||||
<!-- <br>-->
|
||||
<!-- -->
|
||||
<sae-m-button
|
||||
(click)="sendFile()"
|
||||
class="button" kind="secondary"
|
||||
|
|
|
@ -25,4 +25,8 @@
|
|||
border: 1px solid #ccc;
|
||||
padding: 1rem;
|
||||
}
|
||||
sae-m-button {
|
||||
margin-top: 1rem;
|
||||
margin-right: 1rem;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -115,4 +115,61 @@ export class TestingApi {
|
|||
getUserConversations() {
|
||||
console.log('getUserConversations TODO')
|
||||
}
|
||||
summarizeQuestions() {
|
||||
console.log('summarizeQuestions TODO')
|
||||
fetch(`http://${this.backend}/app/summarize_questions`, {
|
||||
method: "POST",
|
||||
mode: "cors",
|
||||
body: JSON.stringify({
|
||||
question: "What are the main causes of engine failures in Boeing 737?"
|
||||
}),
|
||||
headers: defaultHeaders
|
||||
})
|
||||
.then(response => response.json())
|
||||
.then(data => {
|
||||
console.log(data);
|
||||
this.response = JSON.stringify(data);
|
||||
}
|
||||
)
|
||||
.catch(error => console.error('Error:', error));
|
||||
}
|
||||
getKeywordFromEmail() {
|
||||
console.log('getKeywordFromEmail TODO')
|
||||
fetch(`http://${this.backend}/app/get_keyword_from_email`, {
|
||||
method: "POST",
|
||||
mode: "cors",
|
||||
body: JSON.stringify({
|
||||
email: "test@test.com"
|
||||
}),
|
||||
headers: defaultHeaders
|
||||
})
|
||||
.then(response => response.json())
|
||||
.then(data => {
|
||||
console.log(data);
|
||||
this.response = JSON.stringify(data);
|
||||
}
|
||||
)
|
||||
.catch(error => console.error('Error:', error));
|
||||
}
|
||||
esmDetect() {
|
||||
console.log('esmDetect TODO')
|
||||
}
|
||||
hardwareDetect() {
|
||||
console.log('hardwareDetect TODO')
|
||||
}
|
||||
esmContentAnalyse() {
|
||||
console.log('esmContentAnalyse TODO')
|
||||
}
|
||||
aiFilter() {
|
||||
console.log('aiFilter TODO')
|
||||
}
|
||||
searchEngine() {
|
||||
console.log('searchEngine TODO')
|
||||
}
|
||||
querySimple() {
|
||||
console.log('querySimple TODO')
|
||||
}
|
||||
dicaDetect() {
|
||||
console.log('dicaDetect TODO')
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue