fix(model): the model type does not allow modification, delete tts and speech2text type
This commit is contained in:
@@ -326,6 +326,8 @@ async def update_composite_model(
|
|||||||
api_logger.info(f"更新组合模型请求: model_id={model_id}, 用户: {current_user.username}")
|
api_logger.info(f"更新组合模型请求: model_id={model_id}, 用户: {current_user.username}")
|
||||||
|
|
||||||
try:
|
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)
|
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})")
|
api_logger.info(f"组合模型更新成功: {result_orm.name} (ID: {model_id})")
|
||||||
|
|
||||||
|
|||||||
@@ -767,26 +767,6 @@ models:
|
|||||||
tags:
|
tags:
|
||||||
- 重排序模型
|
- 重排序模型
|
||||||
logo: dashscope
|
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
|
- name: multimodal-embedding-v1
|
||||||
type: embedding
|
type: embedding
|
||||||
provider: dashscope
|
provider: dashscope
|
||||||
@@ -838,13 +818,3 @@ models:
|
|||||||
- 嵌入模型
|
- 嵌入模型
|
||||||
- 文本嵌入
|
- 文本嵌入
|
||||||
logo: dashscope
|
logo: dashscope
|
||||||
- name: tts-1
|
|
||||||
type: tts
|
|
||||||
provider: dashscope
|
|
||||||
description: tts-1语音合成模型,默认音色知茹(新闻女声),支持多语言多音色,最大文本长度7000字,输出MP3格式
|
|
||||||
is_deprecated: false
|
|
||||||
is_official: true
|
|
||||||
tags:
|
|
||||||
- 语音合成
|
|
||||||
- 文字转语音
|
|
||||||
logo: dashscope
|
|
||||||
|
|||||||
@@ -265,33 +265,6 @@ models:
|
|||||||
- stream-tool-call
|
- stream-tool-call
|
||||||
- structured-output
|
- structured-output
|
||||||
logo: openai
|
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
|
- name: text-embedding-3-large
|
||||||
type: embedding
|
type: embedding
|
||||||
provider: openai
|
provider: openai
|
||||||
@@ -319,30 +292,3 @@ models:
|
|||||||
tags:
|
tags:
|
||||||
- 文本向量模型
|
- 文本向量模型
|
||||||
logo: openai
|
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
|
|
||||||
|
|||||||
@@ -24,8 +24,8 @@ class ModelType(StrEnum):
|
|||||||
CHAT = "chat"
|
CHAT = "chat"
|
||||||
EMBEDDING = "embedding"
|
EMBEDDING = "embedding"
|
||||||
RERANK = "rerank"
|
RERANK = "rerank"
|
||||||
TTS = "tts"
|
# TTS = "tts"
|
||||||
SPEECH2TEXT = "speech2text"
|
# SPEECH2TEXT = "speech2text"
|
||||||
# IMAGE = "image"
|
# IMAGE = "image"
|
||||||
# AUDIO = "audio"
|
# AUDIO = "audio"
|
||||||
# VISION = "vision"
|
# VISION = "vision"
|
||||||
|
|||||||
@@ -43,7 +43,7 @@ class ModelConfigCreate(ModelConfigBase):
|
|||||||
class CompositeModelCreate(BaseModel):
|
class CompositeModelCreate(BaseModel):
|
||||||
"""创建组合模型Schema"""
|
"""创建组合模型Schema"""
|
||||||
name: str = Field(..., description="组合模型名称", max_length=255)
|
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)
|
logo: Optional[str] = Field(None, description="模型logo图片URL", max_length=255)
|
||||||
description: Optional[str] = Field(None, description="模型描述")
|
description: Optional[str] = Field(None, description="模型描述")
|
||||||
config: Optional[Dict[str, Any]] = Field({}, description="模型配置参数")
|
config: Optional[Dict[str, Any]] = Field({}, description="模型配置参数")
|
||||||
|
|||||||
@@ -382,7 +382,7 @@ class ModelConfigService:
|
|||||||
for model_config in api_key.model_configs:
|
for model_config in api_key.model_configs:
|
||||||
compatible_types = {ModelType.LLM, ModelType.CHAT}
|
compatible_types = {ModelType.LLM, ModelType.CHAT}
|
||||||
config_type = model_config.type
|
config_type = model_config.type
|
||||||
request_type = model_data.type
|
request_type = existing_model.type
|
||||||
|
|
||||||
if not (config_type == request_type or
|
if not (config_type == request_type or
|
||||||
(config_type in compatible_types and request_type in compatible_types)):
|
(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.name = model_data.name
|
||||||
existing_model.type = model_data.type
|
# existing_model.type = model_data.type
|
||||||
existing_model.logo = model_data.logo
|
existing_model.logo = model_data.logo
|
||||||
existing_model.description = model_data.description
|
existing_model.description = model_data.description
|
||||||
existing_model.config = model_data.config
|
existing_model.config = model_data.config
|
||||||
|
|||||||
Reference in New Issue
Block a user