Skip to content

Commit

Permalink
Merge pull request #79 from datakind/bugfix/chainlit
Browse files Browse the repository at this point in the history
Bugfix/chainlit
  • Loading branch information
ismaeltocruz authored Dec 16, 2024
2 parents 4da88dc + 2b01ca8 commit c53858a
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 22 deletions.
9 changes: 7 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,8 @@ This repo contains a docker-compose environment that will run the following comp

# Quick start

1. Install Docker if you don't have it already, see [here](https://www.docker.com/products/docker-desktop/)
1. Install Docker if you don't have it already, see [here](https://www.docker.com/products/docker-desktop/). It will also be helpful to get Docker Desktop to manage the different containers. In addition, ensure you have python installed (version not later than 3.11.9).

2. Check out the Data Recipes AI GitHub repo

Go to the [repo](https://github.com/datakind/data-recipes-ai) in Github, and click the big green '<> Code' button. This provides a few options, you can download a zip file, or check the code out with git. If you have Git installed, a common method would be ...
Expand Down Expand Up @@ -125,7 +126,9 @@ This repo contains a docker-compose environment that will run the following comp
7. Restart so the assistant ID is set, `docker compose up -d`
8. Go to [http://localhost:8000/](http://localhost:8000/) and sign-in using the values in your `.env` file for `USER_LOGIN` and `USER_PASSWORD`
8. Go to [http://localhost:8000/](http://localhost:8000/).
9. It will also be helpful to have a database tool like [DBeaver](https://dbeaver.io) to access and interact with your data and recipes.
## Stoping/Starting the environment
Expand All @@ -135,6 +138,8 @@ The steps above are mostly one-time. Going forward you only need to stop and sta
- To start the environment `docker compose up -d`, then go to [http://localhost:8000/](http://localhost:8000/)
- To start with rebuild `docker compose up -d --build` (for more details about development, see [CONTRIBUTION](CONTRIBUTION.md))
You can also do the above through Docker Desktop.
## Using Recipes
We are in a phase of research to identify and improve recipes, but for now the system comes with some basic examples to illustrate. To find out the list, enter "Get all recipes" in the chat interface.
Expand Down
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
autogenstudio==0.0.56
black==22.1.0
chainlit==1.1.301
pydantic==2.10.1
click==8.1.7
datetime==4.3
fastparquet==2024.5.0
Expand Down
5 changes: 3 additions & 2 deletions ui/chat-chainlit-assistant/.chainlit/config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ custom_css = "/public/elastic.css"
# custom_build = "./public/build"

[UI.theme]
default = "light"
#layout = "wide"
#font_family = "Inter, sans-serif"
# Override default MUI light theme. (Check theme.ts)
Expand All @@ -107,11 +108,11 @@ custom_css = "/public/elastic.css"
#light = "#FFE7EB"

# Override default MUI dark theme. (Check theme.ts)
[UI.theme.dark]
#[UI.theme.dark]
#background = "#FAFAFA"
#paper = "#FFFFFF"

[UI.theme.dark.primary]
#[UI.theme.dark.primary]
#main = "#F80061"
#dark = "#980039"
#light = "#FFE7EB"
Expand Down
36 changes: 18 additions & 18 deletions ui/chat-chainlit-assistant/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -697,24 +697,24 @@ async def on_audio_end(elements: list[Element]):
).send()


@cl.password_auth_callback
def auth_callback(username: str, password: str):
"""
Authenticates a user based on the provided username and password.
Args:
username (str): The username of the user.
password (str): The password of the user.
Returns:
cl.User or None: If the authentication is successful, returns a User object with the user's identifier, role, and provider. Otherwise, returns None.
"""
if (username, password) == (user, password):
return cl.User(
identifier=user, metadata={"role": "admin", "provider": "credentials"}
)
else:
return None
# @cl.password_auth_callback
# def auth_callback(username: str, password: str):
# """
# Authenticates a user based on the provided username and password.

# Args:
# username (str): The username of the user.
# password (str): The password of the user.

# Returns:
# cl.User or None: If the authentication is successful, returns a User object with the user's identifier, role, and provider. Otherwise, returns None.
# """
# if (username, password) == (user, password):
# return cl.User(
# identifier=user, metadata={"role": "admin", "provider": "credentials"}
# )
# else:
# return None


async def add_message_to_thread(thread_id, role, content, message=None):
Expand Down

0 comments on commit c53858a

Please sign in to comment.