diff --git a/RAG/public/playground/app.js b/RAG/public/playground/app.js index 951781e..8f1af1f 100644 --- a/RAG/public/playground/app.js +++ b/RAG/public/playground/app.js @@ -26,6 +26,7 @@ const ingestSourceRef = document.getElementById("ingestSourceRef"); const ingestUploadFile = document.getElementById("ingestUploadFile"); const ingestMode = document.getElementById("ingestMode"); const ingestTags = document.getElementById("ingestTags"); +const ingestModeHint = document.getElementById("ingestModeHint"); const bootstrapQuery = document.getElementById("bootstrapQuery"); const bootstrapMode = document.getElementById("bootstrapMode"); @@ -56,6 +57,21 @@ function buildScopeLabel(scope) { return `${scope.sourceRef} [${modes}]`; } +function updateIngestUiState() { + const hasUpload = Boolean(ingestUploadFile.files && ingestUploadFile.files[0]); + ingestSourceType.value = hasUpload ? "file" : ingestSourceType.value; + ingestSourceType.disabled = hasUpload; + ingestSourceRef.disabled = hasUpload; + + if (hasUpload) { + ingestModeHint.textContent = `Upload directo activo: se ingerira el archivo local "${ingestUploadFile.files[0].name}" y se ignorara la ruta manual.`; + ingestModeHint.classList.add("strong"); + } else { + ingestModeHint.textContent = "Si seleccionas un archivo local, el playground usara upload directo y podras aislarlo con un `sourceId` propio para no mezclarlo con otros scopes."; + ingestModeHint.classList.remove("strong"); + } +} + function request(url, payload, method = "POST") { return fetch(url, { method, @@ -188,6 +204,8 @@ scopePresetSelect.addEventListener("change", () => { } }); +ingestUploadFile.addEventListener("change", updateIngestUiState); + healthButton.addEventListener("click", async () => { healthResult.textContent = "Comprobando..."; try { @@ -232,6 +250,7 @@ ingestButton.addEventListener("click", async () => { ingestResult.textContent = format(data); await loadScopes(); + updateIngestUiState(); } catch (error) { ingestResult.textContent = String(error); } @@ -349,3 +368,4 @@ loadScopes(); loadAnswerModels(); renderBootstrapContext(); renderChatHistory(); +updateIngestUiState(); diff --git a/RAG/public/playground/index.html b/RAG/public/playground/index.html index 7e193e4..04fa9d2 100644 --- a/RAG/public/playground/index.html +++ b/RAG/public/playground/index.html @@ -52,7 +52,7 @@ -

Si seleccionas un archivo local, el playground usara upload directo y podras aislarlo con un `sourceId` propio para no mezclarlo con otros scopes.

+

Si seleccionas un archivo local, el playground usara upload directo y podras aislarlo con un `sourceId` propio para no mezclarlo con otros scopes.

diff --git a/RAG/public/playground/styles.css b/RAG/public/playground/styles.css index 976f107..14e8665 100644 --- a/RAG/public/playground/styles.css +++ b/RAG/public/playground/styles.css @@ -85,6 +85,10 @@ h1, h2, h3 { margin: 0 0 12px; } margin: 0 0 16px; } +.helper.strong { + color: var(--accent); +} + .grid { display: grid; gap: 24px;