mirror of
https://github.com/Ladebeze66/devsite.git
synced 2025-12-13 04:36:49 +01:00
chatbot
This commit is contained in:
parent
9dd49fcedb
commit
f5cf69f568
Binary file not shown.
|
Before Width: | Height: | Size: 697 KiB |
|
Before Width: | Height: | Size: 1.8 MiB After Width: | Height: | Size: 1.8 MiB |
27
app/components/ChatBot.js
Normal file
27
app/components/ChatBot.js
Normal file
@ -0,0 +1,27 @@
|
||||
import { useState } from "react";
|
||||
import { askAI } from "../utils/askAI";
|
||||
|
||||
export default function ChatBot() {
|
||||
const [question, setQuestion] = useState("");
|
||||
const [response, setResponse] = useState("");
|
||||
|
||||
const handleAsk = async () => {
|
||||
if (!question) return;
|
||||
const aiResponse = await askAI(question);
|
||||
setResponse(aiResponse);
|
||||
};
|
||||
|
||||
return (
|
||||
<div>
|
||||
<h2>Chat avec l'IA</h2>
|
||||
<input
|
||||
type="text"
|
||||
placeholder="Posez une question..."
|
||||
value={question}
|
||||
onChange={(e) => setQuestion(e.target.value)}
|
||||
/>
|
||||
<button onClick={handleAsk}>Envoyer</button>
|
||||
{response && <p>Réponse : {response}</p>}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@ -1,15 +1,16 @@
|
||||
import { useEffect } from "react";
|
||||
import { createPortal } from "react-dom"; // Insère la modale dans <body>
|
||||
import { getApiUrl } from "../utils/getApiUrl"; // ✅ Import de l'URL dynamique
|
||||
import CarouselCompetences from "./CarouselCompetences"; // Importation du composant CarouselCompetences
|
||||
import { createPortal } from "react-dom";
|
||||
import CarouselCompetences from "./CarouselCompetences";
|
||||
import { getApiUrl } from "../utils/getApiUrl";
|
||||
|
||||
// ✅ Définition des propriétés du composant ModalGlossaire
|
||||
interface ImageData {
|
||||
url: string;
|
||||
formats?: {
|
||||
large?: { url: string };
|
||||
};
|
||||
name?: string;
|
||||
formats?: {
|
||||
large?: {
|
||||
url: string;
|
||||
};
|
||||
};
|
||||
}
|
||||
|
||||
interface GlossaireMot {
|
||||
@ -46,26 +47,31 @@ export default function ModalGlossaire({ mot, onClose }: ModalGlossaireProps) {
|
||||
|
||||
return createPortal(
|
||||
<div className="fixed inset-0 w-screen h-screen bg-black bg-opacity-75 flex items-center justify-center z-[1000]">
|
||||
<div className="bg-white p-6 rounded-lg shadow-lg w-[90vw] max-w-4xl relative">
|
||||
<div className="bg-white/60 p-6 rounded-lg shadow-lg w-[114vw] max-w-6xl relative h-[72vh]">
|
||||
{/* Bouton de fermeture */}
|
||||
<button className="absolute top-3 right-3 text-gray-700 text-2xl" onClick={onClose}>
|
||||
<button className="absolute top-2 right-2 text-gray-700 text-sm p-1" onClick={onClose}>
|
||||
✖
|
||||
</button>
|
||||
|
||||
{/* Titre */}
|
||||
<h2 className="text-3xl font-bold mb-4">{mot.mot_clef}</h2>
|
||||
|
||||
{/* Description */}
|
||||
<p className="text-gray-700 mb-6">{mot.description}</p>
|
||||
{/* Conteneur Flexbox pour la description et le carrousel */}
|
||||
<div className="flex flex-col md:flex-row gap-6 h-full">
|
||||
{/* Description */}
|
||||
<div className="md:w-1/2">
|
||||
<h2 className="text-3xl font-orbitron-16-bold mb-4">{mot.mot_clef}</h2>
|
||||
<p className="font-orbitron-12-bold text-gray-700 mb-6">{mot.description}</p>
|
||||
</div>
|
||||
|
||||
{/* Carrousel d'images si disponible */}
|
||||
{images.length > 0 ? (
|
||||
<CarouselCompetences images={images} className="w-full h-80" />
|
||||
) : (
|
||||
<p className="text-gray-500">Aucune image disponible.</p>
|
||||
)}
|
||||
{/* Carrousel d'images si disponible */}
|
||||
<div className="md:w-1/2 h-full">
|
||||
{images.length > 0 ? (
|
||||
<CarouselCompetences images={images} className="w-full h-full" />
|
||||
) : (
|
||||
<p className="text-gray-500">Aucune image disponible.</p>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>,
|
||||
document.body
|
||||
);
|
||||
}
|
||||
}
|
||||
@ -14,28 +14,21 @@ export default function ContactPage() {
|
||||
</h1>
|
||||
|
||||
{/* Texte d'introduction */}
|
||||
<p className="bg-white/70 rounded-md font-orbitron-16 text-lg text-center border-b-4 border-blue-500 pb-2 mb-4">
|
||||
<p className="bg-white/70 rounded-md font-orbitron-16 text-lg text-center border-b-4 border-blue-500 pb-2 mb-4">
|
||||
Vous pouvez me contacter via ce formulaire ou sur mes réseaux sociaux.
|
||||
</p>
|
||||
|
||||
{/* Liens vers les réseaux sociaux mis à jour */}
|
||||
<div className="bg-white/80 rounded-mt flex justify-center space-x-4 mb-6">
|
||||
<a href="https://linkedin.com/in/votreprofil"
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
className="text-blue-500 hover:text-blue-700 font-orbitron-16-bold transition">
|
||||
LinkedIn
|
||||
</a>
|
||||
<a href="https://www.facebook.com/ton.profil"
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
className="text-blue-500 hover:text-blue-700 font-orbitron-16-bold transition">
|
||||
Facebook
|
||||
</a>
|
||||
<a href="mailto:grascalvet.fernand@gmail.com"
|
||||
className="text-blue-500 hover:text-blue-700 font-orbitron-16-bold transition">
|
||||
Email
|
||||
</a>
|
||||
{/* Informations de contact mises à jour */}
|
||||
<div className="bg-white/80 rounded-md flex flex-col items-center space-y-4 mb-6">
|
||||
<p className="text-blue-500 font-orbitron-16-bold">
|
||||
LinkedIn: Fernand Gras-Calvet
|
||||
</p>
|
||||
<p className="text-blue-500 font-orbitron-16-bold">
|
||||
Facebook: Fernand Gras-Calvet
|
||||
</p>
|
||||
<p className="text-blue-500 font-orbitron-16-bold">
|
||||
Email: grascalvet.fernand@gmail.com
|
||||
</p>
|
||||
</div>
|
||||
|
||||
{/* Formulaire de contact amélioré */}
|
||||
@ -44,4 +37,4 @@ export default function ContactPage() {
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
}
|
||||
0
app/utils/askAI.js
Normal file
0
app/utils/askAI.js
Normal file
BIN
llm-api/__pycache__/api.cpython-313.pyc
Normal file
BIN
llm-api/__pycache__/api.cpython-313.pyc
Normal file
Binary file not shown.
16
llm-api/api.py
Normal file
16
llm-api/api.py
Normal file
@ -0,0 +1,16 @@
|
||||
from fastapi import FastAPI
|
||||
import requests
|
||||
|
||||
app = FastAPI()
|
||||
|
||||
OLLAMA_API_URL = "http://localhost:11434/api/generate"
|
||||
|
||||
@app.get("/ask")
|
||||
async def ask_question(q: str):
|
||||
data = {
|
||||
"model": "mistral",
|
||||
"prompt": q,
|
||||
"stream": False
|
||||
}
|
||||
response = requests.post(OLLAMA_API_URL, json=data)
|
||||
return response.json()
|
||||
13
llm-api/web.config
Normal file
13
llm-api/web.config
Normal file
@ -0,0 +1,13 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<configuration>
|
||||
<system.webServer>
|
||||
<rewrite>
|
||||
<rules>
|
||||
<rule name="ReverseProxyInboundRule1" stopProcessing="true">
|
||||
<match url="(.*)" />
|
||||
<action type="Rewrite" url="http://localhost:8000/{R:1}" />
|
||||
</rule>
|
||||
</rules>
|
||||
</rewrite>
|
||||
</system.webServer>
|
||||
</configuration>
|
||||
Loading…
x
Reference in New Issue
Block a user