MVP V1: Implemented workflow
Browse filesFiles changed (4)
- app.py+1-1
- index.html+42-3
- schemas.py+1
- static/script.js+363-59
358 unmodified lines359360361362363364365358 unmodified linesrequirements = req.requirementsquery = req.queryrequirements_text = "\n".join([f"[Selection ID: {x} | Document: {r.document} | Context: {r.context} | Requirement: {r.requirement}]" for x, r in enumerate(requirements)])print("Called the LLM")resp_ai = llm_router.completion(358 unmodified lines359360361362363364365358 unmodified linesrequirements = req.requirementsquery = req.queryrequirements_text = "\n".join([f"[Selection ID: {r.i} | Document: {r.document} | Context: {r.context} | Requirement: {r.requirement}]" for r in requirements])print("Called the LLM")resp_ai = llm_router.completion(
89 unmodified lines90919293949596979889 unmodified lines</table></div><div class="w-full max-w-[100%] mx-auto p-6 hidden" id="carousels"><h1 class="text-xl font-bold mb-8 text-center">Liste des catégories de requirements</h1></div><center>89 unmodified lines9091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613789 unmodified lines</table></div><div id="categorizeReqContainer" class="hidden"><div class="w-full max-w-[100%] mx-auto p-6" id="carousels"><h1 class="text-xl font-bold mb-8 text-center">Requirements categories list</h1></div><div class="w-full max-w-[100%] mx-auto px-6 pb-6" id="catReqActions"><div class="flex items-center justify-center gap-4 flex-wrap"><!-- Checkbox et Input Limite --><div class="flex items-center gap-2"><inputtype="number"id="limitInput"placeholder="10"min="1"max="9999"class="w-20 px-2 py-1 text-sm border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-transparent"></div><!-- Boutons --><buttonid="getSolutions"disabledclass="px-4 py-2 bg-blue-600 text-white text-sm font-medium rounded-md hover:bg-blue-700 focus:outline-none focus:ring-2 focus:ring-blue-500 focus:ring-offset-2 transition-colors duration-200">Get solutions</button><buttonid="getSolutionsStepByStep"disabledclass="px-4 py-2 bg-green-600 text-white text-sm font-medium rounded-md hover:bg-green-700 focus:outline-none focus:ring-2 focus:ring-green-500 focus:ring-offset-2 transition-colors duration-200">Get solutions (Step-by-step)</button></div></div></div><div id="criticizeSoluceContainer" class="hidden"></div><center>
32 unmodified lines33343536373832 unmodified lines# --------------------------------------class SingleRequirement(BaseModel):document: strcontext: strrequirement: str32 unmodified lines3334353637383932 unmodified lines# --------------------------------------class SingleRequirement(BaseModel):req_id: intdocument: strcontext: strrequirement: str
12345616 unmodified lines23242526272810 unmodified lines394041424344456 unmodified lines5253545556575859606162636465666768697071727374757677787 unmodified lines86878889909192939441 unmodified lines13613713813914014114214314412 unmodified lines15715815916016116210 unmodified lines1731741751761771781791801811821831841851861871881891901911921931941951961971986 unmodified lines20520620720820921021121221321421521621721821922022122222322421 unmodified lines24624724824925025143 unmodified lines2952962972982993003011 unmodified line3033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483492 unmodified lines352353354355356357358359360let requirements;function downloadTDocs() {const data = tableToGenBody({"TDoc": "doc"});16 unmodified lines}).then(resp => resp.blob()).then(blob => {const url = window.URL.createObjectURL(blob);const a = document.createElement("a");a.href = url;10 unmodified lines"Tous") {dl_name = `${document.getElementById('docType').value}_${dl_name}`};if (document.getElementById('queryReqForm').classList.contains('hidden')) {dl_name = `requirements_${dl_name}_${url.split('/').pop()}`}dl_name = dl_name + ".zip";6 unmodified lines}function getDataFrame() {document.getElementById("loadingBar").classList.remove("hidden");const wg = document.getElementById('workingGroupSelect').value;const meeting = document.getElementById('meetingSelect').value;document.getElementById('docType').innerHTML = `<option disabled selected value="">Type</option><option>Tous</option>`document.getElementById('docStatus').innerHTML = `<option disabled selected value="">Status</option><option>Tous</option>`document.getElementById('agendaItem').innerHTML = `<option disabled selected value="">Agenda Item</option><option>Tous</option>`const dataFrame = document.getElementById("dataFrame");document.getElementById("progressText").classList.remove('hidden')document.getElementById("progressText").innerHTML = "Loading ...";document.getElementById("loadingBar").classList.remove("hidden")fetch("/get_dataframe", {method: "POST",headers: {7 unmodified lines.then(resp => resp.json()).then(data => {document.getElementById("filters").classList.remove("hidden");document.getElementById("loadingBar").classList.add("hidden");document.getElementById("downloadZip").classList.remove("hidden");document.getElementById("getReqs").classList.remove("hidden");const dataframeBody = dataFrame.querySelector("tbody");dataframeBody.innerHTML = "";const setType = new Set();41 unmodified linesdocument.getElementById('docStatus').appendChild(option);})})document.getElementById("progressText").classList.add('hidden')document.getElementById("loadingBar").classList.add("hidden")}function filterTable() {12 unmodified lines}function getMeetings() {const workingGroup = document.getElementById("workingGroupSelect").value;document.getElementById("meetingSelect").setAttribute('disabled', 'true')document.getElementById("meetingSelect").innerHTML = "<option>Loading...</option>"10 unmodified lines.then(resp => resp.json()).then(data => {document.getElementById("meetingSelect").innerHTML = "";document.getElementById("meetingSelect").removeAttribute("disabled");document.getElementById("getTDocs").removeAttribute("disabled")for (const [key, value] of Object.entries(data.meetings)) {const option = document.createElement("option");option.textContent = key;option.value = value;document.getElementById('meetingSelect').appendChild(option);}})}function generateRequirements() {const bodyreq = tableToGenBody({"TDoc": "document","URL": "url"});document.getElementById("progressText").classList.remove('hidden');document.getElementById("progressText").innerHTML ="Generating requirements, please wait, it may take a while ...";document.getElementById("loadingBar").classList.remove("hidden");fetch("/generate_requirements", {method: "POST",6 unmodified lines}).then(resp => resp.json()).then(data => {document.getElementById("loadingBar").classList.add("hidden");document.getElementById("progressText").classList.add("hidden");document.getElementById("reqStatus").classList.remove("hidden");document.getElementById("getReqs").classList.add("hidden");document.getElementById("searchReq").classList.remove("hidden");document.getElementById("categorizeReq").classList.remove("hidden");requirements = [];data.requirements.forEach(obj => {obj.requirements.forEach(req => {requirements.push({"document": obj.document,"context": obj.context,"requirement": req})})})})21 unmodified linesdocument.getElementById("getReqs").classList.add("hidden");document.getElementById("reqStatus").classList.add("hidden");document.getElementById("downloadZip").classList.remove("hidden");dataFrame.classList.remove("hidden");43 unmodified linesfunction createCard(cardTitle, cardSub, cardText) {return `<div class="flex-none w-80 bg-white rounded-lg shadow-md p-6 mr-4 border border-gray-200 hover:shadow-lg transition-shadow duration-300"><h3 class="text-lg font-semibold text-gray-800 mb-2">${cardTitle}</h3><p class="text-sm text-gray-600 mb-3 font-medium">${cardSub}</p><p class="text-gray-700 text-sm leading-relaxed">${cardText}</p>1 unmodified line`;}function createCarousel(carouselTitle, cards) {let cardsHTML = cards.join("\n");return `<div class="mb-8"><h2 class="text-xl font-bold text-gray-800 mb-4">${carouselTitle}</h2><div class="overflow-x-auto scrollbar-thin scrollbar-thumb-gray-400 scrollbar-track-gray-200"><div class="flex pb-4">${cardsHTML}</div></div></div>`;}function categorizeRequirements() {fetch("https://game4all-reqroup.hf.space/categorize_requirements", {method: "POST",headers: {"Content-Type": "application/json"},body: JSON.stringify({requirements})}).then(resp => resp.json()).then(data => {document.getElementById('dataFrameForm').classList.add('hidden');document.getElementById('filters').classList.add('hidden');document.getElementById('carousels').classList.remove('hidden');document.getElementById('dataFrameDiv').classList.add('hidden');document.getElementById('buttons').classList.add('hidden');data.categories.forEach(cat => {let reqCards = [];cat.requirements.forEach(reqContent => { // Correction icireqCards.push(createCard(reqContent.document, reqContent.context, reqContent.requirement))});document.getElementById('carousels').innerHTML += createCarousel(cat.title, reqCards);})})}// Écouteurs d'événements pour les filtresdocument.getElementById('docType').addEventListener('change', filterTable)2 unmodified linesdocument.getElementById("workingGroupSelect").addEventListener('change', getMeetings)document.getElementById('getTDocs').addEventListener('click', getDataFrame)document.getElementById("getReqs").addEventListener("click", generateRequirements);document.getElementById('categorizeReq').addEventListener('click', categorizeRequirements);document.getElementById("downloadZip").addEventListener('click', downloadTDocs)document.getElementById("queryReq").addEventListener("click", queryRequirements)document.getElementById('searchReq').addEventListener('click', () => {document.getElementById('dataFrameForm').classList.add('hidden');document.getElementById('filters').classList.add('hidden');12345678910111213141516 unmodified lines3233343536373839404110 unmodified lines525354555657586 unmodified lines65666768697071727374757677787980818283847 unmodified lines929394959697989910010110210341 unmodified lines14514614714814915012 unmodified lines16316416516616716816910 unmodified lines1801811821831841851861871881891901911921931941951961971981992002012022032042052062072086 unmodified lines21521621721821922022122222322422522622722822923023123223323423523623723823921 unmodified lines26126226326426526626743 unmodified lines3113123133143153163171 unmodified line3193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476482 unmodified lines651652653654655656657658659660661662663664let requirements;let categorizedRequirements;let solutionsCriticizedVersions = [];let isRequirements = false;function downloadTDocs() {document.getElementById("getReqs").setAttribute('disabled', 'true')document.getElementById("downloadZip").setAttribute('disabled', 'true')document.getElementById("progressText").classList.remove('hidden');document.getElementById("progressText").innerHTML = "Downloading TDocs, please wait, it may take a while ...";document.getElementById("loadingBar").classList.remove("hidden");const data = tableToGenBody({"TDoc": "doc"});16 unmodified lines}).then(resp => resp.blob()).then(blob => {document.getElementById("getReqs").removeAttribute('disabled')document.getElementById("downloadZip").removeAttribute('disabled')document.getElementById("loadingBar").classList.add("hidden");document.getElementById("progressText").classList.add("hidden");const url = window.URL.createObjectURL(blob);const a = document.createElement("a");a.href = url;10 unmodified lines"Tous") {dl_name = `${document.getElementById('docType').value}_${dl_name}`};if (isRequirements) {dl_name = `requirements_${dl_name}_${url.split('/').pop()}`}dl_name = dl_name + ".zip";6 unmodified lines}function getDataFrame() {isRequirements = false;document.getElementById("progressText").classList.remove('hidden');document.getElementById("progressText").innerHTML = "Getting TDoc list of meeting ...";document.getElementById("loadingBar").classList.remove("hidden");document.getElementById("getTDocs").setAttribute('disabled', 'true')const wg = document.getElementById('workingGroupSelect').value;const meeting = document.getElementById('meetingSelect').value;document.getElementById('docType').innerHTML = `<option disabled selected value="">Type</option><option>Tous</option>`document.getElementById('docStatus').innerHTML = `<option disabled selected value="">Status</option><option>Tous</option>`document.getElementById('agendaItem').innerHTML = `<option disabled selected value="">Agenda Item</option><option>Tous</option>`const dataFrame = document.getElementById("dataFrame");fetch("/get_dataframe", {method: "POST",headers: {7 unmodified lines.then(resp => resp.json()).then(data => {document.getElementById("filters").classList.remove("hidden");document.getElementById("downloadZip").classList.remove("hidden");document.getElementById("getReqs").classList.remove("hidden");document.getElementById("getTDocs").removeAttribute("disabled")document.getElementById("progressText").classList.add('hidden');document.getElementById("loadingBar").classList.add("hidden");const dataframeBody = dataFrame.querySelector("tbody");dataframeBody.innerHTML = "";const setType = new Set();41 unmodified linesdocument.getElementById('docStatus').appendChild(option);})})}function filterTable() {12 unmodified lines}function getMeetings() {isRequirements = false;const workingGroup = document.getElementById("workingGroupSelect").value;document.getElementById("meetingSelect").setAttribute('disabled', 'true')document.getElementById("meetingSelect").innerHTML = "<option>Loading...</option>"10 unmodified lines.then(resp => resp.json()).then(data => {document.getElementById("meetingSelect").innerHTML = "";for (const [key, value] of Object.entries(data.meetings)) {const option = document.createElement("option");option.textContent = key;option.value = value;document.getElementById('meetingSelect').appendChild(option);}document.getElementById("meetingSelect").removeAttribute("disabled");document.getElementById("getTDocs").removeAttribute("disabled")})}function generateRequirements() {isRequirements = false;document.getElementById("getReqs").setAttribute('disabled', 'true')document.getElementById("downloadZip").setAttribute('disabled', 'true')document.getElementById("progressText").classList.remove('hidden');document.getElementById("progressText").innerHTML = "Generating requirements, please wait, it may take a while ...";document.getElementById("loadingBar").classList.remove("hidden");const bodyreq = tableToGenBody({"TDoc": "document","URL": "url"});fetch("/generate_requirements", {method: "POST",6 unmodified lines}).then(resp => resp.json()).then(data => {let req_id = 0;document.getElementById("loadingBar").classList.add("hidden");document.getElementById("progressText").classList.add("hidden");document.getElementById("reqStatus").classList.remove("hidden");document.getElementById("getReqs").classList.add("hidden");document.getElementById("searchReq").classList.remove("hidden");document.getElementById("categorizeReq").classList.remove("hidden");document.getElementById("getReqs").removeAttribute('disabled')document.getElementById("downloadZip").removeAttribute('disabled')requirements = [];data.requirements.forEach(obj => {obj.requirements.forEach(req => {requirements.push({req_id,"document": obj.document,"context": obj.context,"requirement": req})req_id++;})})})21 unmodified linesdocument.getElementById("getReqs").classList.add("hidden");document.getElementById("reqStatus").classList.add("hidden");document.getElementById("downloadZip").classList.remove("hidden");isRequirements = true;dataFrame.classList.remove("hidden");43 unmodified linesfunction createCard(cardTitle, cardSub, cardText) {return `<div class="bg-white rounded-lg shadow-md p-6 border border-gray-200 hover:shadow-lg transition-shadow duration-300"><h3 class="text-lg font-semibold text-gray-800 mb-2">${cardTitle}</h3><p class="text-sm text-gray-600 mb-3 font-medium">${cardSub}</p><p class="text-gray-700 text-sm leading-relaxed">${cardText}</p>1 unmodified line`;}function createCarousel(carouselTitle, id, cards) {let cardsHTML = cards.join("\n");return `<div class="mb-8" id="category-${id}"><h2 class="text-xl font-bold text-gray-800 mb-4">${carouselTitle}</h2><div class="grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 gap-4">${cardsHTML}</div></div>`;}function categorizeRequirements(max_categories) {isRequirements = false;fetch("https://game4all-reqroup.hf.space/reqs/categorize_requirements", {method: "POST",headers: {"Content-Type": "application/json"},body: JSON.stringify({requirements,"max_n_categories": max_categories})}).then(resp => resp.json()).then(data => {categorizedRequirements = data;document.getElementById('dataFrameForm').classList.add('hidden');document.getElementById('filters').classList.add('hidden');document.getElementById('categorizeReqContainer').classList.remove('hidden');document.getElementById('dataFrameDiv').classList.add('hidden');document.getElementById('buttons').classList.add('hidden');document.getElementById('carousels').innerHTML = '<h1 class="text-xl font-bold mb-8 text-center">Requirements categories list</h1>'data.categories.forEach(cat => {let reqCards = [];cat.requirements.forEach(reqContent => { // Correction icireqCards.push(createCard(reqContent.document, reqContent.context, reqContent.requirement))});document.getElementById('carousels').innerHTML += createCarousel(cat.title, cat.id, reqCards);})})}// Variable globale pour tracker les états d'ouverture par catégorielet accordionStates = {};function createSolutionAccordion(solutionCriticizedHistory, containerId, versionIndex = 0, categoryIndex = null) {const container = document.getElementById(containerId);if (!container) {console.error(`Container with ID "${containerId}" not found`);return;}// Si categoryIndex est spécifié, ne mettre à jour que cette catégorieif (categoryIndex !== null) {updateSingleAccordion(solutionCriticizedHistory, containerId, versionIndex, categoryIndex);return;}// Vider le container seulement si on recrée toutcontainer.innerHTML = '';// Récupérer les données de la version actuelle directementconst currentVersionData = solutionCriticizedHistory[versionIndex];// Créer l'accordéon principalconst accordion = document.createElement('div');accordion.className = 'space-y-2';accordion.id = 'main-accordion';// Afficher seulement les solutions de la version actuellecurrentVersionData.critiques.forEach((item, index) => {createSingleAccordionItem(item, index, versionIndex, solutionCriticizedHistory, accordion);});// Ajouter l'accordéon au containercontainer.appendChild(accordion);}function createSingleAccordionItem(item, index, versionIndex, solutionCriticizedHistory, accordion) {const solution = item.solution;const criticism = item.criticism;// Récupérer le titre de la catégorieconst categoryTitle = document.querySelector(`#category-${index} h2`)?.textContent || `Catégorie ${index + 1}`;// Container pour chaque solutionconst solutionCard = document.createElement('div');solutionCard.className = 'border border-gray-200 rounded-md shadow-sm';solutionCard.id = `accordion-item-${index}`;// En-tête de l'accordéon avec navigationconst header = document.createElement('div');header.className = 'bg-gray-50 px-4 py-2 cursor-pointer hover:bg-gray-100 transition-colors duration-200';const currentVersion = versionIndex + 1;const totalVersions = solutionCriticizedHistory.length;header.innerHTML = `<div class="flex justify-between items-center"><div class="flex items-center space-x-3"><h3 class="text-sm font-semibold text-gray-800">${categoryTitle}</h3><div class="flex items-center space-x-2 bg-white px-3 py-1 rounded-full border"><button class="version-btn-left w-6 h-6 flex items-center justify-center rounded-full hover:bg-gray-100 transition-colors ${currentVersion === 1 ? 'opacity-50 cursor-not-allowed' : ''}"data-solution-index="${index}"${currentVersion === 1 ? 'disabled' : ''}><svg class="w-3 h-3" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M15 19l-7-7 7-7"></path></svg></button><span class="text-xs font-medium text-gray-600 min-w-[60px] text-center version-indicator">Version ${currentVersion}</span><button class="version-btn-right w-6 h-6 flex items-center justify-center rounded-full hover:bg-gray-100 transition-colors ${currentVersion === totalVersions ? 'opacity-50 cursor-not-allowed' : ''}"data-solution-index="${index}"${currentVersion === totalVersions ? 'disabled' : ''}><svg class="w-3 h-3" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 5l7 7-7 7"></path></svg></button></div></div><svg class="w-4 h-4 transform transition-transform duration-200 accordion-icon" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M19 9l-7 7-7-7"></path></svg></div>`;// Contenu de l'accordéonconst content = document.createElement('div');content.className = `accordion-content px-4 py-3 space-y-3`;content.id = `content-${index}`;// Vérifier l'état d'ouverture précédentconst isOpen = accordionStates[index] || false;if (!isOpen) {content.classList.add('hidden');} else {header.querySelector('.accordion-icon').style.transform = 'rotate(180deg)';}// Section Problem Descriptionconst problemSection = document.createElement('div');problemSection.className = 'bg-red-50 border-l-2 border-red-400 p-3 rounded-r-md';problemSection.innerHTML = `<h4 class="text-sm font-semibold text-red-800 mb-2 flex items-center"><svg class="w-4 h-4 mr-1" fill="currentColor" viewBox="0 0 20 20"><path fill-rule="evenodd" d="M8.257 3.099c.765-1.36 2.722-1.36 3.486 0l5.58 9.92c.75 1.334-.213 2.98-1.742 2.98H4.42c-1.53 0-2.493-1.646-1.743-2.98l5.58-9.92zM11 13a1 1 0 11-2 0 1 1 0 012 0zm-1-8a1 1 0 00-1 1v3a1 1 0 002 0V6a1 1 0 00-1-1z" clip-rule="evenodd"></path></svg>Problem Description</h4><p class="text-xs text-gray-700 leading-relaxed">${solution['Problem Description'] || 'Aucune description du problème disponible.'}</p>`;// Section Solution Descriptionconst solutionSection = document.createElement('div');solutionSection.className = 'bg-green-50 border-l-2 border-green-400 p-3 rounded-r-md';solutionSection.innerHTML = `<h4 class="text-sm font-semibold text-green-800 mb-2 flex items-center"><svg class="w-4 h-4 mr-1" fill="currentColor" viewBox="0 0 20 20"><path fill-rule="evenodd" d="M10 18a8 8 0 100-16 8 8 0 000 16zm3.707-9.293a1 1 0 00-1.414-1.414L9 10.586 7.707 9.293a1 1 0 00-1.414 1.414l2 2a1 1 0 001.414 0l4-4z" clip-rule="evenodd"></path></svg>Solution Description</h4><p class="text-xs text-gray-700 leading-relaxed">${solution['Solution Description'] || 'Aucune description de solution disponible.'}</p>`;// Section Critiqueconst critiqueSection = document.createElement('div');critiqueSection.className = 'bg-yellow-50 border-l-2 border-yellow-400 p-3 rounded-r-md';let critiqueContent = `<h4 class="text-sm font-semibold text-yellow-800 mb-2 flex items-center"><svg class="w-4 h-4 mr-1" fill="currentColor" viewBox="0 0 20 20"><path fill-rule="evenodd" d="M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7-4a1 1 0 11-2 0 1 1 0 012 0zM9 9a1 1 0 000 2v3a1 1 0 001 1h1a1 1 0 100-2v-3a1 1 0 00-1-1H9z" clip-rule="evenodd"></path></svg>Critique & Analysis</h4>`;// Sous-sections de critiqueif (criticism.technical_challenges && criticism.technical_challenges.length > 0) {critiqueContent += `<div class="mb-2"><h5 class="text-xs font-semibold text-yellow-700 mb-1">Technical Challenges:</h5><ul class="list-disc list-inside space-y-0.5 text-xs text-gray-700 ml-3">${criticism.technical_challenges.map(challenge => `<li>${challenge}</li>`).join('')}</ul></div>`;}if (criticism.weaknesses && criticism.weaknesses.length > 0) {critiqueContent += `<div class="mb-2"><h5 class="text-xs font-semibold text-yellow-700 mb-1">Weaknesses:</h5><ul class="list-disc list-inside space-y-0.5 text-xs text-gray-700 ml-3">${criticism.weaknesses.map(weakness => `<li>${weakness}</li>`).join('')}</ul></div>`;}if (criticism.limitations && criticism.limitations.length > 0) {critiqueContent += `<div class="mb-2"><h5 class="text-xs font-semibent text-yellow-700 mb-1">Limitations:</h5><ul class="list-disc list-inside space-y-0.5 text-xs text-gray-700 ml-3">${criticism.limitations.map(limitation => `<li>${limitation}</li>`).join('')}</ul></div>`;}critiqueSection.innerHTML = critiqueContent;// Ajouter les sections au contenucontent.appendChild(problemSection);content.appendChild(solutionSection);content.appendChild(critiqueSection);// Événement de clic pour l'accordéon (exclure les boutons de navigation)header.addEventListener('click', (e) => {// Ne pas déclencher l'accordéon si on clique sur les boutons de navigationif (e.target.closest('.version-btn-left') || e.target.closest('.version-btn-right')) {return;}const icon = header.querySelector('.accordion-icon');const isCurrentlyOpen = !content.classList.contains('hidden');if (isCurrentlyOpen) {content.classList.add('hidden');icon.style.transform = 'rotate(0deg)';accordionStates[index] = false;} else {content.classList.remove('hidden');icon.style.transform = 'rotate(180deg)';accordionStates[index] = true;}});// Événements de navigation pour cette catégorie spécifiqueheader.querySelector('.version-btn-left')?.addEventListener('click', (e) => {e.stopPropagation();updateSingleAccordion(solutionCriticizedHistory, 'accordion-container', versionIndex - 1, index);});header.querySelector('.version-btn-right')?.addEventListener('click', (e) => {e.stopPropagation();updateSingleAccordion(solutionCriticizedHistory, 'accordion-container', versionIndex + 1, index);});// Assembler la carte de solutionsolutionCard.appendChild(header);solutionCard.appendChild(content);accordion.appendChild(solutionCard);}function updateSingleAccordion(solutionCriticizedHistory, containerId, newVersionIndex, categoryIndex) {// Vérifier les limites de versionif (newVersionIndex < 0 || newVersionIndex >= solutionCriticizedHistory.length) {return;}const accordionItem = document.getElementById(`accordion-item-${categoryIndex}`);if (!accordionItem) return;const newData = solutionCriticizedHistory[newVersionIndex];const newItem = newData.critiques[categoryIndex];if (!newItem) return;// Mettre à jour le contenu de cette catégorie spécifiqueconst tempContainer = document.createElement('div');createSingleAccordionItem(newItem, categoryIndex, newVersionIndex, solutionCriticizedHistory, tempContainer);// Remplacer l'ancien item par le nouveauaccordionItem.parentNode.replaceChild(tempContainer.firstChild, accordionItem);}// Fonction d'initialisation simplifiéefunction initializeSolutionAccordion(solutionCriticizedHistory, containerId, startVersion = 0) {// Réinitialiser les états d'accordéonaccordionStates = {};createSolutionAccordion(solutionCriticizedHistory, containerId, startVersion);document.getElementById("criticizeSoluceContainer").classList.remove('hidden')}async function generateSolutions(){isRequirements = false;let response = await fetch('https://game4all-reqroup.hf.space/solution/search_solutions_gemini', {method: "POST", headers: {"Content-Type": "application/json"}, body: JSON.stringify(categorizedRequirements)})let responseObj = await response.json()return responseObj;}async function generateCriticisms(solutions){isRequirements = false;let response = await fetch('https://game4all-reqroup.hf.space/solution/criticize_solution', {method: "POST", headers: {"Content-Type": "application/json"}, body: JSON.stringify(solutions)})let responseObj = await response.json()solutionsCriticizedVersions.push(responseObj)}async function refineSolutions(critiques){isRequirements = false;let response = await fetch('https://game4all-reqroup.hf.space/solution/refine_solution', {method: "POST", headers: {"Content-Type": "application/json"}, body: JSON.stringify(critiques)})let responseObj = await response.json()await generateCriticisms(responseObj)}async function workflow(steps = 1){let soluce;for(let step; step <= steps; step++){if(solutionsCriticizedVersions.length == 0){soluce = await generateSolutions();await generateCriticisms(soluce)} else {let prevSoluce = solutionsCriticizedVersions[solutionsCriticizedVersions.length - 1];await refineSolutions(prevSoluce)}}initializeSolutionAccordion(solutionsCriticizedVersions, "criticizeSoluceContainer")}// Écouteurs d'événements pour les filtresdocument.getElementById('docType').addEventListener('change', filterTable)2 unmodified linesdocument.getElementById("workingGroupSelect").addEventListener('change', getMeetings)document.getElementById('getTDocs').addEventListener('click', getDataFrame)document.getElementById("getReqs").addEventListener("click", generateRequirements);document.getElementById('categorizeReq').addEventListener('click', () => categorizeRequirements(8));document.getElementById("downloadZip").addEventListener('click', downloadTDocs)document.getElementById("queryReq").addEventListener("click", queryRequirements)document.getElementById('getSolutionsStepByStep').addEventListener('click', async () => await workflow())document.getElementById("getSolutions").addEventListener('click', async () => {let steps = document.getElementById('limitInput').value != '' ? document.getElementById('limitInput').value : 10;await workflow(steps)})document.getElementById('searchReq').addEventListener('click', () => {document.getElementById('dataFrameForm').classList.add('hidden');document.getElementById('filters').classList.add('hidden');
app.py+1-1
index.html+42-3
schemas.py+1
static/script.js+363-59