How to style the response come from openAI API

84 Views Asked by At

I want the response come from the openAI are render with some attractive style mean heading should be bold and paragraph font are much better and the next is to add citation of blue color so i got the response come from openAI i want to add style on them.

i just try a simple api call and get response from openAI in

apiresponse

so i need to add styling on them i get response from openAI in html formate or simple

function styleApiResponse() {
    var titles = document.querySelectorAll('#response h1');
    titles.forEach(function (title) {
        title.style.color = 'blue'; 
    });

  
    var headings = document.querySelectorAll('#response h2');
    headings.forEach(function (heading) {
        heading.style.fontWeight = 'bold';
       
    });

 
    var paragraphs = document.querySelectorAll('#response p');
    paragraphs.forEach(function (paragraph) {
        paragraph.style.marginBottom = '10px'; 
     
    });

  
    var links = document.querySelectorAll('#response a');
    links.forEach(function (link) {
        link.style.color = 'green';
    });

  
}
0

There are 0 best solutions below