Merge branch 'refs/heads/develop' into add/develop_memory
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}")
|
||||
|
||||
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})")
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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"
|
||||
|
||||
@@ -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="模型配置参数")
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -16,7 +16,7 @@ from app.models.prompt_optimizer_model import (
|
||||
PromptOptimizerSession,
|
||||
RoleType
|
||||
)
|
||||
from app.repositories.model_repository import ModelConfigRepository
|
||||
from app.repositories.model_repository import ModelConfigRepository, ModelApiKeyRepository
|
||||
from app.repositories.prompt_optimizer_repository import (
|
||||
PromptOptimizerSessionRepository
|
||||
)
|
||||
@@ -168,7 +168,8 @@ class PromptOptimizerService:
|
||||
logger.info(f"Prompt optimization started, user_id={user_id}, session_id={session_id}")
|
||||
|
||||
# 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(
|
||||
model_name=api_config.model_name,
|
||||
provider=api_config.provider,
|
||||
|
||||
Reference in New Issue
Block a user