chore: import upstream snapshot with attribution
CI / Run CI (push) Has been cancelled
CI / check-backend (push) Has been cancelled
CI / check-frontend (push) Has been cancelled
CI / tests (push) Has been cancelled
CI / e2e-tests (push) Has been cancelled
Copilot Setup Steps / copilot-setup-steps (push) Has been cancelled
CI / Run CI (push) Has been cancelled
CI / check-backend (push) Has been cancelled
CI / check-frontend (push) Has been cancelled
CI / tests (push) Has been cancelled
CI / e2e-tests (push) Has been cancelled
Copilot Setup Steps / copilot-setup-steps (push) Has been cancelled
This commit is contained in:
@@ -0,0 +1,38 @@
|
||||
import os
|
||||
from typing import Optional
|
||||
|
||||
import chainlit as cl
|
||||
from chainlit.data.sql_alchemy import SQLAlchemyDataLayer
|
||||
from chainlit.data.storage_clients.azure import AzureStorageClient
|
||||
|
||||
os.environ["CHAINLIT_AUTH_SECRET"] = "SUPER_SECRET" # nosec B105
|
||||
|
||||
storage_client = AzureStorageClient(
|
||||
account_url="<your_account_url>", container="<your_container>"
|
||||
)
|
||||
|
||||
|
||||
@cl.data_layer
|
||||
def data_layer():
|
||||
return SQLAlchemyDataLayer(
|
||||
conninfo="<your conninfo>", storage_provider=storage_client
|
||||
)
|
||||
|
||||
|
||||
@cl.on_chat_start
|
||||
async def main():
|
||||
await cl.Message("Hello, send me a message!").send()
|
||||
|
||||
|
||||
@cl.on_message
|
||||
async def handle_message():
|
||||
await cl.sleep(2)
|
||||
await cl.Message("Ok!").send()
|
||||
|
||||
|
||||
@cl.password_auth_callback
|
||||
def auth_callback(username: str, password: str) -> Optional[cl.User]:
|
||||
if (username, password) == ("admin", "admin"):
|
||||
return cl.User(identifier="admin")
|
||||
else:
|
||||
return None
|
||||
Reference in New Issue
Block a user