formatting now removed HTML

This commit is contained in:
Peter Morton 2025-06-13 22:40:27 -05:00
parent 7e8dbaaa90
commit bf2cbc19d4

View File

@ -25,15 +25,15 @@ const init = async (): Promise<void> => {
rl.on("line", async (input: string) => {
if (input.trim().length > 0) {
const output = await client.send(input);
console.log(chalk.green("Assistant: ") + boldify(output));
console.log(chalk.green("Assistant: ") + format(output));
}
rl.prompt();
});
};
// Utility function to replace **text** with chalk.bold(text)
function boldify(text: string): string {
return text.replace(/\*\*(.*?)\*\*/g, (_, value) => chalk.bold(value));
function format(text: string): string {
let retval = text.replace(/<[^>]*>/g, "");
return retval.replace(/\*\*(.*?)\*\*/g, (_, value) => chalk.bold(value));
}
init();