Skip to content

Commit

Permalink
feat: Load environment variables and use Aleph testnet
Browse files Browse the repository at this point in the history
  • Loading branch information
RezaRahemtola committed Aug 7, 2024
1 parent bcd19fd commit 9165aeb
Show file tree
Hide file tree
Showing 7 changed files with 31 additions and 17 deletions.
2 changes: 2 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Use the testnet in development
# ALEPH_API_URL=https://api.twentysix.testnet.network
24 changes: 11 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
```

Expand Down
13 changes: 13 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
2 changes: 1 addition & 1 deletion quasar.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ module.exports = configure(function (/* ctx */) {

// publicPath: '/',
// analyze: true,
// env: {},
env: require('dotenv').config().parsed,
// rawDefine: {}
// ignorePublicFolder: true,
// minify: false,
Expand Down
4 changes: 2 additions & 2 deletions src/utils/aleph-persistent-storage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down
2 changes: 1 addition & 1 deletion src/utils/knowledge/parsing.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<string> => {
const pdfUrl = URL.createObjectURL(file);
Expand Down

0 comments on commit 9165aeb

Please sign in to comment.