diff --git a/agents/.gitignore b/agents/.gitignore index 19cdf170..175ad523 100644 --- a/agents/.gitignore +++ b/agents/.gitignore @@ -1,6 +1,7 @@ *.log ten_packages/extension_group/ ten_packages/extension/agora_rtc +ten_packages/extension/azure_tts ten_packages/extension/py_init_extension_cpp ten_packages/system .ten diff --git a/agents/manifest-lock.json b/agents/manifest-lock.json index c4921982..67fe30ef 100644 --- a/agents/manifest-lock.json +++ b/agents/manifest-lock.json @@ -100,8 +100,8 @@ { "type": "extension", "name": "azure_tts", - "version": "0.4.0", - "hash": "c8f838754aaae7ed4598e99fb94b6e251382ade08fa23dbf85e91e9864d018ef", + "version": "0.4.2", + "hash": "f1f3e58bd67ff45d537703690fe15f37f37b1e5754c29c483e74f15ee8fde7c8", "dependencies": [ { "type": "system", @@ -111,7 +111,8 @@ "type": "system", "name": "azure_speech_sdk" } - ] + ], + "supports": [] }, { "type": "system", diff --git a/agents/manifest.json b/agents/manifest.json index 4ba7b513..3d1e3622 100644 --- a/agents/manifest.json +++ b/agents/manifest.json @@ -31,7 +31,7 @@ { "type": "extension", "name": "azure_tts", - "version": "=0.4.0" + "version": "0.4.2" } ] } \ No newline at end of file diff --git a/agents/scripts/install_deps_and_build.sh b/agents/scripts/install_deps_and_build.sh index 9c5977cd..df37ac83 100755 --- a/agents/scripts/install_deps_and_build.sh +++ b/agents/scripts/install_deps_and_build.sh @@ -35,6 +35,10 @@ build_cxx_extensions() { local out="out/$OS/$CPU" for extension in $out/ten_packages/extension/*; do local extension_name=$(basename $extension) + if [[ $extension_name == "*" ]]; then + echo "No cxx extension, nothing to copy." + break + fi if [[ ! -d $extension/lib ]]; then echo "No output for extension $extension_name." exit 1 diff --git a/agents/ten_packages/extension/azure_tts/BUILD.gn b/agents/ten_packages/extension/azure_tts/BUILD.gn deleted file mode 100644 index 0537c92a..00000000 --- a/agents/ten_packages/extension/azure_tts/BUILD.gn +++ /dev/null @@ -1,49 +0,0 @@ -# -# -# Agora Real Time Engagement -# Created by Wei Hu in 2022-11. -# Copyright (c) 2024 Agora IO. All rights reserved. -# -# -import("//.gnfiles/build/feature/base_options.gni") -import("//.gnfiles/build/feature/ten_package.gni") - -ten_package("azure_tts") { - package_kind = "extension" - enable_build = true - - resources = [ - "manifest.json", - "property.json", - ] - - sources = [ - "src/main.cc", - "src/tts.cc" - ] - - include_dirs = [ - "include", - "//ten_packages/system/ten_runtime/include", - "//ten_packages/system/azure_speech_sdk/include/microsoft/c_api", - "//ten_packages/system/azure_speech_sdk/include/microsoft/cxx_api", - ] - - lib_dirs = [ - "lib", - "//ten_packages/system/ten_runtime/lib", - "//ten_packages/system/azure_speech_sdk/lib" - ] - - libs = [ - "ten_runtime", - "ten_utils", - "Microsoft.CognitiveServices.Speech.core", - "Microsoft.CognitiveServices.Speech.extension.audio.sys", - "Microsoft.CognitiveServices.Speech.extension.codec", - "Microsoft.CognitiveServices.Speech.extension.kws.ort", - "Microsoft.CognitiveServices.Speech.extension.kws", - "Microsoft.CognitiveServices.Speech.extension.lu", - "Microsoft.CognitiveServices.Speech.extension.mas" - ] -} diff --git a/agents/ten_packages/extension/azure_tts/README.md b/agents/ten_packages/extension/azure_tts/README.md deleted file mode 100644 index e69de29b..00000000 diff --git a/agents/ten_packages/extension/azure_tts/manifest.json b/agents/ten_packages/extension/azure_tts/manifest.json deleted file mode 100644 index 8c7b8e31..00000000 --- a/agents/ten_packages/extension/azure_tts/manifest.json +++ /dev/null @@ -1,55 +0,0 @@ -{ - "type": "extension", - "name": "azure_tts", - "version": "0.4.0", - "dependencies": [ - { - "type": "system", - "name": "ten_runtime", - "version": "0.2" - }, - { - "type": "system", - "name": "azure_speech_sdk", - "version": "1.38.0" - } - ], - "api": { - "property": { - "azure_subscription_key": { - "type": "string" - }, - "azure_subscription_region": { - "type": "string" - }, - "azure_synthesis_voice_name": { - "type": "string" - } - }, - "data_in": [ - { - "name": "text_data", - "property": { - "text": { - "type": "string" - } - } - } - ], - "cmd_in": [ - { - "name": "flush" - } - ], - "cmd_out": [ - { - "name": "flush" - } - ], - "audio_frame_out": [ - { - "name": "pcm_frame" - } - ] - } -} \ No newline at end of file diff --git a/agents/ten_packages/extension/azure_tts/property.json b/agents/ten_packages/extension/azure_tts/property.json deleted file mode 100644 index 9e26dfee..00000000 --- a/agents/ten_packages/extension/azure_tts/property.json +++ /dev/null @@ -1 +0,0 @@ -{} \ No newline at end of file diff --git a/agents/ten_packages/extension/azure_tts/src/log.h b/agents/ten_packages/extension/azure_tts/src/log.h deleted file mode 100644 index bca83eac..00000000 --- a/agents/ten_packages/extension/azure_tts/src/log.h +++ /dev/null @@ -1,17 +0,0 @@ -/** - * - * Agora Real Time Engagement - * Created by Zhang Jie in 2024-06. - * Copyright (c) 2024 Agora IO. All rights reserved. - * - */ -#pragma once - -#define AZURE_TTS_LOG_TAG "AZURE_TTS_EXTENSION" - -#include "ten_utils/log/log.h" - -#define AZURE_TTS_LOGI(...) TEN_LOG_WRITE(TEN_LOG_INFO, AZURE_TTS_LOG_TAG, __VA_ARGS__) -#define AZURE_TTS_LOGE(...) TEN_LOG_WRITE(TEN_LOG_ERROR, AZURE_TTS_LOG_TAG, __VA_ARGS__) -#define AZURE_TTS_LOGW(...) TEN_LOG_WRITE(TEN_LOG_WARN, AZURE_TTS_LOG_TAG, __VA_ARGS__) -#define AZURE_TTS_LOGD(...) TEN_LOG_WRITE(TEN_LOG_DEBUG, AZURE_TTS_LOG_TAG, __VA_ARGS__) diff --git a/agents/ten_packages/extension/azure_tts/src/main.cc b/agents/ten_packages/extension/azure_tts/src/main.cc deleted file mode 100644 index aaec9fd2..00000000 --- a/agents/ten_packages/extension/azure_tts/src/main.cc +++ /dev/null @@ -1,166 +0,0 @@ -/** - * - * Agora Real Time Engagement - * Created by Wei Hu in 2022-02. - * Copyright (c) 2024 Agora IO. All rights reserved. - * - */ - -#include -#include -#include -#include - -#include "log.h" -#include "ten_runtime/binding/cpp/ten.h" -#include "ten_utils/macro/check.h" -#include "tts.h" - -namespace azure_tts_extension { - -class azure_tts_extension_t : public ten::extension_t { - public: - explicit azure_tts_extension_t(const std::string &name) : extension_t(name) {} - - // on_start will be called when the extension is starting, - // properies can be read here to initialize and start the extension. - // current supported properties: - // - azure_subscription_key - // - azure_subscription_region - // - azure_synthesis_voice_name - void on_start(ten::ten_env_t &ten) override { - AZURE_TTS_LOGI("start"); - - // read properties - auto key = ten.get_property_string("azure_subscription_key"); - auto region = ten.get_property_string("azure_subscription_region"); - auto voice_name = ten.get_property_string("azure_synthesis_voice_name"); - if (key.empty() || region.empty() || voice_name.empty()) { - AZURE_TTS_LOGE( - "azure_subscription_key, azure_subscription_region, azure_synthesis_voice_name should not be empty, start " - "failed"); - return; - } - - ten_proxy_ = std::unique_ptr(ten::ten_env_proxy_t::create(ten)); - TEN_ASSERT(ten_proxy_ != nullptr, "ten_proxy should not be nullptr"); - - // pcm parameters - auto sample_rate = 16000; - auto samples_per_10ms = sample_rate / 100; - auto channel = 1; - auto bytes_per_sample = 2; - auto pcm_frame_size = samples_per_10ms * channel * bytes_per_sample; // per 10ms - - // initialize the callback to send pcm to RTC extension - auto pcm_callback = - [ten_proxy = ten_proxy_.get(), sample_rate, bytes_per_sample, samples_per_10ms, channel, pcm_frame_size]( - const uint8_t *data, - size_t size) { - auto pcm_frame = ten::audio_frame_t::create("pcm_frame"); - pcm_frame->set_bytes_per_sample(bytes_per_sample); - pcm_frame->set_sample_rate(sample_rate); - pcm_frame->set_channel_layout(1); - pcm_frame->set_number_of_channels(channel); - pcm_frame->set_timestamp(0); - pcm_frame->set_data_fmt(TEN_AUDIO_FRAME_DATA_FMT_INTERLEAVE); - pcm_frame->set_samples_per_channel(samples_per_10ms); - pcm_frame->alloc_buf(pcm_frame_size); - ten::buf_t borrowed_buf = pcm_frame->lock_buf(0); - auto *buf = borrowed_buf.data(); - if (buf != nullptr) { - memset(buf, 0, pcm_frame_size); // fill empty if size is not enough for 10ms - memcpy(buf, data, size); - } - pcm_frame->unlock_buf(borrowed_buf); - - auto pcm_frame_shared = std::make_shared>(std::move(pcm_frame)); - ten_proxy->notify( - [frame = std::move(pcm_frame_shared)](ten::ten_env_t &ten) { ten.send_audio_frame(std::move(*frame)); }); - }; - - // initialize Azure TTS - azure_tts_ = std::make_unique( - key, - region, - voice_name, - Microsoft::CognitiveServices::Speech::SpeechSynthesisOutputFormat::Raw16Khz16BitMonoPcm, - pcm_frame_size, - std::move(pcm_callback)); - TEN_ASSERT(azure_tts_ != nullptr, "azure_tts should not be nullptr"); - - azure_tts_->Start(); - - ten.on_start_done(); - AZURE_TTS_LOGI("start done"); - } - - // on_cmd receives cmd from ten graph. - // current supported cmd: - // - name: flush - // example: - // {"name": "flush"} - void on_cmd(ten::ten_env_t &ten, std::unique_ptr cmd) override { - std::string command = cmd->get_name(); - AZURE_TTS_LOGI("%s", command.c_str()); - - if (command == kCmdNameFlush) { - // flush here - azure_tts_->Flush(); - - // passthrough cmd - auto ret = ten.send_cmd(ten::cmd_t::create(kCmdNameFlush.c_str())); - if (!ret) { - AZURE_TTS_LOGE("Failed to send cmd %s", kCmdNameFlush.c_str()); - ten.return_result(ten::cmd_result_t::create(TEN_STATUS_CODE_ERROR), std::move(cmd)); - } else { - ten.return_result(ten::cmd_result_t::create(TEN_STATUS_CODE_OK), std::move(cmd)); - } - } else { - ten.return_result(ten::cmd_result_t::create(TEN_STATUS_CODE_OK), std::move(cmd)); - } - } - - // on_data receives data from ten graph. - // current supported data: - // - name: text_data - // example: - // {"name": "text_data", "properties": {"text": "hello"} - void on_data(ten::ten_env_t &ten, std::unique_ptr data) override { - auto text = data->get_property_string(kDataFieldText.c_str()); - if (text.empty()) { - AZURE_TTS_LOGD("input text is empty, ignored"); - return; - } - AZURE_TTS_LOGI("input text: [%s]", text.c_str()); - - // push received text to tts queue for synthesis - azure_tts_->Push(text); - } - - // on_stop will be called when the extension is stopping. - void on_stop(ten::ten_env_t &ten) override { - AZURE_TTS_LOGI("stop"); - if (azure_tts_) { - azure_tts_->Stop(); - azure_tts_ = nullptr; - } - ten_proxy_.reset(); - - // Extension stop. - ten.on_stop_done(); - AZURE_TTS_LOGI("stop done"); - } - - private: - std::unique_ptr ten_proxy_; - - std::unique_ptr azure_tts_; - - const std::string kCmdNameFlush{"flush"}; - const std::string kDataFieldText{"text"}; -}; - -TEN_CPP_REGISTER_ADDON_AS_EXTENSION(azure_tts, azure_tts_extension_t); - -} // namespace azure_tts_extension diff --git a/agents/ten_packages/extension/azure_tts/src/tts.cc b/agents/ten_packages/extension/azure_tts/src/tts.cc deleted file mode 100644 index 6da75544..00000000 --- a/agents/ten_packages/extension/azure_tts/src/tts.cc +++ /dev/null @@ -1,200 +0,0 @@ - -#include "tts.h" - -#include - -#include -#include -#include - -namespace azure_tts_extension { - -bool AzureTTS::Start() { - try { - auto config = Microsoft::CognitiveServices::Speech::SpeechConfig::FromSubscription(key_, region_); - config->SetSpeechSynthesisVoiceName(voice_name_); - config->SetSpeechSynthesisOutputFormat(format_); - - speech_synthesizer_ = Microsoft::CognitiveServices::Speech::SpeechSynthesizer::FromConfig(config, nullptr); - AZURE_TTS_LOGI("speech_synthesizer created"); - - // pre-connect and reuse SpeechSynthesizer to avoid first time connection latency - connection_ = Microsoft::CognitiveServices::Speech::Connection::FromSpeechSynthesizer(speech_synthesizer_); - connection_->Open(true); - AZURE_TTS_LOGI("speech_synthesizer opened"); - } catch (const std::exception& e) { - AZURE_TTS_LOGE("speech_synthesizer exception catched: %s", e.what()); - return false; - } - - // start thread to process tts tasks one by one - thread_ = std::thread([this]() { - AZURE_TTS_LOGI("tts_thread started"); - - while (!stop_.load()) { - std::unique_ptr task = nullptr; - - { - std::unique_lock lk(tasks_mutex_); - tasks_cv_.wait(lk, [this]() { return stop_.load() || !tasks_.empty(); }); - if (stop_.load()) { - break; - } - task = std::move(tasks_.front()); - tasks_.pop(); - } - - SpeechText(task->text, task->ts); - } - - AZURE_TTS_LOGI("tts_thread stopped"); - }); - - return true; -} - -bool AzureTTS::Stop() { - stop_.store(true); - - { - std::lock_guard lk(tasks_mutex_); - tasks_cv_.notify_one(); - } - - if (thread_.joinable()) { - thread_.join(); - } - return true; -} - -void AzureTTS::Push(const std::string& text) noexcept { - auto ts = time_since_epoch_in_us(); - - { - std::unique_lock lock(tasks_mutex_); - tasks_.emplace(std::make_unique(text, ts)); - tasks_cv_.notify_one(); - - AZURE_TTS_LOGD("task pushed for text: [%s], text_recv_ts: %" PRId64 ", queue size %d", - text.c_str(), - ts, - int(tasks_.size())); - } -} - -void AzureTTS::Flush() noexcept { - outdate_ts_.store(time_since_epoch_in_us()); - - { - std::lock_guard lock(tasks_mutex_); - - auto q = std::queue>(); - tasks_.swap(q); - AZURE_TTS_LOGI("tasks flushed, size %d", int(q.size())); - } -} - -void AzureTTS::SpeechText(const std::string& text, int64_t text_recv_ts) { - auto start_time = time_since_epoch_in_us(); - AZURE_TTS_LOGD("task starting for text: [%s], text_recv_ts: %" PRId64, text.c_str(), text_recv_ts); - - if (text_recv_ts < outdate_ts_.load()) { - AZURE_TTS_LOGI("task discard for text: [%s], text_recv_ts: %" PRId64 ", outdate_ts: %" PRId64, - text.c_str(), - text_recv_ts, - outdate_ts_.load()); - return; - } - - using namespace Microsoft::CognitiveServices; - - // async mode - auto result = speech_synthesizer_->StartSpeakingTextAsync(text).get(); - if (result->Reason == Speech::ResultReason::Canceled) { - auto cancellation = Speech::SpeechSynthesisCancellationDetails::FromResult(result); - AZURE_TTS_LOGW("task canceled for text: [%s], text_recv_ts: %" PRId64 ", reason: %d", - text.c_str(), - text_recv_ts, - (int)cancellation->Reason); - - if (cancellation->Reason == Speech::CancellationReason::Error) { - AZURE_TTS_LOGW("task canceled on error for text: [%s], text_recv_ts: %" PRId64 - ", errorcode: %d, details: %s, did you update the subscription info?", - text.c_str(), - text_recv_ts, - (int)cancellation->ErrorCode, - cancellation->ErrorDetails.c_str()); - } - return; - } - - auto audioDataStream = Speech::AudioDataStream::FromResult(result); - - auto buffer = pcm_frame_buffer_.get(); - memset(buffer, 0, pcm_frame_size_); - - int64_t read_bytes = 0, sent_frames = 0; - int64_t first_frame_time = 0, first_frame_latency = 0; - uint32_t filledSize = 0; - while ((filledSize = audioDataStream->ReadData(buffer, pcm_frame_size_)) > 0) { - read_bytes += int64_t(filledSize); - if (text_recv_ts < outdate_ts_.load()) { - speech_synthesizer_->StopSpeakingAsync(); - - AZURE_TTS_LOGI("task discard for text: [%s], text_recv_ts: %" PRId64 ", outdate_ts: %" PRId64 - ", read_bytes: %" PRId64 ", sent_frames: %" PRId64, - text.c_str(), - text_recv_ts, - outdate_ts_.load(), - read_bytes, - sent_frames); - break; - } - - if (first_frame_time == 0) { - first_frame_time = time_since_epoch_in_us(); - first_frame_latency = (first_frame_time - start_time) / 1000; - AZURE_TTS_LOGD("task first frame available for text: [%s], text_recv_ts: %" PRId64 ", first_frame_latency: %" PRId64 - "ms", - text.c_str(), - text_recv_ts, - first_frame_latency); - } - - if (filledSize != pcm_frame_size_) { - AZURE_TTS_LOGD("read data size %d != pcm_frame_size %d", filledSize, pcm_frame_size_); - } - - if (pcm_frame_callback_ != nullptr) { - pcm_frame_callback_(buffer, filledSize); - } - memset(buffer, 0, pcm_frame_size_); - sent_frames++; - } - - auto synthesis_first_byte_latency = - std::stoi(result->Properties.GetProperty(Speech::PropertyId::SpeechServiceResponse_SynthesisFirstByteLatencyMs)); - auto synthesis_finish_latency = - std::stoi(result->Properties.GetProperty(Speech::PropertyId::SpeechServiceResponse_SynthesisFinishLatencyMs)); - - auto finish_latency = (time_since_epoch_in_us() - start_time) / 1000; - - AZURE_TTS_LOGI("task finished for text: [%s], text_recv_ts: %" PRId64 ", read_bytes: %" PRId64 ", sent_frames: %" PRId64 - ", first_frame_latency: %" PRId64 "ms, finish_latency: %" PRId64 - "ms, synthesis_first_byte_latency: %dms, synthesis_finish_latency: %dms", - text.c_str(), - text_recv_ts, - read_bytes, - sent_frames, - first_frame_latency, - finish_latency, - synthesis_first_byte_latency, - synthesis_finish_latency); -} - -int64_t AzureTTS::time_since_epoch_in_us() const { - return std::chrono::duration_cast(std::chrono::system_clock::now().time_since_epoch()) - .count(); -} - -} // namespace azure_tts_extension \ No newline at end of file diff --git a/agents/ten_packages/extension/azure_tts/src/tts.h b/agents/ten_packages/extension/azure_tts/src/tts.h deleted file mode 100644 index 7ab191af..00000000 --- a/agents/ten_packages/extension/azure_tts/src/tts.h +++ /dev/null @@ -1,80 +0,0 @@ - -#include - -#include -#include -#include -#include -#include -#include -#include -#include - -#include "log.h" - -namespace azure_tts_extension { - -using PCMFrameCallback = std::function; - -class AzureTTS { - public: - explicit AzureTTS(const std::string &key, - const std::string ®ion, - const std::string &voice_name, - const Microsoft::CognitiveServices::Speech::SpeechSynthesisOutputFormat format, - const uint32_t pcm_frame_size, - PCMFrameCallback &&callback) - : key_(key), - region_(region), - voice_name_(voice_name), - format_(format), - pcm_frame_callback_(std::move(callback)), - pcm_frame_size_(pcm_frame_size), - pcm_frame_buffer_(std::make_unique(pcm_frame_size_)) { - assert(pcm_frame_size_ > 0); - assert(pcm_frame_buffer_); - } - - bool Start(); - bool Stop(); - - void Flush() noexcept; - - void Push(const std::string &text) noexcept; - - private: - void SpeechText(const std::string &text, int64_t text_recv_ts); - - int64_t time_since_epoch_in_us() const; - - private: - const std::string key_; - const std::string region_; - const std::string voice_name_; - const Microsoft::CognitiveServices::Speech::SpeechSynthesisOutputFormat format_; - - std::shared_ptr speech_synthesizer_; - std::shared_ptr connection_; - - std::atomic_int64_t outdate_ts_{0}; // for flushing - - struct Task { - Task(const std::string &t, int64_t ts) : ts(ts), text(t) {} - - int64_t ts{0}; - std::string text; - }; - - std::queue> tasks_; - std::mutex tasks_mutex_; - std::condition_variable tasks_cv_; - - std::thread thread_; - std::atomic_bool stop_{false}; - - PCMFrameCallback pcm_frame_callback_{nullptr}; - const uint32_t pcm_frame_size_{0}; - std::unique_ptr pcm_frame_buffer_; -}; - -} // namespace azure_tts_extension \ No newline at end of file diff --git a/agents/ten_packages/extension/chat_transcriber/extension.go b/agents/ten_packages/extension/chat_transcriber/extension.go deleted file mode 100644 index db37a314..00000000 --- a/agents/ten_packages/extension/chat_transcriber/extension.go +++ /dev/null @@ -1,148 +0,0 @@ -/** - * - * Agora Real Time Engagement - * Created by Wei Hu in 2022-10. - * Copyright (c) 2024 Agora IO. All rights reserved. - * - */ -package extension - -import ( - "chat_transcriber/pb" - "fmt" - "log/slog" - "time" - - "ten_framework/ten" - - "google.golang.org/protobuf/proto" -) - -const ( - textDataTextField = "text" - textDataFinalField = "is_final" - textDataStreamIdField = "stream_id" - textDataEndOfSegmentField = "end_of_segment" -) - -var ( - logTag = slog.String("extension", "CHAT_TRANSCRIBER_EXTENSION") -) - -type chatTranscriberExtension struct { - ten.DefaultExtension - - cachedTextMap map[uint32]string // record the cached text data for each stream id -} - -func newExtension(name string) ten.Extension { - return &chatTranscriberExtension{ - cachedTextMap: make(map[uint32]string), - } -} - -// OnData receives data from ten graph. -// current suppotend data: -// - name: text_data -// example: -// {"name": "text_data", "properties": {"text": "hello", "is_final": true, "stream_id": 123, "end_of_segment": true}} -func (p *chatTranscriberExtension) OnData( - tenEnv ten.TenEnv, - data ten.Data, -) { - // Get the text data from data. - text, err := data.GetPropertyString(textDataTextField) - if err != nil { - slog.Warn(fmt.Sprintf("OnData GetProperty %s error: %v", textDataTextField, err), logTag) - return - } - - // Get the 'is_final' flag from data which indicates whether the text is final, - // otherwise it could be overwritten by the next text. - final, err := data.GetPropertyBool(textDataFinalField) - if err != nil { - slog.Warn(fmt.Sprintf("OnData GetProperty %s error: %v", textDataFinalField, err), logTag) - return - } - - // Get the stream id from data. - streamId, err := data.GetPropertyUint32(textDataStreamIdField) - if err != nil { - slog.Warn(fmt.Sprintf("OnData GetProperty %s error: %v", textDataStreamIdField, err), logTag) - return - } - - // Get the 'end_of_segment' flag from data which indicates whether a line break is needed. - endOfSegment, err := data.GetPropertyBool(textDataEndOfSegmentField) - if err != nil { - slog.Warn(fmt.Sprintf("OnData GetProperty %s error: %v", textDataEndOfSegmentField, err), logTag) - return - } - - slog.Debug(fmt.Sprintf( - "OnData %s: %s %s: %t %s: %d %s: %t", - textDataTextField, - text, - textDataFinalField, - final, - textDataStreamIdField, - streamId, - textDataEndOfSegmentField, - endOfSegment), logTag) - - // We cache all final text data and append the non-final text data to the cached data - // until the end of the segment. - if endOfSegment { - if cachedText, ok := p.cachedTextMap[streamId]; ok { - text = cachedText + text - delete(p.cachedTextMap, streamId) - } - } else { - if final { - if cachedText, ok := p.cachedTextMap[streamId]; ok { - text = cachedText + text - p.cachedTextMap[streamId] = text - } else { - p.cachedTextMap[streamId] = text - } - } - } - - pb := pb.Text{ - Uid: int32(streamId), - DataType: "transcribe", - Texttime: time.Now().UnixMilli(), - Words: []*pb.Word{ - { - Text: text, - IsFinal: endOfSegment, - }, - }, - } - - pbData, err := proto.Marshal(&pb) - if err != nil { - slog.Warn(fmt.Sprintf("OnData Marshal error: %v", err), logTag) - return - } - - // convert the origin text data to the protobuf data and send it to the graph. - tenData, err := ten.NewData("data") - tenData.SetPropertyBytes("data", pbData) - if err != nil { - slog.Warn(fmt.Sprintf("OnData NewData error: %v", err), logTag) - return - } - - tenEnv.SendData(tenData) -} - -func init() { - slog.Info("chat_transcriber extension init", logTag) - - // Register addon - ten.RegisterAddonAsExtension( - "chat_transcriber", - ten.NewDefaultExtensionAddon(newExtension), - ) -} diff --git a/agents/ten_packages/extension/chat_transcriber/go.mod b/agents/ten_packages/extension/chat_transcriber/go.mod deleted file mode 100644 index 6643f21e..00000000 --- a/agents/ten_packages/extension/chat_transcriber/go.mod +++ /dev/null @@ -1,10 +0,0 @@ -module chat_transcriber - -go 1.20 - -replace ten_framework => ../../system/ten_runtime_go/interface - -require ( - google.golang.org/protobuf v1.34.2 - ten_framework v0.0.0-00010101000000-000000000000 -) diff --git a/agents/ten_packages/extension/chat_transcriber/go.sum b/agents/ten_packages/extension/chat_transcriber/go.sum deleted file mode 100644 index 73d32b16..00000000 --- a/agents/ten_packages/extension/chat_transcriber/go.sum +++ /dev/null @@ -1,4 +0,0 @@ -github.com/google/go-cmp v0.5.5 h1:Khx7svrCpmxxtHBq5j2mp/xVjsi8hQMfNLvJFAlrGgU= -golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543 h1:E7g+9GITq07hpfrRu66IVDexMakfv52eLZ2CXBWiKr4= -google.golang.org/protobuf v1.34.2 h1:6xV6lTsCfpGD21XK49h7MhtcApnLqkfYgPcdHftf6hg= -google.golang.org/protobuf v1.34.2/go.mod h1:qYOHts0dSfpeUzUFpOMr/WGzszTmLH+DiWniOlNbLDw= diff --git a/agents/ten_packages/extension/chat_transcriber/manifest.json b/agents/ten_packages/extension/chat_transcriber/manifest.json deleted file mode 100644 index c318eba2..00000000 --- a/agents/ten_packages/extension/chat_transcriber/manifest.json +++ /dev/null @@ -1,39 +0,0 @@ -{ - "type": "extension", - "name": "chat_transcriber", - "version": "0.4.0", - "dependencies": [ - { - "type": "system", - "name": "ten_runtime_go", - "version": "0.2" - } - ], - "api": { - "property": {}, - "data_in": [ - { - "name": "text_data", - "property": { - "text": { - "type": "string" - }, - "is_final": { - "type": "bool" - }, - "stream_id": { - "type": "uint32" - }, - "end_of_segment": { - "type": "bool" - } - } - } - ], - "data_out": [ - { - "name": "data" - } - ] - } -} \ No newline at end of file diff --git a/agents/ten_packages/extension/chat_transcriber/pb/chat_text.pb.go b/agents/ten_packages/extension/chat_transcriber/pb/chat_text.pb.go deleted file mode 100644 index 034473fd..00000000 --- a/agents/ten_packages/extension/chat_transcriber/pb/chat_text.pb.go +++ /dev/null @@ -1,475 +0,0 @@ -// Code generated by protoc-gen-go. DO NOT EDIT. -// versions: -// protoc-gen-go v1.33.0 -// protoc (unknown) -// source: chat_text.proto - -package pb - -import ( - protoreflect "google.golang.org/protobuf/reflect/protoreflect" - protoimpl "google.golang.org/protobuf/runtime/protoimpl" - reflect "reflect" - sync "sync" -) - -const ( - // Verify that this generated code is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) - // Verify that runtime/protoimpl is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) -) - -type Text struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Vendor int32 `protobuf:"varint,1,opt,name=vendor,proto3" json:"vendor,omitempty"` - Version int32 `protobuf:"varint,2,opt,name=version,proto3" json:"version,omitempty"` - Seqnum int32 `protobuf:"varint,3,opt,name=seqnum,proto3" json:"seqnum,omitempty"` - Uid int32 `protobuf:"varint,4,opt,name=uid,proto3" json:"uid,omitempty"` - Flag int32 `protobuf:"varint,5,opt,name=flag,proto3" json:"flag,omitempty"` - Time int64 `protobuf:"varint,6,opt,name=time,proto3" json:"time,omitempty"` // final time =first nofinal time - Lang int32 `protobuf:"varint,7,opt,name=lang,proto3" json:"lang,omitempty"` - Starttime int32 `protobuf:"varint,8,opt,name=starttime,proto3" json:"starttime,omitempty"` - Offtime int32 `protobuf:"varint,9,opt,name=offtime,proto3" json:"offtime,omitempty"` - Words []*Word `protobuf:"bytes,10,rep,name=words,proto3" json:"words,omitempty"` - EndOfSegment bool `protobuf:"varint,11,opt,name=end_of_segment,json=endOfSegment,proto3" json:"end_of_segment,omitempty"` - DurationMs int32 `protobuf:"varint,12,opt,name=duration_ms,json=durationMs,proto3" json:"duration_ms,omitempty"` - DataType string `protobuf:"bytes,13,opt,name=data_type,json=dataType,proto3" json:"data_type,omitempty"` // transcribe ,translate - Trans []*Translation `protobuf:"bytes,14,rep,name=trans,proto3" json:"trans,omitempty"` - Culture string `protobuf:"bytes,15,opt,name=culture,proto3" json:"culture,omitempty"` - Texttime int64 `protobuf:"varint,16,opt,name=texttime,proto3" json:"texttime,omitempty"` // pkg timestamp -} - -func (x *Text) Reset() { - *x = Text{} - if protoimpl.UnsafeEnabled { - mi := &file_chat_text_proto_msgTypes[0] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *Text) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*Text) ProtoMessage() {} - -func (x *Text) ProtoReflect() protoreflect.Message { - mi := &file_chat_text_proto_msgTypes[0] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use Text.ProtoReflect.Descriptor instead. -func (*Text) Descriptor() ([]byte, []int) { - return file_chat_text_proto_rawDescGZIP(), []int{0} -} - -func (x *Text) GetVendor() int32 { - if x != nil { - return x.Vendor - } - return 0 -} - -func (x *Text) GetVersion() int32 { - if x != nil { - return x.Version - } - return 0 -} - -func (x *Text) GetSeqnum() int32 { - if x != nil { - return x.Seqnum - } - return 0 -} - -func (x *Text) GetUid() int32 { - if x != nil { - return x.Uid - } - return 0 -} - -func (x *Text) GetFlag() int32 { - if x != nil { - return x.Flag - } - return 0 -} - -func (x *Text) GetTime() int64 { - if x != nil { - return x.Time - } - return 0 -} - -func (x *Text) GetLang() int32 { - if x != nil { - return x.Lang - } - return 0 -} - -func (x *Text) GetStarttime() int32 { - if x != nil { - return x.Starttime - } - return 0 -} - -func (x *Text) GetOfftime() int32 { - if x != nil { - return x.Offtime - } - return 0 -} - -func (x *Text) GetWords() []*Word { - if x != nil { - return x.Words - } - return nil -} - -func (x *Text) GetEndOfSegment() bool { - if x != nil { - return x.EndOfSegment - } - return false -} - -func (x *Text) GetDurationMs() int32 { - if x != nil { - return x.DurationMs - } - return 0 -} - -func (x *Text) GetDataType() string { - if x != nil { - return x.DataType - } - return "" -} - -func (x *Text) GetTrans() []*Translation { - if x != nil { - return x.Trans - } - return nil -} - -func (x *Text) GetCulture() string { - if x != nil { - return x.Culture - } - return "" -} - -func (x *Text) GetTexttime() int64 { - if x != nil { - return x.Texttime - } - return 0 -} - -type Word struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Text string `protobuf:"bytes,1,opt,name=text,proto3" json:"text,omitempty"` - StartMs int32 `protobuf:"varint,2,opt,name=start_ms,json=startMs,proto3" json:"start_ms,omitempty"` - DurationMs int32 `protobuf:"varint,3,opt,name=duration_ms,json=durationMs,proto3" json:"duration_ms,omitempty"` - IsFinal bool `protobuf:"varint,4,opt,name=is_final,json=isFinal,proto3" json:"is_final,omitempty"` - Confidence float64 `protobuf:"fixed64,5,opt,name=confidence,proto3" json:"confidence,omitempty"` -} - -func (x *Word) Reset() { - *x = Word{} - if protoimpl.UnsafeEnabled { - mi := &file_chat_text_proto_msgTypes[1] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *Word) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*Word) ProtoMessage() {} - -func (x *Word) ProtoReflect() protoreflect.Message { - mi := &file_chat_text_proto_msgTypes[1] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use Word.ProtoReflect.Descriptor instead. -func (*Word) Descriptor() ([]byte, []int) { - return file_chat_text_proto_rawDescGZIP(), []int{1} -} - -func (x *Word) GetText() string { - if x != nil { - return x.Text - } - return "" -} - -func (x *Word) GetStartMs() int32 { - if x != nil { - return x.StartMs - } - return 0 -} - -func (x *Word) GetDurationMs() int32 { - if x != nil { - return x.DurationMs - } - return 0 -} - -func (x *Word) GetIsFinal() bool { - if x != nil { - return x.IsFinal - } - return false -} - -func (x *Word) GetConfidence() float64 { - if x != nil { - return x.Confidence - } - return 0 -} - -type Translation struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - IsFinal bool `protobuf:"varint,1,opt,name=is_final,json=isFinal,proto3" json:"is_final,omitempty"` - Lang string `protobuf:"bytes,2,opt,name=lang,proto3" json:"lang,omitempty"` - Texts []string `protobuf:"bytes,3,rep,name=texts,proto3" json:"texts,omitempty"` -} - -func (x *Translation) Reset() { - *x = Translation{} - if protoimpl.UnsafeEnabled { - mi := &file_chat_text_proto_msgTypes[2] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *Translation) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*Translation) ProtoMessage() {} - -func (x *Translation) ProtoReflect() protoreflect.Message { - mi := &file_chat_text_proto_msgTypes[2] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use Translation.ProtoReflect.Descriptor instead. -func (*Translation) Descriptor() ([]byte, []int) { - return file_chat_text_proto_rawDescGZIP(), []int{2} -} - -func (x *Translation) GetIsFinal() bool { - if x != nil { - return x.IsFinal - } - return false -} - -func (x *Translation) GetLang() string { - if x != nil { - return x.Lang - } - return "" -} - -func (x *Translation) GetTexts() []string { - if x != nil { - return x.Texts - } - return nil -} - -var File_chat_text_proto protoreflect.FileDescriptor - -var file_chat_text_proto_rawDesc = []byte{ - 0x0a, 0x0f, 0x63, 0x68, 0x61, 0x74, 0x5f, 0x74, 0x65, 0x78, 0x74, 0x2e, 0x70, 0x72, 0x6f, 0x74, - 0x6f, 0x12, 0x16, 0x61, 0x67, 0x6f, 0x72, 0x61, 0x2e, 0x63, 0x68, 0x61, 0x74, 0x5f, 0x74, 0x72, - 0x61, 0x6e, 0x73, 0x63, 0x72, 0x69, 0x62, 0x65, 0x72, 0x22, 0xdf, 0x03, 0x0a, 0x04, 0x54, 0x65, - 0x78, 0x74, 0x12, 0x16, 0x0a, 0x06, 0x76, 0x65, 0x6e, 0x64, 0x6f, 0x72, 0x18, 0x01, 0x20, 0x01, - 0x28, 0x05, 0x52, 0x06, 0x76, 0x65, 0x6e, 0x64, 0x6f, 0x72, 0x12, 0x18, 0x0a, 0x07, 0x76, 0x65, - 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x07, 0x76, 0x65, 0x72, - 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x16, 0x0a, 0x06, 0x73, 0x65, 0x71, 0x6e, 0x75, 0x6d, 0x18, 0x03, - 0x20, 0x01, 0x28, 0x05, 0x52, 0x06, 0x73, 0x65, 0x71, 0x6e, 0x75, 0x6d, 0x12, 0x10, 0x0a, 0x03, - 0x75, 0x69, 0x64, 0x18, 0x04, 0x20, 0x01, 0x28, 0x05, 0x52, 0x03, 0x75, 0x69, 0x64, 0x12, 0x12, - 0x0a, 0x04, 0x66, 0x6c, 0x61, 0x67, 0x18, 0x05, 0x20, 0x01, 0x28, 0x05, 0x52, 0x04, 0x66, 0x6c, - 0x61, 0x67, 0x12, 0x12, 0x0a, 0x04, 0x74, 0x69, 0x6d, 0x65, 0x18, 0x06, 0x20, 0x01, 0x28, 0x03, - 0x52, 0x04, 0x74, 0x69, 0x6d, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x6c, 0x61, 0x6e, 0x67, 0x18, 0x07, - 0x20, 0x01, 0x28, 0x05, 0x52, 0x04, 0x6c, 0x61, 0x6e, 0x67, 0x12, 0x1c, 0x0a, 0x09, 0x73, 0x74, - 0x61, 0x72, 0x74, 0x74, 0x69, 0x6d, 0x65, 0x18, 0x08, 0x20, 0x01, 0x28, 0x05, 0x52, 0x09, 0x73, - 0x74, 0x61, 0x72, 0x74, 0x74, 0x69, 0x6d, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x6f, 0x66, 0x66, 0x74, - 0x69, 0x6d, 0x65, 0x18, 0x09, 0x20, 0x01, 0x28, 0x05, 0x52, 0x07, 0x6f, 0x66, 0x66, 0x74, 0x69, - 0x6d, 0x65, 0x12, 0x32, 0x0a, 0x05, 0x77, 0x6f, 0x72, 0x64, 0x73, 0x18, 0x0a, 0x20, 0x03, 0x28, - 0x0b, 0x32, 0x1c, 0x2e, 0x61, 0x67, 0x6f, 0x72, 0x61, 0x2e, 0x63, 0x68, 0x61, 0x74, 0x5f, 0x74, - 0x72, 0x61, 0x6e, 0x73, 0x63, 0x72, 0x69, 0x62, 0x65, 0x72, 0x2e, 0x57, 0x6f, 0x72, 0x64, 0x52, - 0x05, 0x77, 0x6f, 0x72, 0x64, 0x73, 0x12, 0x24, 0x0a, 0x0e, 0x65, 0x6e, 0x64, 0x5f, 0x6f, 0x66, - 0x5f, 0x73, 0x65, 0x67, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x0b, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0c, - 0x65, 0x6e, 0x64, 0x4f, 0x66, 0x53, 0x65, 0x67, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x1f, 0x0a, 0x0b, - 0x64, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x6d, 0x73, 0x18, 0x0c, 0x20, 0x01, 0x28, - 0x05, 0x52, 0x0a, 0x64, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x4d, 0x73, 0x12, 0x1b, 0x0a, - 0x09, 0x64, 0x61, 0x74, 0x61, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x18, 0x0d, 0x20, 0x01, 0x28, 0x09, - 0x52, 0x08, 0x64, 0x61, 0x74, 0x61, 0x54, 0x79, 0x70, 0x65, 0x12, 0x39, 0x0a, 0x05, 0x74, 0x72, - 0x61, 0x6e, 0x73, 0x18, 0x0e, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x23, 0x2e, 0x61, 0x67, 0x6f, 0x72, - 0x61, 0x2e, 0x63, 0x68, 0x61, 0x74, 0x5f, 0x74, 0x72, 0x61, 0x6e, 0x73, 0x63, 0x72, 0x69, 0x62, - 0x65, 0x72, 0x2e, 0x54, 0x72, 0x61, 0x6e, 0x73, 0x6c, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x05, - 0x74, 0x72, 0x61, 0x6e, 0x73, 0x12, 0x18, 0x0a, 0x07, 0x63, 0x75, 0x6c, 0x74, 0x75, 0x72, 0x65, - 0x18, 0x0f, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x63, 0x75, 0x6c, 0x74, 0x75, 0x72, 0x65, 0x12, - 0x1a, 0x0a, 0x08, 0x74, 0x65, 0x78, 0x74, 0x74, 0x69, 0x6d, 0x65, 0x18, 0x10, 0x20, 0x01, 0x28, - 0x03, 0x52, 0x08, 0x74, 0x65, 0x78, 0x74, 0x74, 0x69, 0x6d, 0x65, 0x22, 0x91, 0x01, 0x0a, 0x04, - 0x57, 0x6f, 0x72, 0x64, 0x12, 0x12, 0x0a, 0x04, 0x74, 0x65, 0x78, 0x74, 0x18, 0x01, 0x20, 0x01, - 0x28, 0x09, 0x52, 0x04, 0x74, 0x65, 0x78, 0x74, 0x12, 0x19, 0x0a, 0x08, 0x73, 0x74, 0x61, 0x72, - 0x74, 0x5f, 0x6d, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x07, 0x73, 0x74, 0x61, 0x72, - 0x74, 0x4d, 0x73, 0x12, 0x1f, 0x0a, 0x0b, 0x64, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5f, - 0x6d, 0x73, 0x18, 0x03, 0x20, 0x01, 0x28, 0x05, 0x52, 0x0a, 0x64, 0x75, 0x72, 0x61, 0x74, 0x69, - 0x6f, 0x6e, 0x4d, 0x73, 0x12, 0x19, 0x0a, 0x08, 0x69, 0x73, 0x5f, 0x66, 0x69, 0x6e, 0x61, 0x6c, - 0x18, 0x04, 0x20, 0x01, 0x28, 0x08, 0x52, 0x07, 0x69, 0x73, 0x46, 0x69, 0x6e, 0x61, 0x6c, 0x12, - 0x1e, 0x0a, 0x0a, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x64, 0x65, 0x6e, 0x63, 0x65, 0x18, 0x05, 0x20, - 0x01, 0x28, 0x01, 0x52, 0x0a, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x64, 0x65, 0x6e, 0x63, 0x65, 0x22, - 0x52, 0x0a, 0x0b, 0x54, 0x72, 0x61, 0x6e, 0x73, 0x6c, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x19, - 0x0a, 0x08, 0x69, 0x73, 0x5f, 0x66, 0x69, 0x6e, 0x61, 0x6c, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, - 0x52, 0x07, 0x69, 0x73, 0x46, 0x69, 0x6e, 0x61, 0x6c, 0x12, 0x12, 0x0a, 0x04, 0x6c, 0x61, 0x6e, - 0x67, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6c, 0x61, 0x6e, 0x67, 0x12, 0x14, 0x0a, - 0x05, 0x74, 0x65, 0x78, 0x74, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x09, 0x52, 0x05, 0x74, 0x65, - 0x78, 0x74, 0x73, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x3b, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, - 0x74, 0x6f, 0x33, -} - -var ( - file_chat_text_proto_rawDescOnce sync.Once - file_chat_text_proto_rawDescData = file_chat_text_proto_rawDesc -) - -func file_chat_text_proto_rawDescGZIP() []byte { - file_chat_text_proto_rawDescOnce.Do(func() { - file_chat_text_proto_rawDescData = protoimpl.X.CompressGZIP(file_chat_text_proto_rawDescData) - }) - return file_chat_text_proto_rawDescData -} - -var file_chat_text_proto_msgTypes = make([]protoimpl.MessageInfo, 3) -var file_chat_text_proto_goTypes = []interface{}{ - (*Text)(nil), // 0: agora.chat_transcriber.Text - (*Word)(nil), // 1: agora.chat_transcriber.Word - (*Translation)(nil), // 2: agora.chat_transcriber.Translation -} -var file_chat_text_proto_depIdxs = []int32{ - 1, // 0: agora.chat_transcriber.Text.words:type_name -> agora.chat_transcriber.Word - 2, // 1: agora.chat_transcriber.Text.trans:type_name -> agora.chat_transcriber.Translation - 2, // [2:2] is the sub-list for method output_type - 2, // [2:2] is the sub-list for method input_type - 2, // [2:2] is the sub-list for extension type_name - 2, // [2:2] is the sub-list for extension extendee - 0, // [0:2] is the sub-list for field type_name -} - -func init() { file_chat_text_proto_init() } -func file_chat_text_proto_init() { - if File_chat_text_proto != nil { - return - } - if !protoimpl.UnsafeEnabled { - file_chat_text_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Text); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_chat_text_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Word); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_chat_text_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Translation); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - } - type x struct{} - out := protoimpl.TypeBuilder{ - File: protoimpl.DescBuilder{ - GoPackagePath: reflect.TypeOf(x{}).PkgPath(), - RawDescriptor: file_chat_text_proto_rawDesc, - NumEnums: 0, - NumMessages: 3, - NumExtensions: 0, - NumServices: 0, - }, - GoTypes: file_chat_text_proto_goTypes, - DependencyIndexes: file_chat_text_proto_depIdxs, - MessageInfos: file_chat_text_proto_msgTypes, - }.Build() - File_chat_text_proto = out.File - file_chat_text_proto_rawDesc = nil - file_chat_text_proto_goTypes = nil - file_chat_text_proto_depIdxs = nil -} diff --git a/agents/ten_packages/extension/chat_transcriber/pb/chat_text.proto b/agents/ten_packages/extension/chat_transcriber/pb/chat_text.proto deleted file mode 100644 index 9ee4e504..00000000 --- a/agents/ten_packages/extension/chat_transcriber/pb/chat_text.proto +++ /dev/null @@ -1,37 +0,0 @@ -syntax = "proto3"; - -package agora.chat_transcriber; -option go_package = ".;pb"; - -message Text { - int32 vendor = 1; - int32 version = 2; - int32 seqnum = 3; - int32 uid = 4; - int32 flag = 5; - int64 time = 6; // final time =first nofinal time - int32 lang = 7; - int32 starttime = 8; - int32 offtime = 9; - repeated Word words = 10; - bool end_of_segment = 11; - int32 duration_ms = 12; - string data_type = 13; // transcribe ,translate - repeated Translation trans = 14; - string culture = 15; - int64 texttime = 16; // pkg timestamp -} - -message Word { - string text = 1; - int32 start_ms = 2; - int32 duration_ms = 3; - bool is_final = 4; - double confidence = 5; -} - -message Translation { - bool is_final = 1; - string lang = 2; - repeated string texts = 3; -} \ No newline at end of file diff --git a/agents/ten_packages/extension/chat_transcriber/property.json b/agents/ten_packages/extension/chat_transcriber/property.json deleted file mode 100644 index 9e26dfee..00000000 --- a/agents/ten_packages/extension/chat_transcriber/property.json +++ /dev/null @@ -1 +0,0 @@ -{} \ No newline at end of file