mirror of
https://github.com/infiniflow/ragflow.git
synced 2026-07-22 16:36:47 +08:00
fix(api): allow canvas_type in agent create and update APIs (#15201)
### What problem does this PR solve?
Creating or updating an agent via `POST /api/v1/agents` and `PUT
/api/v1/agents/{agent_id}` did not persist `canvas_type` because the
handler `req` dict never assigned the field before
`UserCanvasService.save` / `update_by_id`.
### Type of change
- [x] Bug Fix (non-breaking change which fixes an issue)
- [ ] New Feature (non-breaking change which adds functionality)
- [ ] Documentation Update
- [ ] Refactoring
- [ ] Performance Improvement
- [ ] Other (please describe):
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -616,6 +616,7 @@ async def update_agent_tags(tenant_id, canvas_id):
|
||||
@add_tenant_id_to_kwargs
|
||||
async def create_agent(tenant_id):
|
||||
req = {k: v for k, v in (await get_request_json()).items() if v is not None}
|
||||
req["canvas_type"] = req.get("canvas_type","")
|
||||
req["user_id"] = tenant_id
|
||||
req["canvas_category"] = req.get("canvas_category") or CanvasCategory.Agent
|
||||
req["release"] = bool(req.get("release", ""))
|
||||
@@ -872,6 +873,7 @@ def delete_agent(agent_id, tenant_id):
|
||||
@_require_canvas_access_async
|
||||
async def update_agent(agent_id, tenant_id):
|
||||
req = {k: v for k, v in (await get_request_json()).items() if v is not None}
|
||||
req["canvas_type"] = req.get("canvas_type","")
|
||||
req["release"] = bool(req.get("release", ""))
|
||||
|
||||
if req.get("dsl") is not None:
|
||||
|
||||
Reference in New Issue
Block a user