feat: improve chatbot planning responses

This commit is contained in:
renato97
2025-12-01 03:07:24 +00:00
parent a87347475a
commit 69779a4bdb
4 changed files with 358 additions and 5 deletions

View File

@@ -46,7 +46,7 @@ function readLibrary() {
}
}
function listSources() {
function scanSources() {
const result = [];
if (!fs.existsSync(SOURCES_DIR)) {
return result;
@@ -282,7 +282,7 @@ async function generateFromPrompt(prompt, options = {}) {
if (!library.length) {
throw new Error('No hay ALS en la biblioteca. Sube al menos uno antes de generar.');
}
const sources = listSources();
const sources = scanSources();
const tokens = prompt
.toLowerCase()
.split(/[^a-z0-9]+/)
@@ -341,5 +341,13 @@ async function generateFromPrompt(prompt, options = {}) {
}
module.exports = {
generateFromPrompt
generateFromPrompt,
listLibrary: () => {
ensureDirs();
return readLibrary();
},
listSources: () => {
ensureDirs();
return scanSources();
}
};