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