diff --git a/09-chat-project/README.md b/09-chat-project/README.md index c22212bb..15fde7b2 100644 --- a/09-chat-project/README.md +++ b/09-chat-project/README.md @@ -337,4 +337,17 @@ Copy the content from what was instructed from above but feel free to customize [Solution](./solution/README.md) -## Summary \ No newline at end of file +## Bonus + +Try changing the personality of the AI assistant. When you call `call_llm` in *api.py* you can change the second argument to what you want, for example: + +```python +call_llm(message, "You are Captain Picard") +``` + +Change also the CSS and text to your liking, so do changes in *index.html* and *styles.css*. + +## Summary + +Great, you've learned from scratch how to create a personal assistant using AI. We'v done so using GitHub Models, a backend in Python and a frontend in HTML, CSS and JavaScript + diff --git a/09-chat-project/solution/README.md b/09-chat-project/solution/README.md new file mode 100644 index 00000000..229dc2e6 --- /dev/null +++ b/09-chat-project/solution/README.md @@ -0,0 +1,41 @@ +# Run code + +## Set up + +Create virtual environment + +```sh +cd backend +python -m venv venv +source ./venv/bin/activate +``` + +## Install dependencies + +```sh +pip install openai flask flask-cors +``` + +## Run API + +```sh +python api.py +``` + +## Run frontend + +Make sure you stand in the frontend folder + +Locate *app.js*, change `BASE_URL` to that of your backend URL + +Run it + +``` +npx http-server -p 8000 +``` + +Try typing a message in the chat, you should see a response (providing you're running this in a Codespace or have set up a access token). + +## Set up access token (if you don't run this in a Codespace) + +See [Set up PAT](https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/managing-your-personal-access-tokens) \ No newline at end of file diff --git a/09-chat-project/backend/api.py b/09-chat-project/solution/backend/api.py similarity index 100% rename from 09-chat-project/backend/api.py rename to 09-chat-project/solution/backend/api.py diff --git a/09-chat-project/backend/llm.py b/09-chat-project/solution/backend/llm.py similarity index 100% rename from 09-chat-project/backend/llm.py rename to 09-chat-project/solution/backend/llm.py diff --git a/09-chat-project/frontend/app.js b/09-chat-project/solution/frontend/app.js similarity index 100% rename from 09-chat-project/frontend/app.js rename to 09-chat-project/solution/frontend/app.js diff --git a/09-chat-project/frontend/index.html b/09-chat-project/solution/frontend/index.html similarity index 100% rename from 09-chat-project/frontend/index.html rename to 09-chat-project/solution/frontend/index.html diff --git a/09-chat-project/frontend/styles.css b/09-chat-project/solution/frontend/styles.css similarity index 100% rename from 09-chat-project/frontend/styles.css rename to 09-chat-project/solution/frontend/styles.css