冯杨

同步github官方更新截止Commits on Apr 18, 2025

a9c36c76e569107b5a39b3de8afd6e016b24d662
... ... @@ -581,17 +581,44 @@
console.log('Sending chat message:', message);
fetch('/human', {
body: JSON.stringify({
text: message,
type: 'chat',
interrupt: true,
sessionid: parseInt(document.getElementById('sessionid').value),
}),
// fetch('/human', {
// body: JSON.stringify({
// text: message,
// type: 'chat',
// interrupt: true,
// sessionid: parseInt(document.getElementById('sessionid').value),
// }),
// headers: {
// 'Content-Type': 'application/json'
// },
// method: 'POST'
// });
var payload = {
"model": "fay-streaming",
"messages": [
{
"role": $('#username').val(),
"content": message
}
],
"observation": ""
};
fetch('http://127.0.0.1:5000/v1/chat/completions', {
body: JSON.stringify(payload),
headers: {
'Content-Type': 'application/json'
},
method: 'POST'
}).then(function(response) {
if (response.ok) {
console.log('Message sent to API.');
} else {
console.error('Failed to send message to API.');
}
}).catch(function(error) {
console.error('Error:', error);
});
addChatMessage(message, 'user');
... ...