Compare commits

..

2 Commits

Author SHA1 Message Date
Kevin Dang
a2c954136d Fix: redis workaround for local non docker 2025-05-08 22:02:26 -07:00
Kevin Dang
5820583609 Update: simplify npm command to run tests 2025-05-08 21:16:32 -07:00
5 changed files with 18 additions and 15 deletions

View File

@@ -36,7 +36,7 @@ jobs:
- name: Collect Code Coverage - name: Collect Code Coverage
run: | run: |
LINE_PCT=$(npm run test:coverage | tail -2 | head -1 | awk '{print $3}') LINE_PCT=$(npm run coverage | tail -2 | head -1 | awk '{print $3}')
echo "COVERAGE=$LINE_PCT" >> $GITHUB_ENV echo "COVERAGE=$LINE_PCT" >> $GITHUB_ENV
- name: Upload Code Coverage - name: Upload Code Coverage

View File

@@ -47,4 +47,4 @@ jobs:
- name: Test Application - name: Test Application
run: | run: |
npm run test:run npm run tests

8
package-lock.json generated
View File

@@ -11,7 +11,7 @@
"dependencies": { "dependencies": {
"discord.js": "^14.18.0", "discord.js": "^14.18.0",
"dotenv": "^16.4.7", "dotenv": "^16.4.7",
"ollama": "^0.5.15", "ollama": "^0.5.14",
"redis": "^4.7.0" "redis": "^4.7.0"
}, },
"devDependencies": { "devDependencies": {
@@ -2003,9 +2003,9 @@
} }
}, },
"node_modules/ollama": { "node_modules/ollama": {
"version": "0.5.15", "version": "0.5.14",
"resolved": "https://registry.npmjs.org/ollama/-/ollama-0.5.15.tgz", "resolved": "https://registry.npmjs.org/ollama/-/ollama-0.5.14.tgz",
"integrity": "sha512-TSaZSJyP7MQJFjSmmNsoJiriwa3U+/UJRw6+M8aucs5dTsaWNZsBIGpDb5rXnW6nXxJBB/z79gZY8IaiIQgelQ==", "integrity": "sha512-pvOuEYa2WkkAumxzJP0RdEYHkbZ64AYyyUszXVX7ruLvk5L+EiO2G71da2GqEQ4IAk4j6eLoUbGk5arzFT1wJA==",
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
"whatwg-fetch": "^3.6.20" "whatwg-fetch": "^3.6.20"

View File

@@ -5,8 +5,8 @@
"main": "build/index.js", "main": "build/index.js",
"exports": "./build/index.js", "exports": "./build/index.js",
"scripts": { "scripts": {
"test:run": "vitest run", "tests": "vitest run",
"test:coverage": "vitest run --coverage", "coverage": "vitest run --coverage",
"watch": "tsx watch src", "watch": "tsx watch src",
"build": "tsc", "build": "tsc",
"prod": "node .", "prod": "node .",
@@ -29,7 +29,7 @@
"dependencies": { "dependencies": {
"discord.js": "^14.18.0", "discord.js": "^14.18.0",
"dotenv": "^16.4.7", "dotenv": "^16.4.7",
"ollama": "^0.5.15", "ollama": "^0.5.14",
"redis": "^4.7.0" "redis": "^4.7.0"
}, },
"devDependencies": { "devDependencies": {

View File

@@ -33,12 +33,15 @@ const messageHistory: Queue<UserMessage> = new Queue<UserMessage>
registerEvents(client, Events, messageHistory, ollama, Keys.defaultModel) registerEvents(client, Events, messageHistory, ollama, Keys.defaultModel)
// Try to connect to redis // Try to connect to redis
await redis.connect() try {
.then(() => console.log('[Redis] Connected')) await redis.connect()
.catch((error) => { console.log('[Redis] Successfully Connected')
console.error('[Redis] Connection Error', error) } catch(error) {
process.exit(1) console.error('[Redis] Connection Error. See error below:\n', error)
}) console.warn('[Redis] Failed to connect to Redis Database, using local system')
// TODO: create boolean flag that will probably be used in messageCreate.ts if redis database is down
// When implementing this boolean flag, move connection to database BEFORE the registerEvents method
}
// Try to log in the client // Try to log in the client
await client.login(Keys.clientToken) await client.login(Keys.clientToken)