/
githubmirror
/
ai-legion
Обзор
Документация
Войти
/
githubmirror
/
ai-legion
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
master
src/module/util.ts
22 строки
621 B
eumemic
generalize to just 'modules' which can provide more than just actions
10 апр 2023, 23:57
10 апр 2023, 23:57
895ea20
Код
Авторство
О чём код?
import { CODE_BLOCK_DELIMITER } from "../message"; import { ActionDefinition } from "./action-definition"; export function getUsageText(actionDef: ActionDefinition): string { return `Usage: ${CODE_BLOCK_DELIMITER} ${actionDef.name} thoughts: <reasoning behind this action> (optional)${Object.entries( actionDef.parameters ) .map(([name, { description }]) => name === "name" ? undefined : `\n${name}: <${description.toLowerCase()}>${ actionDef.parameters[name].optional ? " (optional)" : "" }` ) .filter(Boolean) .join("")} ${CODE_BLOCK_DELIMITER}`; }