2023-11-07 09:44:56 -06:00
|
|
|
import * as skills from './skills.js';
|
2023-11-07 20:21:19 -08:00
|
|
|
import * as world from './world.js';
|
2023-11-07 09:44:56 -06:00
|
|
|
|
|
|
|
export function getSkillDocs() {
|
2023-11-07 12:00:55 -06:00
|
|
|
let docstring = "\n*SKILL DOCS\nThese skills are javascript functions that can be called with a js function by writing a code block. Ex: '```// write description comment and code here```' \n\
|
|
|
|
Your code block should return a bool indicating if the task was completed successfully. It will return true if you don't write a return statement.\n";
|
2023-11-08 19:24:24 -06:00
|
|
|
docstring += docHelper(Object.values(skills), 'skills');
|
|
|
|
docstring += docHelper(Object.values(world), 'world');
|
|
|
|
return docstring + '*\n';
|
|
|
|
}
|
|
|
|
|
|
|
|
export function docHelper(functions, module_name) {
|
|
|
|
let docstring = '';
|
|
|
|
for (let skillFunc of functions) {
|
2023-11-07 09:44:56 -06:00
|
|
|
let str = skillFunc.toString();
|
2023-11-07 20:21:19 -08:00
|
|
|
if (str.includes('/**')){
|
2023-11-08 19:24:24 -06:00
|
|
|
docstring += module_name+'.'+skillFunc.name;
|
2023-11-07 20:21:19 -08:00
|
|
|
docstring += str.substring(str.indexOf('/**')+3, str.indexOf('**/')) + '\n';
|
|
|
|
}
|
2023-11-07 09:44:56 -06:00
|
|
|
}
|
2023-11-08 19:24:24 -06:00
|
|
|
return docstring;
|
2023-11-07 09:44:56 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
export function containsCodeBlock(message) {
|
|
|
|
return message.indexOf('```') !== -1;
|
|
|
|
}
|