Alright, let’s update the frontend to handle this new Q&A chain!
We'll begin by refactoring our code out of the Vue component and into a Vue composable. Storing logic in a composable is a better practice, and it can be reused throughout the application if necessary.
So let’s create a
composables folder and a
useChain.ts file. The great thing about Nuxt is that this is now automatically imported across your app, if called upon.
We’ll also take out the chain related config and place it in a
relevance-config.ts file in the root folder, so that it’s easier to customise this template for different chains.
After plugging in the API details for our new chain, which were sourced from the Deploy page, our chain is now able to answer questions about the PDFs from my soccer association! Huzzah!
Updated 5 months ago