JavaScript | Как распарить event ?
Данный вид ответа:
event: tool_call
data: %7B%22type%22%3A%22function%22%2C%22name%22%3A%22queryKnowledgeBase%22%2C%22arguments%22%3A%22%7B%7D%22%7D
event: answer
data: %D0%94
event: answer
data: %D0%BB%D1%8F
event: answer
data: %20%D1%81%D0%BE%D0%B7%D0%B4
event: answer
data: %D0%B0%D0%BD%D0%B8%D1%8F
event: answer
data: %20%D1%87
event: answer
data: %D0%B0%D1%82
event: answer
data: -
event: answer
data: %D0%B1
event: answer
data: %D0%BE%D1%82
event: answer
data: %D0%B0
event: answer
data: %20%D0%B2%D1%8B
event: answer
data: %20%D0%BC%D0%BE%D0%B6%D0%B5%D1%82
event: answer
data: %D0%B5
event: answer
data: %20%D0%B8%D1%81%D0%BF%D0%BE%D0%BB%D1%8C%D0%B7%D0%BE%D0%B2
event: answer
data: %D0%B0%D1%82%D1%8C
event: answer
data: %20%D0%BF
event: answer
data: %D0%BB%D0%B0%D1%82
event: answer
data: %D1%84%D0%BE%D1%80%D0%BC
event: answer
data: %D1%83
event: answer
data: %20Wat
event: answer
data: Bot
event: answer
data: .
event: answer
data: %20%D0%AD
event: answer
data: %D1%82%D0%B0
event: answer
data: %20%D0%BF
event: answer
data: %D0%BB%D0%B0%D1%82
event: answer
data: %D1%84%D0%BE%D1%80%D0%BC
event: answer
data: %D0%B0
event: answer
data: %20%D0%BF%D1%80%D0%B5%D0%B4
event: answer
data: %D0%BE%D1%81%D1%82
event: answer
data: %D0%B0%D0%B2
event: answer
data: %D0%BB%D1%8F
event: answer
data: %D0%B5%D1%82
event: answer
data: %20%D0%B2%D1%81
event: answer
data: %D1%8E
event: answer
data: %20%D0%BD%D0%B5
event: answer
data: %D0%BE%D0%B1%D1%85%D0%BE%D0%B4%D0%B8%D0%BC
event: answer
data: %D1%83%D1%8E
event: answer
data: %20%D0%B8%D0%BD%D1%84%D0%BE%D1%80%D0%BC
event: answer
data: %D0%B0%D1%86%D0%B8
event: answer
data: %D1%8E
event: answer
data: %20%D0%BE
event: answer
data: %20%D1%82
event: answer
data: %D0%BE%D0%BC
event: answer
data: %2C
event: answer
data: %20%D0%BA%D0%B0%D0%BA
event: answer
data: %20%D1%81%D0%BE%D0%B7%D0%B4
event: answer
data: %D0%B0%D0%B2
event: answer
data: %D0%B0%D1%82%D1%8C
event: answer
data: %20%D1%87
event: answer
data: %D0%B0%D1%82
event: answer
data: -
event: answer
data: %D0%B1
event: answer
data: %D0%BE%D1%82
event: answer
data: %D1%8B
event: answer
data: %20%D0%BB%D1%8E
event: answer
data: %D0%B1
event: answer
data: %D0%BE%D0%B9
event: answer
data: %20%D1%81%D0%BB
event: answer
data: %D0%BE%D0%B6
event: answer
data: %D0%BD%D0%BE%D1%81%D1%82%D0%B8
event: answer
data: .
event: answer
data: %20%D0%92%D1%8B
event: answer
data: %20%D1%82%D0%B0%D0%BA
event: answer
data: %D0%B6%D0%B5
event: answer
data: %20%D0%BC%D0%BE%D0%B6%D0%B5%D1%82
event: answer
data: %D0%B5
event: answer
data: %20%D0%BF%D0%BE%D0%B4
event: answer
data: %D0%BF%D0%B8%D1%81
event: answer
data: %D0%B0%D1%82%D1%8C%D1%81%D1%8F
event: answer
data: %20%D0%BD%D0%B0
event: answer
data: %20%D0%B8
event: answer
data: %D1%85
event: answer
data: %20%D0%9D
event: answer
data: %D0%BE%D0%B2
event: answer
data: %D0%BE%D1%81%D1%82
event: answer
data: %D0%BD%D0%BE%D0%B9
event: answer
data: %20%D0%BA
event: answer
data: %D0%B0%D0%BD
event: answer
data: %D0%B0%D0%BB
event: answer
data: %20%D0%B2
event: answer
data: %20Telegram
event: answer
data: %20%D0%B8%D0%BB%D0%B8
event: answer
data: %20%D0%BF%D0%BE
event: answer
data: %D1%81
event: answer
data: %D0%B5%D1%82
event: answer
data: %D0%B8%D1%82%D1%8C
event: answer
data: %20YouTube
event: answer
data: -
event: answer
data: %D0%BA
event: answer
data: %D0%B0%D0%BD
event: answer
data: %D0%B0%D0%BB
event: answer
data: %20%D0%B4%D0%BB%D1%8F
event: answer
data: %20%D0%BF%D0%BE%D0%BB%D1%83%D1%87
event: answer
data: %D0%B5%D0%BD%D0%B8%D1%8F
event: answer
data: %20%D0%B4
event: answer
data: %D0%BE%D0%BF
event: answer
data: %D0%BE%D0%BB%D0%BD
event: answer
data: %D0%B8%D1%82%D0%B5%D0%BB%D1%8C
event: answer
data: %D0%BD%D0%BE%D0%B9
event: answer
data: %20%D0%B8%D0%BD%D1%84%D0%BE%D1%80%D0%BC
event: answer
data: %D0%B0%D1%86%D0%B8%D0%B8
event: answer
data: .
event: endpoint_response
data: %7B%22messageId%22%3A%22clsaodxa4013w8io9bwk67wys%22%2C%22answe
________
посл. ред. 06.02.2024 в 21:21; всего 1 раз(а); by Foxsa
event: tool_call
data: %7B%22type%22%3A%22function%22%2C%22name%22%3A%22queryKnowledgeBase%22%2C%22arguments%22%3A%22%7B%7D%22%7D
event: answer
data: %D0%94
event: answer
data: %D0%BB%D1%8F
event: answer
data: %20%D1%81%D0%BE%D0%B7%D0%B4
event: answer
data: %D0%B0%D0%BD%D0%B8%D1%8F
event: answer
data: %20%D1%87
event: answer
data: %D0%B0%D1%82
event: answer
data: -
event: answer
data: %D0%B1
event: answer
data: %D0%BE%D1%82
event: answer
data: %D0%B0
event: answer
data: %20%D0%B2%D1%8B
event: answer
data: %20%D0%BC%D0%BE%D0%B6%D0%B5%D1%82
event: answer
data: %D0%B5
event: answer
data: %20%D0%B8%D1%81%D0%BF%D0%BE%D0%BB%D1%8C%D0%B7%D0%BE%D0%B2
event: answer
data: %D0%B0%D1%82%D1%8C
event: answer
data: %20%D0%BF
event: answer
data: %D0%BB%D0%B0%D1%82
event: answer
data: %D1%84%D0%BE%D1%80%D0%BC
event: answer
data: %D1%83
event: answer
data: %20Wat
event: answer
data: Bot
event: answer
data: .
event: answer
data: %20%D0%AD
event: answer
data: %D1%82%D0%B0
event: answer
data: %20%D0%BF
event: answer
data: %D0%BB%D0%B0%D1%82
event: answer
data: %D1%84%D0%BE%D1%80%D0%BC
event: answer
data: %D0%B0
event: answer
data: %20%D0%BF%D1%80%D0%B5%D0%B4
event: answer
data: %D0%BE%D1%81%D1%82
event: answer
data: %D0%B0%D0%B2
event: answer
data: %D0%BB%D1%8F
event: answer
data: %D0%B5%D1%82
event: answer
data: %20%D0%B2%D1%81
event: answer
data: %D1%8E
event: answer
data: %20%D0%BD%D0%B5
event: answer
data: %D0%BE%D0%B1%D1%85%D0%BE%D0%B4%D0%B8%D0%BC
event: answer
data: %D1%83%D1%8E
event: answer
data: %20%D0%B8%D0%BD%D1%84%D0%BE%D1%80%D0%BC
event: answer
data: %D0%B0%D1%86%D0%B8
event: answer
data: %D1%8E
event: answer
data: %20%D0%BE
event: answer
data: %20%D1%82
event: answer
data: %D0%BE%D0%BC
event: answer
data: %2C
event: answer
data: %20%D0%BA%D0%B0%D0%BA
event: answer
data: %20%D1%81%D0%BE%D0%B7%D0%B4
event: answer
data: %D0%B0%D0%B2
event: answer
data: %D0%B0%D1%82%D1%8C
event: answer
data: %20%D1%87
event: answer
data: %D0%B0%D1%82
event: answer
data: -
event: answer
data: %D0%B1
event: answer
data: %D0%BE%D1%82
event: answer
data: %D1%8B
event: answer
data: %20%D0%BB%D1%8E
event: answer
data: %D0%B1
event: answer
data: %D0%BE%D0%B9
event: answer
data: %20%D1%81%D0%BB
event: answer
data: %D0%BE%D0%B6
event: answer
data: %D0%BD%D0%BE%D1%81%D1%82%D0%B8
event: answer
data: .
event: answer
data: %20%D0%92%D1%8B
event: answer
data: %20%D1%82%D0%B0%D0%BA
event: answer
data: %D0%B6%D0%B5
event: answer
data: %20%D0%BC%D0%BE%D0%B6%D0%B5%D1%82
event: answer
data: %D0%B5
event: answer
data: %20%D0%BF%D0%BE%D0%B4
event: answer
data: %D0%BF%D0%B8%D1%81
event: answer
data: %D0%B0%D1%82%D1%8C%D1%81%D1%8F
event: answer
data: %20%D0%BD%D0%B0
event: answer
data: %20%D0%B8
event: answer
data: %D1%85
event: answer
data: %20%D0%9D
event: answer
data: %D0%BE%D0%B2
event: answer
data: %D0%BE%D1%81%D1%82
event: answer
data: %D0%BD%D0%BE%D0%B9
event: answer
data: %20%D0%BA
event: answer
data: %D0%B0%D0%BD
event: answer
data: %D0%B0%D0%BB
event: answer
data: %20%D0%B2
event: answer
data: %20Telegram
event: answer
data: %20%D0%B8%D0%BB%D0%B8
event: answer
data: %20%D0%BF%D0%BE
event: answer
data: %D1%81
event: answer
data: %D0%B5%D1%82
event: answer
data: %D0%B8%D1%82%D1%8C
event: answer
data: %20YouTube
event: answer
data: -
event: answer
data: %D0%BA
event: answer
data: %D0%B0%D0%BD
event: answer
data: %D0%B0%D0%BB
event: answer
data: %20%D0%B4%D0%BB%D1%8F
event: answer
data: %20%D0%BF%D0%BE%D0%BB%D1%83%D1%87
event: answer
data: %D0%B5%D0%BD%D0%B8%D1%8F
event: answer
data: %20%D0%B4
event: answer
data: %D0%BE%D0%BF
event: answer
data: %D0%BE%D0%BB%D0%BD
event: answer
data: %D0%B8%D1%82%D0%B5%D0%BB%D1%8C
event: answer
data: %D0%BD%D0%BE%D0%B9
event: answer
data: %20%D0%B8%D0%BD%D1%84%D0%BE%D1%80%D0%BC
event: answer
data: %D0%B0%D1%86%D0%B8%D0%B8
event: answer
data: .
event: endpoint_response
data: %7B%22messageId%22%3A%22clsaodxa4013w8io9bwk67wys%22%2C%22answe
________
посл. ред. 06.02.2024 в 21:21; всего 1 раз(а); by Foxsa
Avenax не знает?
$data = 'event: tool_call
data: %7B%22type%22%3A%22function%22%2C%22name%22%3A%22queryKnowledgeBase%22%2C%22arguments%22%3A%22%7B%7D%22%7D
event: answer
data: %D0%94
event: answer
data: %D0%BB%D1%8F';
preg_match_all('~event:(.*?)\n~is', $data, $matches);
echo '<pre>', print_r($matches[1]), '</pre>';
------
87274_Screenshot_6.png (2.0 Kb)
Скачиваний: 65