joelostblom / viz-oer

An interactive open educational resource for learning data visualization
https://joelostblom.github.io/viz-oer/
1 stars 0 forks source link

Refactor genAI interface to reusable function and fix mermaid rendering #22

Closed rorywhite200 closed 2 months ago

rorywhite200 commented 2 months ago

I have moved the javascript logic for creating the chat interface into a chat.js file. This should allow us to import it as a function wherever we require in the book, using import {createChatInterface} from "./chat.js".

I also deleted the old proxy server and saved the new one as an environmental variable. From what I understand we can't access this in javascript directly and instead have to pass it to ojs inside an R codeblock like so:

api = "{{< env URL >}}"
ojs_define(apiUrl = api)

For local development the environmental variable URL is saved in a _environment.local file.

rorywhite200 commented 2 months ago

I ran into this error when trying it out briefly:

I believe this error occurs as you don't have the _environment.local file with the proxy server address. I'll send this to you.

joelostblom commented 2 months ago

I believe this error occurs as you don't have the _environment.local file with the proxy server address. I'll send this to you.

Does that mean that this is a temporary change you have made just to prevent abuse as we develop the book? (Since learners would not have access to this file)