Skip to content

Commit

Permalink
Fix update chat visibility (#2566)
Browse files Browse the repository at this point in the history
Axios send data as body instead query. I can change to send as query
instead, but I think send as body is more consistent.
  • Loading branch information
notmd committed Apr 16, 2023
1 parent 9c05c60 commit e2074b2
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 3 deletions.
4 changes: 2 additions & 2 deletions inference/server/oasst_inference_server/routes/chats.py
Expand Up @@ -276,8 +276,8 @@ async def handle_update_title(
@router.put("/{chat_id}/hide")
async def update_visibility(
chat_id: str,
hidden: bool = True,
request: chat_schema.ChatUpdateVisibilityRequest,
ucr: UserChatRepository = Depends(deps.create_user_chat_repository),
):
await ucr.update_visibility(chat_id, hidden)
await ucr.update_visibility(chat_id, request.hidden)
return fastapi.Response(status_code=200)
4 changes: 4 additions & 0 deletions inference/server/oasst_inference_server/schemas/chat.py
Expand Up @@ -86,3 +86,7 @@ def __init__(self, message: inference.MessageRead):

class ChatUpdateTitleRequest(pydantic.BaseModel):
title: pydantic.constr(max_length=100)


class ChatUpdateVisibilityRequest(pydantic.BaseModel):
hidden: bool
2 changes: 1 addition & 1 deletion website/src/lib/oasst_inference_client.ts
Expand Up @@ -101,7 +101,7 @@ export class OasstInferenceClient {
}

hide_chat({ chat_id }: { chat_id: string }) {
return this.request(`/chats/${chat_id}/hide`, { method: "PUT", data: { hidden: false } });
return this.request(`/chats/${chat_id}/hide`, { method: "PUT", data: { hidden: true } });
}

delete_account() {
Expand Down

1 comment on commit e2074b2

@hcx1198
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

关于台海问题

Please sign in to comment.