feat: support dotenv (#18)

This commit is contained in:
sigoden
2024-06-06 08:52:40 +08:00
committed by GitHub
parent bfb7d75fe4
commit 7d5b14bca1
4 changed files with 62 additions and 5 deletions
+7 -2
View File
@@ -1,6 +1,12 @@
#!/usr/bin/env bash
set -e
export LLM_FUNCTIONS_DIR="$(cd -- "$( dirname -- "${BASH_SOURCE[0]}" )/.." &> /dev/null && pwd)"
if [[ -f "$LLM_FUNCTIONS_DIR/.env" ]]; then
source "$LLM_FUNCTIONS_DIR/.env"
fi
if [[ "$0" == *tool.sh ]]; then
FUNC_FILE="$1"
FUNC_DATA="$2"
@@ -12,8 +18,7 @@ if [[ "$FUNC_FILE" != *'.sh' ]]; then
FUNC_FILE="$FUNC_FILE.sh"
fi
PROJECT_DIR="$(cd -- "$( dirname -- "${BASH_SOURCE[0]}" )/.." &> /dev/null && pwd)"
FUNC_FILE="$PROJECT_DIR/tools/$FUNC_FILE"
FUNC_FILE="$LLM_FUNCTIONS_DIR/tools/$FUNC_FILE"
if [[ "$OS" == "Windows_NT" ]]; then
FUNC_FILE="$(cygpath -w "$FUNC_FILE")"