fix(model): the model type does not allow modification, delete tts and speech2text type

This commit is contained in:
Timebomb2018
2026-01-29 15:21:06 +08:00
parent 24d4cb9b94
commit d291c241d5
6 changed files with 7 additions and 89 deletions

View File

@@ -326,6 +326,8 @@ async def update_composite_model(
api_logger.info(f"更新组合模型请求: model_id={model_id}, 用户: {current_user.username}")
try:
if model_data.type is not None:
raise BusinessException("不允许更改模型类型和供应商", BizCode.INVALID_PARAMETER)
result_orm = await ModelConfigService.update_composite_model(db=db, model_id=model_id, model_data=model_data, tenant_id=current_user.tenant_id)
api_logger.info(f"组合模型更新成功: {result_orm.name} (ID: {model_id})")

View File

@@ -767,26 +767,6 @@ models:
tags:
- 重排序模型
logo: dashscope
- name: paraformer-realtime-v1
type: speech2text
provider: dashscope
description: paraformer-realtime-v1语音转文字模型支持多格式音频/视频文件文件上传限制100MB
is_deprecated: false
is_official: true
tags:
- 语音识别
- 语音转文字
logo: dashscope
- name: paraformer-realtime-v2
type: speech2text
provider: dashscope
description: paraformer-realtime-v2语音转文字模型支持多格式音频/视频文件文件上传限制100MB
is_deprecated: false
is_official: true
tags:
- 语音识别
- 语音转文字
logo: dashscope
- name: multimodal-embedding-v1
type: embedding
provider: dashscope
@@ -838,13 +818,3 @@ models:
- 嵌入模型
- 文本嵌入
logo: dashscope
- name: tts-1
type: tts
provider: dashscope
description: tts-1语音合成模型默认音色知茹新闻女声支持多语言多音色最大文本长度7000字输出MP3格式
is_deprecated: false
is_official: true
tags:
- 语音合成
- 文字转语音
logo: dashscope

View File

@@ -265,33 +265,6 @@ models:
- stream-tool-call
- structured-output
logo: openai
- name: gpt-4o-mini-transcribe
type: speech2text
provider: openai
description: gpt-4o-mini-transcribe语音转文本模型文件上传限制25MB支持flac,mp3,mp4,mpeg,mpga,m4a,ogg,wav,webm格式
is_deprecated: false
is_official: true
tags:
- 语音转文本模型
logo: openai
- name: gpt-4o-transcribe
type: speech2text
provider: openai
description: gpt-4o-transcribe语音转文本模型文件上传限制25MB支持flac,mp3,mp4,mpeg,mpga,m4a,ogg,wav,webm格式
is_deprecated: false
is_official: true
tags:
- 语音转文本模型
logo: openai
- name: whisper-1
type: speech2text
provider: openai
description: whisper-1语音转文本模型文件上传限制25MB支持flac,mp3,mp4,mpeg,mpga,m4a,ogg,wav,webm格式
is_deprecated: false
is_official: true
tags:
- 语音转文本模型
logo: openai
- name: text-embedding-3-large
type: embedding
provider: openai
@@ -319,30 +292,3 @@ models:
tags:
- 文本向量模型
logo: openai
- name: gpt-4o-mini-tts
type: tts
provider: openai
description: gpt-4o-mini-tts文本转语音模型输出音频格式mp3支持多语种语音字数限制3500
is_deprecated: false
is_official: true
tags:
- 文本转语音模型
logo: openai
- name: tts-1-hd
type: tts
provider: openai
description: tts-1-hd高清文本转语音模型输出音频格式mp3支持多语种语音字数限制3500
is_deprecated: false
is_official: true
tags:
- 文本转语音模型
logo: openai
- name: tts-1
type: tts
provider: openai
description: tts-1文本转语音模型输出音频格式mp3支持多语种语音字数限制3500
is_deprecated: false
is_official: true
tags:
- 文本转语音模型
logo: openai

View File

@@ -24,8 +24,8 @@ class ModelType(StrEnum):
CHAT = "chat"
EMBEDDING = "embedding"
RERANK = "rerank"
TTS = "tts"
SPEECH2TEXT = "speech2text"
# TTS = "tts"
# SPEECH2TEXT = "speech2text"
# IMAGE = "image"
# AUDIO = "audio"
# VISION = "vision"

View File

@@ -43,7 +43,7 @@ class ModelConfigCreate(ModelConfigBase):
class CompositeModelCreate(BaseModel):
"""创建组合模型Schema"""
name: str = Field(..., description="组合模型名称", max_length=255)
type: ModelType = Field(..., description="模型类型")
type: Optional[ModelType] = Field(None, description="模型类型")
logo: Optional[str] = Field(None, description="模型logo图片URL", max_length=255)
description: Optional[str] = Field(None, description="模型描述")
config: Optional[Dict[str, Any]] = Field({}, description="模型配置参数")

View File

@@ -382,7 +382,7 @@ class ModelConfigService:
for model_config in api_key.model_configs:
compatible_types = {ModelType.LLM, ModelType.CHAT}
config_type = model_config.type
request_type = model_data.type
request_type = existing_model.type
if not (config_type == request_type or
(config_type in compatible_types and request_type in compatible_types)):
@@ -393,7 +393,7 @@ class ModelConfigService:
# 更新基本信息
existing_model.name = model_data.name
existing_model.type = model_data.type
# existing_model.type = model_data.type
existing_model.logo = model_data.logo
existing_model.description = model_data.description
existing_model.config = model_data.config