Skip to content

Commit

Permalink
fix: router prefix
Browse files Browse the repository at this point in the history
  • Loading branch information
edwardzjl committed Aug 25, 2023
1 parent b21224b commit ec9ace0
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions api/chatbot/routers.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,14 +43,14 @@ def message_history(
)


@router.get("/api/conversations", response_model=list[Conversation])
@router.get("/conversations", response_model=list[Conversation])
async def get_conversations(kubeflow_userid: Annotated[str | None, Header()] = None):
convs = await Conversation.find(Conversation.owner == kubeflow_userid).all()
convs.sort(key=lambda x: x.updated_at, reverse=True)
return convs


@router.get("/api/conversations/{conversation_id}", response_model=ConversationDetail)
@router.get("/conversations/{conversation_id}", response_model=ConversationDetail)
async def get_conversation(
conversation_id: str,
message_history: Annotated[BaseChatMessageHistory, Depends(message_history)],
Expand All @@ -73,14 +73,14 @@ async def get_conversation(
)


@router.post("/api/conversations", status_code=201, response_model=Conversation)
@router.post("/conversations", status_code=201, response_model=Conversation)
async def create_conversation(kubeflow_userid: Annotated[str | None, Header()] = None):
conv = Conversation(title=f"conversation at {date.today()}", owner=kubeflow_userid)
await conv.save()
return conv


@router.put("/api/conversations/{conversation_id}")
@router.put("/conversations/{conversation_id}")
async def update_conversation(
conversation_id: str,
payload: UpdateConversation,
Expand All @@ -92,14 +92,14 @@ async def update_conversation(
await conv.save()


@router.delete("/api/conversations/{conversation_id}", status_code=204)
@router.delete("/conversations/{conversation_id}", status_code=204)
async def delete_conversation(
conversation_id: str, kubeflow_userid: Annotated[str | None, Header()] = None
):
await Conversation.delete(conversation_id)


@router.post("/api/conversations/{conversation_id}/messages")
@router.post("/conversations/{conversation_id}/messages")
async def generate(
data: dict,
message_history: Annotated[BaseChatMessageHistory, Depends(message_history)],
Expand Down

0 comments on commit ec9ace0

Please sign in to comment.