完善模型测试与参考文件历史能力
This commit is contained in:
@@ -20,6 +20,8 @@ def _serialize_model(model: AiModel) -> dict:
|
||||
"api_format": model.api_format,
|
||||
"api_endpoint": model.api_endpoint,
|
||||
"api_key_preview": mask_secret(api_key),
|
||||
"supports_streaming": bool(model.supports_streaming),
|
||||
"enable_reasoning": bool(model.enable_reasoning),
|
||||
"status": model.status,
|
||||
"created_at": model.created_at,
|
||||
}
|
||||
@@ -40,6 +42,8 @@ async def create_model(body: AiModelCreate, db: AsyncSession = Depends(get_db)):
|
||||
api_format=body.api_format,
|
||||
api_endpoint=body.api_endpoint,
|
||||
api_key_encrypted=encrypt_text(body.api_key),
|
||||
supports_streaming=body.supports_streaming,
|
||||
enable_reasoning=body.enable_reasoning,
|
||||
status=body.status,
|
||||
)
|
||||
db.add(model)
|
||||
@@ -62,6 +66,10 @@ async def update_model(model_id: int, body: AiModelUpdate, db: AsyncSession = De
|
||||
model.api_format = body.api_format
|
||||
if body.api_endpoint is not None:
|
||||
model.api_endpoint = body.api_endpoint
|
||||
if body.supports_streaming is not None:
|
||||
model.supports_streaming = body.supports_streaming
|
||||
if body.enable_reasoning is not None:
|
||||
model.enable_reasoning = body.enable_reasoning
|
||||
if body.status is not None:
|
||||
model.status = body.status
|
||||
if body.api_key:
|
||||
@@ -95,6 +103,7 @@ async def test_model(model_id: int, db: AsyncSession = Depends(get_db)):
|
||||
need_prompt = False
|
||||
prompt_text = ""
|
||||
output_format = "text"
|
||||
enable_reasoning = bool(model.enable_reasoning)
|
||||
|
||||
try:
|
||||
result = await call_ai(FakeParagraph(), model)
|
||||
|
||||
Reference in New Issue
Block a user