SimpleChat:JS: Extract model response and show to user

This commit is contained in:
HanishKVC 2024-05-17 21:30:10 +05:30
parent 33bc67baa6
commit c6653479fc

View file

@ -101,7 +101,11 @@ async function handle_submit(inputUser, divChat, urlApi) {
},
body: gChat.request_messages_jsonstr(),
});
console.log("DBUG:HandleSubmit:Resp:", resp);
let respBody = await resp.json();
console.log("DBUG:HandleSubmit:Resp:", respBody);
let assistantMsg = respBody["choices"][0]["message"]["content"];
gChat.add(Roles.Assistant, assistantMsg);
gChat.show(divChat);
}