♻️ (monitor.py): change POST to DELETE for delete_messages endpoint

♻️ (schemas.py): remove unused MessageIds schema
♻️ (api.tsx): add missing commas in ApiInterceptor function
🐛 (api.tsx): fix duplicate request check to include method "get"
♻️ (index.ts): change deleteMessagesFn to use DELETE method instead of POST
♻️ (use-remove-messages.tsx): clean up comments and improve error handling
This commit is contained in:
cristhianzl 2024-06-03 10:29:58 -03:00
commit 21a8545ddb
5 changed files with 19 additions and 24 deletions

View file

@ -1,8 +1,7 @@
from typing import List, Optional
from uuid import UUID
from fastapi import APIRouter, Depends, HTTPException, Query
from langflow.api.v1.schemas import MessageIds
from langflow.services.deps import get_monitor_service
from langflow.services.monitor.schema import (
MessageModelRequest,
@ -68,13 +67,13 @@ async def get_messages(
raise HTTPException(status_code=500, detail=str(e))
@router.post("/messages", status_code=204)
@router.delete("/messages", status_code=204)
async def delete_messages(
message_ids: MessageIds,
message_ids: List[int],
monitor_service: MonitorService = Depends(get_monitor_service),
):
try:
monitor_service.delete_messages(message_ids=message_ids.ids)
monitor_service.delete_messages(message_ids=message_ids)
except Exception as e:
raise HTTPException(status_code=500, detail=str(e))

View file

@ -322,5 +322,3 @@ class FlowDataRequest(BaseModel):
class ConfigResponse(BaseModel):
frontend_timeout: int
class MessageIds(BaseModel):
ids: List[int]