forked from erp-dev/erp
feat: big
This commit is contained in:
@@ -92,8 +92,12 @@ MESSAGE_API_DEFAULT_NEWS_IMAGE_URL = env(
|
||||
'MESSAGE_API_DEFAULT_NEWS_IMAGE_URL',
|
||||
default='https://via.placeholder.com/640x360.png?text=No+Image',
|
||||
)
|
||||
SPEAK_ENDPOINT = env('SPEAK_ENDPOINT', default='http://8.148.215.233:9004/speak')
|
||||
SPEECH_ENABLED = True
|
||||
SPEAK_ENDPOINT = env('SPEAK_ENDPOINT', default='https://tts.yuwen.cloud/speak')
|
||||
SPEAK_API_KEY = 'wobushixiaoai_1216'
|
||||
PRINTING_ORDER_CREATED_SPEECH_ENABLED = False
|
||||
BUSINESS_ORDER_SPEECH_NOTIFY_ENABLED = True
|
||||
MISSION_SPEECH_NOTIFY_ENABLED = True
|
||||
AGENT_ACCESS_KEY = env('AGENT_ACCESS_KEY', default='')
|
||||
|
||||
# HaoBuYe 外部财务同步
|
||||
|
||||
@@ -31,6 +31,8 @@ def play_speech(
|
||||
content = (text or '').strip()
|
||||
if not content:
|
||||
raise ValueError('text 不能为空')
|
||||
if not getattr(settings, 'SPEECH_ENABLED', True):
|
||||
return SpeakResponse(status_code=0, raw={'status': 'disabled'})
|
||||
|
||||
url = (endpoint or getattr(settings, 'SPEAK_ENDPOINT', '') or '').strip()
|
||||
if not url:
|
||||
@@ -38,10 +40,14 @@ def play_speech(
|
||||
|
||||
payload = {'text': content}
|
||||
data = json.dumps(payload, ensure_ascii=False).encode('utf-8')
|
||||
headers = {'Content-Type': 'application/json'}
|
||||
api_key = (getattr(settings, 'SPEAK_API_KEY', '') or '').strip()
|
||||
if api_key:
|
||||
headers['X-Api-Key'] = api_key
|
||||
req = Request(
|
||||
url=url,
|
||||
data=data,
|
||||
headers={'Content-Type': 'application/json'},
|
||||
headers=headers,
|
||||
method='POST',
|
||||
)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user