Skip to content

Commit 9f8115c

Browse files
committed
[fix] tts input msg escape
1 parent 2bb50d5 commit 9f8115c

3 files changed

Lines changed: 9 additions & 4 deletions

File tree

projects/llm_framework/main_melotts/src/main.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,8 @@ class llm_task {
127127
return -1;
128128
}
129129
nlohmann::json file_body;
130-
std::list<std::string> config_file_paths = get_config_file_paths(base_model_path_, base_model_config_path_, model_);
130+
std::list<std::string> config_file_paths =
131+
get_config_file_paths(base_model_path_, base_model_config_path_, model_);
131132
// Compatible operation
132133
if (model_ == "melotts_zh-cn")
133134
config_file_paths = get_config_file_paths(base_model_path_, base_model_config_path_, "melotts-zh-cn");
@@ -427,7 +428,8 @@ class llm_tts : public StackFlow {
427428
}
428429
next_data = &tmp_msg2;
429430
}
430-
std::vector<std::string> tmp_data = llm_task_obj->lexicon_->splitEachChar((*next_data));
431+
std::string user_msg = sample_unescapeString(*next_data);
432+
std::vector<std::string> tmp_data = llm_task_obj->lexicon_->splitEachChar(user_msg);
431433
for (auto cutf8 : tmp_data) {
432434
if (is_breakpoint(cutf8)) {
433435
llm_task_obj->tts_string_stream_buff += cutf8;

projects/llm_framework/main_tts/src/main.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -268,7 +268,8 @@ class llm_tts : public StackFlow {
268268
}
269269
next_data = &tmp_msg2;
270270
}
271-
std::vector<std::string> tmp_data = splitEachChar((*next_data));
271+
std::string user_msg = sample_unescapeString(*next_data);
272+
std::vector<std::string> tmp_data = splitEachChar(user_msg);
272273
for (auto cutf8 : tmp_data) {
273274
if (cutf8 == "" || cutf8 == "" || cutf8 == "," || cutf8 == "" || cutf8 == "." || cutf8 == "!" ||
274275
cutf8 == "" || cutf8 == "?" || cutf8 == "" || cutf8 == ";" || cutf8 == "") {

projects/llm_framework/tools/llm_pack.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -157,11 +157,13 @@ def create_data_deb(package_name, version, src_folder, revision = 'm5stack1'):
157157
if os.path.exists(zip_file_extrpath):
158158
shutil.copytree(zip_file_extrpath, os.path.join(deb_folder, 'opt/m5stack/data'))
159159

160+
RED = "\033[31m"
161+
RESET = "\033[0m"
160162
os.makedirs(os.path.join(deb_folder, 'opt/m5stack/data/models'), exist_ok = True)
161163
if os.path.exists(os.path.join(src_folder,'mode_{}.json'.format(package_name[4:]))):
162164
shutil.copy2(os.path.join(src_folder,'mode_{}.json'.format(package_name[4:])), os.path.join(deb_folder, 'opt/m5stack/data/models', 'mode_{}.json'.format(package_name[4:])))
163165
else:
164-
print(os.path.join(src_folder,'mode_{}.json'.format(package_name[4:])), " miss")
166+
print(RED, os.path.join(src_folder,'mode_{}.json'.format(package_name[4:])), " miss", RESET)
165167

166168
os.makedirs(os.path.join(deb_folder, 'DEBIAN'), exist_ok = True)
167169
with open(os.path.join(deb_folder, 'DEBIAN/control'),'w') as f:

0 commit comments

Comments
 (0)