Merge pull request #238 from SuanmoSuanyangTechnology/feature/agent-tool_xjn

fix(model)
This commit is contained in:
Mark
2026-01-29 16:03:34 +08:00
committed by GitHub
7 changed files with 10 additions and 91 deletions

View File

@@ -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})")

View File

@@ -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

View File

@@ -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

View File

@@ -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"

View File

@@ -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="模型配置参数")

View File

@@ -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

View File

@@ -16,7 +16,7 @@ from app.models.prompt_optimizer_model import (
PromptOptimizerSession, PromptOptimizerSession,
RoleType RoleType
) )
from app.repositories.model_repository import ModelConfigRepository from app.repositories.model_repository import ModelConfigRepository, ModelApiKeyRepository
from app.repositories.prompt_optimizer_repository import ( from app.repositories.prompt_optimizer_repository import (
PromptOptimizerSessionRepository PromptOptimizerSessionRepository
) )
@@ -168,7 +168,8 @@ class PromptOptimizerService:
logger.info(f"Prompt optimization started, user_id={user_id}, session_id={session_id}") logger.info(f"Prompt optimization started, user_id={user_id}, session_id={session_id}")
# Create LLM instance # Create LLM instance
api_config: ModelApiKey = model_config.api_keys[0] api_keys = ModelApiKeyRepository.get_by_model_config(self.db, model_config.id)
api_config: ModelApiKey = api_keys[0] if api_keys else None
llm = RedBearLLM(RedBearModelConfig( llm = RedBearLLM(RedBearModelConfig(
model_name=api_config.model_name, model_name=api_config.model_name,
provider=api_config.provider, provider=api_config.provider,