Compare commits

..

2 Commits

Author SHA1 Message Date
Kevin Dang
42ef38db14 Data Directory on Chat for Preferences (#105)
* Fix: data directory created on for openConfig

* Update: version increment
2024-08-03 09:50:03 -07:00
Kevin Dang
af23db20bb Removed GUILD_ID as an Environment Variable (#103) 2024-08-03 09:48:47 -07:00
6 changed files with 9 additions and 8 deletions

View File

@@ -1,9 +1,6 @@
# Discord token for the bot
CLIENT_TOKEN = BOT_TOKEN
# id token of a discord server
GUILD_ID = GUILD_ID
# model for the bot to query from (i.e. llama2 [llama2:13b], mistral, codellama, etc... )
MODEL = MODEL_NAME

View File

@@ -8,7 +8,7 @@ services:
build: ./ # find docker file in designated path
container_name: discord
restart: always # rebuild container always
image: kevinthedang/discord-ollama:0.5.8
image: kevinthedang/discord-ollama:0.5.9
environment:
CLIENT_TOKEN: ${CLIENT_TOKEN}
GUILD_ID: ${GUILD_ID}

4
package-lock.json generated
View File

@@ -1,12 +1,12 @@
{
"name": "discord-ollama",
"version": "0.5.8",
"version": "0.5.9",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "discord-ollama",
"version": "0.5.8",
"version": "0.5.9",
"license": "ISC",
"dependencies": {
"discord.js": "^14.15.3",

View File

@@ -1,6 +1,6 @@
{
"name": "discord-ollama",
"version": "0.5.8",
"version": "0.5.9",
"description": "Ollama Integration into discord",
"main": "build/index.js",
"exports": "./build/index.js",

View File

@@ -4,7 +4,6 @@ export const Keys = {
clientToken: getEnvVar('CLIENT_TOKEN'),
model: getEnvVar('MODEL'),
clientUid: getEnvVar('CLIENT_UID'),
guildId: getEnvVar('GUILD_ID'),
ipAddress: getEnvVar('OLLAMA_IP'),
portAddress: getEnvVar('OLLAMA_PORT'),
} as const // readonly keys

View File

@@ -1,5 +1,6 @@
import { Configuration, ServerConfig, UserConfig, isServerConfigurationKey } from '../index.js'
import fs from 'fs'
import path from 'path'
/**
* Method to open a file in the working directory and modify/create it
@@ -35,6 +36,10 @@ export function openConfig(filename: string, key: string, value: any) {
[key]: value
}
const directory = path.dirname(fullFileName)
if (!fs.existsSync(directory))
fs.mkdirSync(directory, { recursive: true })
fs.writeFileSync(`data/${filename}`, JSON.stringify(object, null, 2))
console.log(`[Util: openConfig] Created '${filename}' in working directory`)
}