feat: improve chatbot planning responses
This commit is contained in:
@@ -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();
|
||||
}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user