refactor: unify data preparations and research input snapshots
Deploy production / deploy (push) Successful in 53s
Deploy production / deploy (push) Successful in 53s
This commit is contained in:
@@ -28,12 +28,6 @@ from .workspace_contracts import (
|
||||
router = APIRouter(prefix="/api/v1/research", tags=["research"], dependencies=[Depends(require_auth)])
|
||||
|
||||
|
||||
@router.get("/inputs")
|
||||
async def inputs(request: Request, limit: int = Query(100, ge=1, le=100)):
|
||||
async with request.app.state.sessions() as db:
|
||||
return await Experiments(db).available_inputs(limit)
|
||||
|
||||
|
||||
@router.get("/assets")
|
||||
async def assets(
|
||||
request: Request,
|
||||
@@ -96,10 +90,10 @@ async def import_commit(body: ImportCommit, request: Request):
|
||||
|
||||
@router.post("/generate", status_code=201)
|
||||
async def generate(body: Generation, request: Request):
|
||||
async with request.app.state.sessions() as db:
|
||||
async with request.app.state.sessions.begin() as db:
|
||||
context = await Experiments(db).generation_context(body)
|
||||
result, evidence = await request_model(request.app.state.ai, context, OUTPUTS[body.method])
|
||||
if body.method == "feature" and set(result.input_ids) != set(body.input_ids):
|
||||
if body.method == "feature" and (result.preparation_refs or set(result.input_ids) != set(body.input_ids)):
|
||||
raise HTTPException(422, "模型不能改变已固定的输入范围")
|
||||
async with request.app.state.sessions.begin() as db:
|
||||
asset = await Assets(db).save(
|
||||
|
||||
Reference in New Issue
Block a user