Skip to content

Commit abbe554

Browse files
committed
Enable custom api for all models.
1 parent fc1c9fe commit abbe554

1 file changed

Lines changed: 34 additions & 2 deletions

File tree

utils/config_manager.py

Lines changed: 34 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -786,16 +786,48 @@ def get_core_config(self):
786786
enable_custom_api = core_cfg.get('enableCustomApi', False)
787787
config['ENABLE_CUSTOM_API'] = enable_custom_api
788788

789-
# 只有在启用自定义API时才允许覆盖视觉模型相关字段
789+
# 只有在启用自定义API时才允许覆盖各模型相关字段
790790
if enable_custom_api:
791+
# Summary(摘要)模型自定义配置映射
792+
if core_cfg.get('summaryModelApiKey') is not None:
793+
config['SUMMARY_MODEL_API_KEY'] = core_cfg.get('summaryModelApiKey', '') or config.get('SUMMARY_MODEL_API_KEY', '')
794+
if core_cfg.get('summaryModelUrl') is not None:
795+
config['SUMMARY_MODEL_URL'] = core_cfg.get('summaryModelUrl', '') or config.get('SUMMARY_MODEL_URL', '')
796+
if core_cfg.get('summaryModelId') is not None:
797+
config['SUMMARY_MODEL'] = core_cfg.get('summaryModelId', '') or config.get('SUMMARY_MODEL', '')
798+
799+
# Correction(纠错)模型自定义配置映射
800+
if core_cfg.get('correctionModelApiKey') is not None:
801+
config['CORRECTION_MODEL_API_KEY'] = core_cfg.get('correctionModelApiKey', '') or config.get('CORRECTION_MODEL_API_KEY', '')
802+
if core_cfg.get('correctionModelUrl') is not None:
803+
config['CORRECTION_MODEL_URL'] = core_cfg.get('correctionModelUrl', '') or config.get('CORRECTION_MODEL_URL', '')
804+
if core_cfg.get('correctionModelId') is not None:
805+
config['CORRECTION_MODEL'] = core_cfg.get('correctionModelId', '') or config.get('CORRECTION_MODEL', '')
806+
807+
# Emotion(情感分析)模型自定义配置映射
808+
if core_cfg.get('emotionModelApiKey') is not None:
809+
config['EMOTION_MODEL_API_KEY'] = core_cfg.get('emotionModelApiKey', '') or config.get('EMOTION_MODEL_API_KEY', '')
810+
if core_cfg.get('emotionModelUrl') is not None:
811+
config['EMOTION_MODEL_URL'] = core_cfg.get('emotionModelUrl', '') or config.get('EMOTION_MODEL_URL', '')
812+
if core_cfg.get('emotionModelId') is not None:
813+
config['EMOTION_MODEL'] = core_cfg.get('emotionModelId', '') or config.get('EMOTION_MODEL', '')
814+
815+
# Vision(视觉)模型自定义配置映射
791816
if core_cfg.get('visionModelApiKey') is not None:
792817
config['VISION_MODEL_API_KEY'] = core_cfg.get('visionModelApiKey', '') or config.get('VISION_MODEL_API_KEY', '')
793818
if core_cfg.get('visionModelUrl') is not None:
794819
config['VISION_MODEL_URL'] = core_cfg.get('visionModelUrl', '') or config.get('VISION_MODEL_URL', '')
795820
if core_cfg.get('visionModelId') is not None:
796-
# 将 core_cfg 中的 visionModelId 映射到内部的 VISION_MODEL(模型ID)
797821
config['VISION_MODEL'] = core_cfg.get('visionModelId', '') or config.get('VISION_MODEL', '')
798822

823+
# Omni/Realtime(全模态/实时)模型自定义配置映射
824+
if core_cfg.get('omniModelApiKey') is not None:
825+
config['REALTIME_MODEL_API_KEY'] = core_cfg.get('omniModelApiKey', '') or config.get('REALTIME_MODEL_API_KEY', '')
826+
if core_cfg.get('omniModelUrl') is not None:
827+
config['REALTIME_MODEL_URL'] = core_cfg.get('omniModelUrl', '') or config.get('REALTIME_MODEL_URL', '')
828+
if core_cfg.get('omniModelId') is not None:
829+
config['REALTIME_MODEL'] = core_cfg.get('omniModelId', '') or config.get('REALTIME_MODEL', '')
830+
799831
# TTS 自定义配置映射
800832
if core_cfg.get('ttsModelApiKey') is not None:
801833
config['TTS_MODEL_API_KEY'] = core_cfg.get('ttsModelApiKey', '') or config.get('TTS_MODEL_API_KEY', '')

0 commit comments

Comments
 (0)