diff --git a/.env.example b/.env.example new file mode 100644 index 0000000..fb1e341 --- /dev/null +++ b/.env.example @@ -0,0 +1,2 @@ +# Use the testnet in development +# ALEPH_API_URL=https://api.twentysix.testnet.network diff --git a/README.md b/README.md index 0b634a2..046a40c 100644 --- a/README.md +++ b/README.md @@ -4,31 +4,29 @@ A UI for decentralized AI ## Install the dependencies -```bash -npm i +```sh +npm install ``` -### Start the app in development mode (hot-code reloading, error reporting, etc.) - -```bash -quasar dev -``` +> Don't forget to also fill environment variables in a `.env` file. You can use [`.env.example`](.env.example) as an +> inspiration. -### Lint the files +### Start the app in development mode (hot-code reloading, error reporting, etc.) -```bash -npm run lint +```sh +npm run dev ``` -### Format the files +### Format and lint the files -```bash +```sh npm run format +npm run lint ``` ### Build the app for production -```bash +```sh npm run build ``` diff --git a/package-lock.json b/package-lock.json index 17c9ae2..2143cea 100644 --- a/package-lock.json +++ b/package-lock.json @@ -19,6 +19,7 @@ "axios": "^1.7.3", "dayjs": "^1.11.12", "dompurify": "^3.1.6", + "dotenv": "^16.4.5", "eciesjs": "^0.4.7", "filesize": "^10.1.4", "highlight.js": "^11.10.0", @@ -9549,6 +9550,18 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/dotenv": { + "version": "16.4.5", + "resolved": "https://registry.npmjs.org/dotenv/-/dotenv-16.4.5.tgz", + "integrity": "sha512-ZmdL2rui+eB2YwhsWzjInR8LldtZHGDoQ1ugH85ppHKwpUHL7j7rN0Ti9NCnGiQbhaZ11FpR+7ao1dNsmduNUg==", + "license": "BSD-2-Clause", + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://dotenvx.com" + } + }, "node_modules/duplexify": { "version": "4.1.3", "resolved": "https://registry.npmjs.org/duplexify/-/duplexify-4.1.3.tgz", diff --git a/package.json b/package.json index 72c75eb..08aa043 100644 --- a/package.json +++ b/package.json @@ -34,6 +34,7 @@ "axios": "^1.7.3", "dayjs": "^1.11.12", "dompurify": "^3.1.6", + "dotenv": "^16.4.5", "eciesjs": "^0.4.7", "filesize": "^10.1.4", "highlight.js": "^11.10.0", diff --git a/quasar.config.js b/quasar.config.js index 1434af3..6a3709b 100644 --- a/quasar.config.js +++ b/quasar.config.js @@ -85,7 +85,7 @@ module.exports = configure(function (/* ctx */) { // publicPath: '/', // analyze: true, - // env: {}, + env: require('dotenv').config().parsed, // rawDefine: {} // ignorePublicFolder: true, // minify: false, diff --git a/src/utils/aleph-persistent-storage.ts b/src/utils/aleph-persistent-storage.ts index c4a86c9..dfd8a54 100644 --- a/src/utils/aleph-persistent-storage.ts +++ b/src/utils/aleph-persistent-storage.ts @@ -48,8 +48,8 @@ export class AlephPersistentStorage { const subAccount = importAccountFromPrivateKey(privateKey); const account = await getAccountFromProvider(window.ethereum); - const accountClient = new AuthenticatedAlephHttpClient(account); - const subAccountClient = new AuthenticatedAlephHttpClient(subAccount); + const accountClient = new AuthenticatedAlephHttpClient(account, process.env.ALEPH_API_URL); + const subAccountClient = new AuthenticatedAlephHttpClient(subAccount, process.env.ALEPH_API_URL); await AlephPersistentStorage.getSecurityPermission(account, subAccount, accountClient); diff --git a/src/utils/knowledge/parsing.ts b/src/utils/knowledge/parsing.ts index 12008fa..fc7279e 100644 --- a/src/utils/knowledge/parsing.ts +++ b/src/utils/knowledge/parsing.ts @@ -2,7 +2,7 @@ import mime from 'mime'; import * as pdfjs from 'pdfjs-dist'; import { TextItem } from 'pdfjs-dist/types/src/display/api'; -export const supportedInputFiles = ['.txt', '.md', '.pdf', '.py'].join(','); +export const supportedInputFiles = ['.txt', '.md', '.pdf'].join(','); const extractTextFromPdfFile = async (file: File): Promise => { const pdfUrl = URL.createObjectURL(file);