Skip to content

Commit 28d65f4

Browse files
committed
[update] llm supports input from whisper. perf whisper endpoint method.
1 parent 29ad0ee commit 28d65f4

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

projects/llm_framework/main_llm/src/main.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -380,7 +380,7 @@ class llm_llm : public StackFlow {
380380
"", std::bind(&llm_llm::task_user_data, this, std::weak_ptr<llm_task>(llm_task_obj),
381381
std::weak_ptr<llm_channel_obj>(llm_channel), std::placeholders::_1,
382382
std::placeholders::_2));
383-
} else if (input.find("asr") != std::string::npos) {
383+
} else if ((input.find("asr") != std::string::npos) || (input.find("whisper") != std::string::npos)) {
384384
llm_channel->subscriber_work_id(
385385
input, std::bind(&llm_llm::task_asr_data, this, std::weak_ptr<llm_task>(llm_task_obj),
386386
std::weak_ptr<llm_channel_obj>(llm_channel), std::placeholders::_1,

projects/llm_framework/main_whisper/src/main.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -309,12 +309,12 @@ class llm_task {
309309
static int count = 0;
310310
double start, end;
311311
double start_all, end_all;
312-
313-
if (count < delay_audio_frame_ || endpoint_flage_) {
312+
if (count < delay_audio_frame_) {
314313
buffer_write_char(pcmdata, raw.c_str(), raw.length());
315314
count++;
316-
return;
315+
if (endpoint_flage_) return;
317316
}
317+
endpoint_flage_ = true;
318318
buffer_write_char(pcmdata, raw.c_str(), raw.length());
319319
buffer_position_set(pcmdata, 0);
320320
count = 0;
@@ -823,7 +823,7 @@ class llm_whisper : public StackFlow {
823823
std::weak_ptr<llm_channel_obj>(llm_channel), std::placeholders::_1,
824824
std::placeholders::_2));
825825
} else if (input.find("vad") != std::string::npos) {
826-
llm_task_obj->endpoint_flage_ = false;
826+
llm_task_obj->endpoint_flage_ = true;
827827
// task_pause(work_id, "");
828828
llm_channel->subscriber_work_id(
829829
input, std::bind(&llm_whisper::vad_endpoint, this, std::weak_ptr<llm_task>(llm_task_obj),
@@ -874,7 +874,7 @@ class llm_whisper : public StackFlow {
874874
std::weak_ptr<llm_channel_obj>(llm_channel), std::placeholders::_1, std::placeholders::_2));
875875
llm_task_obj->inputs_.push_back(data);
876876
} else if (data.find("vad") != std::string::npos) {
877-
llm_task_obj->endpoint_flage_ = false;
877+
llm_task_obj->endpoint_flage_ = true;
878878
ret = llm_channel->subscriber_work_id(
879879
data,
880880
std::bind(&llm_whisper::vad_endpoint, this, std::weak_ptr<llm_task>(llm_task_obj),

0 commit comments

Comments
 (0)