Skip to content

Commit 498462e

Browse files
mono init
1 parent d5e697e commit 498462e

File tree

9 files changed

+106
-60
lines changed

9 files changed

+106
-60
lines changed

.github/workflows/ci.yaml

+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
name: ci
2+
3+
on:
4+
push:
5+
branches: [main]
6+
pull_request:
7+
branches: [main]
8+
9+
jobs:
10+
check:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- uses: pnpm/action-setup@v3
14+
with:
15+
version: 9.4.0
16+
17+
- name: Install dependencies
18+
run: pnpm i
19+
20+
- name: Run Prettier
21+
run: pnpm run prettier --check .
22+
23+
- name: Build packages
24+
run: pnpm run build

.gitignore

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/node_modules
1+
node_modules
22
/out
33

44
.env

eliza/.gitignore

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
node_modules
2+
dist

eliza/package.json

+1
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@
7575
"@ai-sdk/openai": "^0.0.70",
7676
"@anthropic-ai/sdk": "^0.30.1",
7777
"@cliqz/adblocker-playwright": "1.34.0",
78+
"@coral-xyz/anchor": "^0.30.1",
7879
"@discordjs/opus": "github:discordjs/opus",
7980
"@discordjs/rest": "2.4.0",
8081
"@discordjs/voice": "0.17.0",

eliza/src/services/pdf.ts

+19-19
Original file line numberDiff line numberDiff line change
@@ -2,30 +2,30 @@ import { getDocument, PDFDocumentProxy } from "pdfjs-dist";
22
import { TextItem, TextMarkedContent } from "pdfjs-dist/types/src/display/api";
33

44
export class PdfService {
5-
async convertPdfToText(pdfBuffer: Buffer): Promise<string> {
6-
// Convert Buffer to Uint8Array
7-
const uint8Array = new Uint8Array(pdfBuffer);
5+
async convertPdfToText(pdfBuffer: Buffer): Promise<string> {
6+
// Convert Buffer to Uint8Array
7+
const uint8Array = new Uint8Array(pdfBuffer);
88

9-
const pdf: PDFDocumentProxy = await getDocument({ data: uint8Array })
10-
.promise;
11-
const numPages = pdf.numPages;
12-
const textPages: string[] = [];
9+
const pdf: PDFDocumentProxy = await getDocument({ data: uint8Array })
10+
.promise;
11+
const numPages = pdf.numPages;
12+
const textPages: string[] = [];
1313

14-
for (let pageNum = 1; pageNum <= numPages; pageNum++) {
15-
const page = await pdf.getPage(pageNum);
16-
const textContent = await page.getTextContent();
17-
const pageText = textContent.items
18-
.filter(isTextItem)
19-
.map((item) => item.str)
20-
.join(" ");
21-
textPages.push(pageText);
22-
}
14+
for (let pageNum = 1; pageNum <= numPages; pageNum++) {
15+
const page = await pdf.getPage(pageNum);
16+
const textContent = await page.getTextContent();
17+
const pageText = textContent.items
18+
.filter(isTextItem)
19+
.map((item) => item.str)
20+
.join(" ");
21+
textPages.push(pageText);
22+
}
2323

24-
return textPages.join("\n");
25-
}
24+
return textPages.join("\n");
25+
}
2626
}
2727

2828
// Type guard function
2929
function isTextItem(item: TextItem | TextMarkedContent): item is TextItem {
30-
return "str" in item;
30+
return "str" in item;
3131
}

eliza/tsconfig.json

+26-25
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,27 @@
11
{
2-
"compilerOptions": {
3-
"target": "es2022",
4-
"module": "es2022",
5-
"lib": ["es2023", "dom"],
6-
"moduleResolution": "bundler",
7-
"outDir": "./dist",
8-
"rootDir": "./src",
9-
"strict": false,
10-
"esModuleInterop": true,
11-
"skipLibCheck": true,
12-
"forceConsistentCasingInFileNames": false,
13-
"allowImportingTsExtensions": true,
14-
"declaration": true,
15-
"emitDeclarationOnly": true,
16-
"resolveJsonModule": true,
17-
"noImplicitAny": false,
18-
"allowJs": true,
19-
"checkJs": false,
20-
"noEmitOnError": false,
21-
"moduleDetection": "force",
22-
"allowArbitraryExtensions": true
23-
},
24-
"include": ["src/**/*"],
25-
"exclude": ["node_modules", "dist"]
26-
}
2+
"compilerOptions": {
3+
"target": "es2022",
4+
"module": "es2022",
5+
"lib": ["es2023", "dom"],
6+
"moduleResolution": "bundler",
7+
"outDir": "./dist",
8+
"rootDir": "./src",
9+
"strict": false,
10+
"esModuleInterop": true,
11+
"skipLibCheck": true,
12+
"forceConsistentCasingInFileNames": false,
13+
"allowImportingTsExtensions": true,
14+
"declaration": true,
15+
"emitDeclarationOnly": true,
16+
"resolveJsonModule": true,
17+
"noImplicitAny": false,
18+
"allowJs": true,
19+
"checkJs": false,
20+
"noEmitOnError": false,
21+
"moduleDetection": "force",
22+
"allowArbitraryExtensions": true,
23+
"typeRoots": ["./node_modules/@types", "./types"]
24+
},
25+
"include": ["src/**/*"],
26+
"exclude": ["node_modules", "dist"]
27+
}

package.json

+18-13
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,20 @@
11
{
2-
"name": "eliza",
3-
"scripts": {
4-
"build": "pnpm --dir eliza build",
5-
"prettier-check": "npx prettier --check .",
6-
"prettier": "npx prettier --write ."
7-
},
8-
"devDependencies": {
9-
"husky": "^9.1.6",
10-
"lerna": "^8.1.5",
11-
"prettier": "^3.3.3",
12-
"tsup": "^8.1.0",
13-
"typedoc": "^0.26.7"
14-
}
2+
"name": "eliza",
3+
"scripts": {
4+
"build:eliza": "pnpm --dir eliza build",
5+
"start:eliza": "pnpm --dir eliza start",
6+
"prettier-check": "npx prettier --check .",
7+
"prettier": "npx prettier --write .",
8+
"clean": "bash ./scripts/clean.sh"
9+
},
10+
"devDependencies": {
11+
"husky": "^9.1.6",
12+
"lerna": "^8.1.5",
13+
"prettier": "^3.3.3",
14+
"tsup": "^8.1.0",
15+
"typedoc": "^0.26.7"
16+
},
17+
"engines": {
18+
"node": ">=20"
19+
}
1520
}

pnpm-lock.yaml

+5-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

scripts/clean.sh

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
#!/bin/bash
2+
3+
# Navigate to the script's directory
4+
cd "$(dirname "$0")"/..
5+
6+
# Find and remove node_modules directories and pnpm-lock.yaml files
7+
find . -type d -name "node_modules" -exec rm -rf {} + \
8+
-o -type f -name "pnpm-lock.yaml" -exec rm -f {} +
9+
10+
echo "Cleanup completed."

0 commit comments

Comments
 (0)