SexBot / routers /update_kb.py
Pew404's picture
Upload folder using huggingface_hub
318db6e verified
raw
history blame contribute delete
667 Bytes
from fastapi import APIRouter, Request, FastAPI
from langchain_community.embeddings.ollama import OllamaEmbeddings
import uvicorn
embed_model = OllamaEmbeddings(model="bge-m3")
app = FastAPI(
title="kb",
description="update_kb",
)
kb_router = APIRouter(
prefix="/kb",
tags=["kb"]
)
@kb_router.post("/")
async def update_kb(request: Request):
request = await request.json()
data = request.get("data", [])
collection_name = request.get("collection_name", "")
# print(f"collection_name: {collection_name}")
app.include_router(kb_router)
if __name__ == "__main__":
uvicorn.run(app, host="0.0.0.0", port=8010, loop="asyncio")