Use dotenv

This commit is contained in:
powermaker450 2024-07-14 13:48:25 -04:00
parent 570ad87713
commit 7d975fda8e
4 changed files with 19 additions and 1 deletions

13
package-lock.json generated
View file

@ -7,6 +7,7 @@
"name": "Tailchat-Assistant",
"dependencies": {
"chalk": "^4.1.2",
"dotenv": "^16.4.5",
"openai": "^4.50.0",
"tailchat-client-sdk": "^1.0.9"
},
@ -277,6 +278,18 @@
"node": ">=0.4.0"
}
},
"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/emoji-regex": {
"version": "10.3.0",
"resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-10.3.0.tgz",

View file

@ -3,6 +3,7 @@
"description": "Tailchat Assistant is your very own AI-powered chat bot, ready to implement into your guild!",
"dependencies": {
"chalk": "^4.1.2",
"dotenv": "^16.4.5",
"openai": "^4.50.0",
"tailchat-client-sdk": "^1.0.9"
},
@ -14,7 +15,7 @@
},
"scripts": {
"build": "tsc -p .",
"start": "node --env-file=.env ./dist/bot.js",
"start": "node ./dist/bot.js",
"cstart": "npm run build && npm run start",
"prepare": "husky prepare"
},

View file

@ -1,4 +1,6 @@
import { Model, Temperature } from "./types";
import dotenv from "dotenv";
dotenv.config();
export const endpoint = process.env.API_ENDPOINT || "http://localhost:8080/v1";
export const textModel: Model = process.env.TEXT_MODEL || "gpt-4";

View file

@ -22,6 +22,8 @@ import {
} from "./assistant";
import { ImagesResponse } from "openai/resources";
import chalk from "chalk";
import dotenv from "dotenv";
dotenv.config();
// Specific to Tailchat. The endpoint of my Tailchat server, the bot ID and Secret.
const HOST = process.env.HOST;