mirror of
https://github.com/EvolutionAPI/evolution-api.git
synced 2025-07-23 04:22:02 -06:00
Fix conversationId when is dify agent
This commit is contained in:
parent
d0a723b8ef
commit
0e4034ffac
@ -1179,6 +1179,7 @@ export class DifyService {
|
||||
});
|
||||
|
||||
let completeMessage = '';
|
||||
let conversationId
|
||||
|
||||
const stream = response.data;
|
||||
const reader = new Readable().wrap(stream);
|
||||
@ -1190,6 +1191,7 @@ export class DifyService {
|
||||
const event = JSON.parse(data);
|
||||
if (event.event === 'agent_message') {
|
||||
completeMessage += event.answer;
|
||||
conversationId = conversationId ?? event?.conversation_id
|
||||
|
||||
console.log('completeMessage:', completeMessage);
|
||||
}
|
||||
@ -1219,8 +1221,8 @@ export class DifyService {
|
||||
data: {
|
||||
status: 'opened',
|
||||
awaitUser: true,
|
||||
sessionId: response?.data?.conversation_id,
|
||||
},
|
||||
sessionId: conversationId
|
||||
}
|
||||
});
|
||||
|
||||
sendTelemetry('/message/sendText');
|
||||
@ -1511,6 +1513,7 @@ export class DifyService {
|
||||
});
|
||||
|
||||
let completeMessage = '';
|
||||
let conversationId
|
||||
|
||||
const stream = response.data;
|
||||
const reader = new Readable().wrap(stream);
|
||||
@ -1526,6 +1529,7 @@ export class DifyService {
|
||||
const event = JSON.parse(jsonString);
|
||||
if (event.event === 'agent_message') {
|
||||
completeMessage += event.answer;
|
||||
conversationId = conversationId ?? event?.conversation_id
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('Error parsing stream data:', error);
|
||||
@ -1553,8 +1557,8 @@ export class DifyService {
|
||||
data: {
|
||||
status: 'opened',
|
||||
awaitUser: true,
|
||||
sessionId: response?.data?.conversation_id,
|
||||
},
|
||||
sessionId: conversationId
|
||||
}
|
||||
});
|
||||
|
||||
sendTelemetry('/message/sendText');
|
||||
|
Loading…
Reference in New Issue
Block a user