从新提交到gitee 仓库
This commit is contained in:
@@ -140,6 +140,7 @@ class TenantLLMService(CommonService):
|
||||
if llm_type == LLMType.TTS:
|
||||
if model_config["llm_factory"] not in TTSModel:
|
||||
return
|
||||
# 初始化 tts model cyx
|
||||
return TTSModel[model_config["llm_factory"]](
|
||||
model_config["api_key"],
|
||||
model_config["llm_name"],
|
||||
@@ -201,6 +202,8 @@ class LLMBundle(object):
|
||||
assert self.mdl, "Can't find model for {}/{}/{}".format(
|
||||
tenant_id, llm_type, llm_name)
|
||||
self.max_length = 8192
|
||||
if llm_type == LLMType.TTS:
|
||||
logging.info(f"dale--TTS model {tenant_id} {llm_type} {llm_name}")
|
||||
for lm in LLMService.query(llm_name=llm_name):
|
||||
self.max_length = lm.max_tokens
|
||||
break
|
||||
@@ -245,7 +248,7 @@ class LLMBundle(object):
|
||||
"LLMBundle.transcription can't update token usage for {}/SEQUENCE2TXT used_tokens: {}".format(self.tenant_id, used_tokens))
|
||||
return txt
|
||||
|
||||
def tts(self, text):
|
||||
def tts(self, text): # tts 调用 cyx
|
||||
for chunk in self.mdl.tts(text):
|
||||
if isinstance(chunk,int):
|
||||
if not TenantLLMService.increase_usage(
|
||||
@@ -253,7 +256,10 @@ class LLMBundle(object):
|
||||
logging.error(
|
||||
"LLMBundle.tts can't update token usage for {}/TTS".format(self.tenant_id))
|
||||
return
|
||||
yield chunk
|
||||
yield chunk
|
||||
|
||||
def end_tts(self): # 结束 tts流式 调用 cyx
|
||||
self.mdl.end_tts()
|
||||
|
||||
def chat(self, system, history, gen_conf):
|
||||
txt, used_tokens = self.mdl.chat(system, history, gen_conf)
|
||||
|
||||
Reference in New Issue
Block a user