Buckets:
AnonymousSpottedToad/candidate_bucket / codebase /python /Chainlit_chainlit /cypress /e2e /chat_profiles /main.py
| import os | |
| from typing import Optional | |
| import chainlit as cl | |
| os.environ["CHAINLIT_AUTH_SECRET"] = "SUPER_SECRET" # nosec B105 | |
| starters = [ | |
| cl.Starter( | |
| label="Say hi", | |
| message="Start a conversation with a greeting", | |
| icon="https://picsum.photos/300", | |
| ), | |
| cl.Starter( | |
| label="Ask for help", | |
| message="Ask for help with something", | |
| icon="https://picsum.photos/350", | |
| ), | |
| ] | |
| async def chat_profile(current_user: cl.User): | |
| if current_user.metadata["role"] != "ADMIN": | |
| return None | |
| return [ | |
| cl.ChatProfile( | |
| name="GPT-3.5", | |
| icon="https://picsum.photos/250", | |
| markdown_description="The underlying LLM model is **GPT-3.5**, a *175B parameter model* trained on 410GB of text data.", | |
| starters=starters, | |
| ), | |
| cl.ChatProfile( | |
| name="GPT-4", | |
| markdown_description="The underlying LLM model is **GPT-4**, a *1.5T parameter model* trained on 3.5TB of text data. [Learn more](https://example.com/gpt4)", | |
| icon="https://picsum.photos/250", | |
| starters=starters, | |
| ), | |
| cl.ChatProfile( | |
| name="GPT-5", | |
| markdown_description="The underlying LLM model is **GPT-5**.", | |
| icon="https://picsum.photos/200", | |
| starters=starters, | |
| ), | |
| ] | |
| def auth_callback(username: str, password: str) -> Optional[cl.User]: | |
| if (username, password) == ("admin", "admin"): | |
| return cl.User(identifier="admin", metadata={"role": "ADMIN"}) | |
| else: | |
| return None | |
| async def on_message(): | |
| user = cl.user_session.get("user") | |
| chat_profile = cl.user_session.get("chat_profile") | |
| await cl.Message( | |
| content=f"starting chat with {user.identifier} using the {chat_profile} chat profile" | |
| ).send() | |
Xet Storage Details
- Size:
- 1.9 kB
- Xet hash:
- 0427f6301223a048309133b972c172e4c3d51690f41b435290981c26b6bd3cea
·
Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.