Skip to content

Commit

Permalink
renamed chat_profiles to set_chat_profiles
Browse files Browse the repository at this point in the history
  • Loading branch information
tpatel committed Oct 11, 2023
1 parent 3edc6ff commit 425264b
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 6 deletions.
4 changes: 2 additions & 2 deletions backend/chainlit/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ def on_chat_start(func: Callable) -> Callable:


@trace
def chat_profiles(
def set_chat_profiles(
func: Callable[[Optional["AppUser"]], List["ChatProfile"]]
) -> Callable:
"""
Expand All @@ -164,7 +164,7 @@ def chat_profiles(
Callable[[Optional["AppUser"]], List["ChatProfile"]]: The decorated function.
"""

config.code.chat_profiles = wrap_user_function(func)
config.code.set_chat_profiles = wrap_user_function(func)
return func


Expand Down
4 changes: 3 additions & 1 deletion backend/chainlit/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,9 @@ class CodeSettings:
on_file_upload: Optional[Callable[[str], Any]] = None
author_rename: Optional[Callable[[str], str]] = None
on_settings_update: Optional[Callable[[Dict[str, Any]], Any]] = None
chat_profiles: Optional[Callable[[Optional["AppUser"]], List["ChatProfile"]]] = None
set_chat_profiles: Optional[
Callable[[Optional["AppUser"]], List["ChatProfile"]]
] = None


@dataclass()
Expand Down
4 changes: 2 additions & 2 deletions backend/chainlit/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -441,8 +441,8 @@ async def project_settings(
):
"""Return project settings. This is called by the UI before the establishing the websocket connection."""
profiles = []
if config.code.chat_profiles:
chat_profiles = await config.code.chat_profiles(current_user)
if config.code.set_chat_profiles:
chat_profiles = await config.code.set_chat_profiles(current_user)
if chat_profiles:
profiles = [dict(p) for p in chat_profiles]
return JSONResponse(
Expand Down
2 changes: 1 addition & 1 deletion cypress/e2e/chat_profiles/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import chainlit as cl


@cl.chat_profiles
@cl.set_chat_profiles
async def chat_profile(current_user: cl.AppUser):
if current_user.role != "ADMIN":
return None
Expand Down

0 comments on commit 425264b

Please sign in to comment.