Kaynağa Gözat

fix: use Body parameter for batch delete to accept JSON array

guantao 1 gün önce
ebeveyn
işleme
02848d9077
1 değiştirilmiş dosya ile 2 ekleme ve 2 silme
  1. 2 2
      knowhub/server.py

+ 2 - 2
knowhub/server.py

@@ -19,7 +19,7 @@ from typing import Optional, List
 from pathlib import Path
 from pathlib import Path
 from cryptography.hazmat.primitives.ciphers.aead import AESGCM
 from cryptography.hazmat.primitives.ciphers.aead import AESGCM
 
 
-from fastapi import FastAPI, HTTPException, Query, Header
+from fastapi import FastAPI, HTTPException, Query, Header, Body
 from fastapi.responses import HTMLResponse
 from fastapi.responses import HTMLResponse
 from pydantic import BaseModel, Field
 from pydantic import BaseModel, Field
 
 
@@ -1001,7 +1001,7 @@ def delete_knowledge(knowledge_id: str):
 
 
 
 
 @app.post("/api/knowledge/batch_delete")
 @app.post("/api/knowledge/batch_delete")
-def batch_delete_knowledge(knowledge_ids: List[str]):
+def batch_delete_knowledge(knowledge_ids: List[str] = Body(...)):
     """批量删除知识"""
     """批量删除知识"""
     try:
     try:
         if not knowledge_ids:
         if not knowledge_ids: