formatting now removed HTML
This commit is contained in:
parent
7e8dbaaa90
commit
bf2cbc19d4
@ -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();
|
||||
Loading…
x
Reference in New Issue
Block a user