[mirotalksfu] - improve chatGPT
هذا الالتزام موجود في:
@@ -942,7 +942,7 @@ function startServer() {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
socket.on('getChatGPT', async ({ prompt }, cb) => {
|
socket.on('getChatGPT', async ({ time, room, name, prompt }, cb) => {
|
||||||
if (!roomList.has(socket.room_id)) return;
|
if (!roomList.has(socket.room_id)) return;
|
||||||
if (!config.chatGPT.enabled) return cb('ChatGPT seems disabled, try later!');
|
if (!config.chatGPT.enabled) return cb('ChatGPT seems disabled, try later!');
|
||||||
try {
|
try {
|
||||||
@@ -955,6 +955,9 @@ function startServer() {
|
|||||||
});
|
});
|
||||||
const response = completion.data.choices[0].text;
|
const response = completion.data.choices[0].text;
|
||||||
log.debug('ChatGPT', {
|
log.debug('ChatGPT', {
|
||||||
|
time: time,
|
||||||
|
room: room,
|
||||||
|
name: name,
|
||||||
prompt: prompt,
|
prompt: prompt,
|
||||||
response: response,
|
response: response,
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -2713,7 +2713,12 @@ class RoomClient {
|
|||||||
this.peer_name = filterXSS(this.peer_name);
|
this.peer_name = filterXSS(this.peer_name);
|
||||||
if (isChatGPTOn) {
|
if (isChatGPTOn) {
|
||||||
this.socket
|
this.socket
|
||||||
.request('getChatGPT', { prompt: peer_msg })
|
.request('getChatGPT', {
|
||||||
|
time: getDataTimeString(),
|
||||||
|
room: this.room_id,
|
||||||
|
name: this.peer_name,
|
||||||
|
prompt: peer_msg,
|
||||||
|
})
|
||||||
.then(
|
.then(
|
||||||
function (completion) {
|
function (completion) {
|
||||||
console.log('Receive message:', completion);
|
console.log('Receive message:', completion);
|
||||||
|
|||||||
المرجع في مشكلة جديدة
حظر مستخدم