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) => {
|
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();
|
||||||
Loading…
x
Reference in New Issue
Block a user