Skip to content

Commit

Permalink
Merge pull request #11 from adrianariton/chattutor
Browse files Browse the repository at this point in the history
Adding Chattutor
  • Loading branch information
kerfun authored Dec 4, 2023
2 parents ab9b2f9 + 562ce0a commit 80c9dbd
Show file tree
Hide file tree
Showing 522 changed files with 51,408 additions and 0 deletions.
9 changes: 9 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,15 @@ navigate to that directory and start a simple Python server:
python -m http.server
```

## Building and adding chattutor

Check out the README.md file in chattutor_setup folder,
or simply run

```sh
./build.sh
```

## Development

The majority of this book is written as Jupyter notebooks. Learn more about
Expand Down
23 changes: 23 additions & 0 deletions book/chattutor_setup/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Building

From the root folder of the app run:
```sh
jupyter-book build --all book
python3 ./book/chattutor_setup/install.py # adding the chattutor script to all the html files
```

CORS needs to allow the url to make requests!!
For now this can only be tested locally.

# Testing locally

Checkout chattutor.config.js

- Start an instance of the main branch of the chattutor repo at port `5000` at `localhost`
- Go to config and set **TEST_MODE** to true and **SERVER_PORT** to `5000`
- Run the following commands to build the notebook and to add chattutor
one in venv (checkout main README for info on that)
```sh
jupyter-book build --all book
python3 ./book/chattutor_setup/install.py # adding the chattutor script to all the html files
```
83 changes: 83 additions & 0 deletions book/chattutor_setup/chattutor.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
/**
* --------------- ChatTutor.org ----------------
* Configuration file for chattutor.min.js which
* should not be modified. This file consists of
* the necesary configurations for running chat-
* tutor in a course.
* Currently the ChatTutor needs be added by hand
* or using the install.py script in each page of
* the application, weather build with jupyter or
* other frameworks.
* The style necesary for ChatTutor is provided in
* chattutor.style.css, and can be adjusted for
* every course's needs.
*
* The following configuration variables have the
* following meaning:
*
* EMBEDDING_COLLECTION_NAME: the name of the
* database that is [[either provided on
* ChatTutor.org when an account is created and
* a new course added - this will be added soon]]
* or provided by the contributors to ChatTutor.
*
* TEST_MODE: should be false for prodction and
* either true or false for testing. When true,
* requests to the chattutor server are actually
* done to https://localhost:<SERVER_PORT>.
* This option is added because currently ChatTutor
* has a CORS wall that only allows certain domains
* to make requests to its APIs, and the CORS needs
* to be manually updated when a course is ready
* to use Chattutor. For testing purposes on should
* run the ChatTutor server on the port SERVER_PORT
* and request to it. This will be deprecated in
* the latter phases of the project, when the CORS
* will be updated automatically, and it is currently
* used by our team for manually adding and testing
* ChatTutor to new courses.
*
* COURSE_URL: the base url for the course
*
*
* RUN_LOCALLY: true if and only if course is tested
* locally. For production it should be false,
* for testing it should be true.
*
* IS_STATIC: true if ran statically on a index.html
* file, false if ran on a server, either local or online
* Usually true for jupyter books
*/
const RUN_LOCALLY = true;
const TEST_MODE = false;
const IS_STATIC = true;

const EMBEDDING_COLLECTION_NAME = "photonicsbootcamp2811";
const COURSE_URL = "https://byucamacholab.github.io/Photonics-Bootcamp"
/**
* --------------- TESTING CONFIGS ----------------
* ChatTutor can be embedded on default applications
* that run on servers, or in static pages such as
* Jupyter Notebooks.
*
* For the purpose of testing, the build method needs
* to be specified so the server knows how to parse
* the current url name.
*
* BUILT_WITH: "JUPYTER-NOTEBOOK"|"SERVER"
*
* This configuration is ONLY used for testing and
* will have no weight in production mode
* (RUN_LOCALLY = false)
*
* SERVER_PORT: the port listen to Chattutor
* server if ran locally. Used ONLY for testing
* purposes (TEST_MODE = false)
*/
const BUILT_WITH = "JUPYTER-NOTEBOOK"
const SERVER_PORT = 5000

/**
* JUPYTER-NOTEBOOK Specific configurations.
*/
const BUILD_HTML_JUPYTER_NOTEBOOK_FOLDER = "_build/html"
Loading

0 comments on commit 80c9dbd

Please sign in to comment.