Last active
August 6, 2021 23:02
-
-
Save petitroto/5ea03df9a008578b8c422031feb2fd05 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
# | |
# 言語サーバーもローカルで同時起動するスクリプト | |
# for botpress-v12_23_2-darwin-x64 | |
# | |
# 利用する言語モデルの設定(本番利用時は100を300にすべき) | |
DIM=100 | |
BASE_URL=https://botpress-public.nyc3.digitaloceanspaces.com/embeddings/ | |
FILE_BPE=bp.ja.bpe.model | |
FILE_MODEL="bp.ja.${DIM}.bin" | |
LANG_DIR=lang | |
# Botpressに与える環境変数 | |
export NODE_ENV=development | |
export EXTERNAL_URL=http://localhost:3000 | |
export BP_PRODUCTION=false | |
export BP_CONFIG_SENDUSAGESTATS=false | |
export BP_CONFIG_SHOWPOWEREDBY=false | |
export BP_CONFIG_HTTPSERVER_HOST=localhost | |
export BP_MODULE_NLU_NLUSERVER_AUTOSTART=false | |
export BP_MODULE_NLU_NLUSERVER_ENDPOINT=http://localhost:3200 | |
export BP_MODULE_NLU_LANGUAGESOURCES='[{"endpoint": "http://localhost:3100"}]' | |
export BP_MODULE_NLU_DUCKLINGENABLED=false | |
export BP_MICROSOFT_RECOGNIZER=true | |
cd "$(dirname "$0")" || exit | |
if [ ! -f "bp" ]; then | |
echo "bpというファイルがあるフォルダと同じフォルダ内に置いて実行してください" | |
read -p "エンターキーを押すと終了します" | |
exit 1 | |
fi | |
# 言語モデルがなければ先にダウンロードする | |
[ ! -d "$LANG_DIR" ] && mkdir "$LANG_DIR" | |
cd "$LANG_DIR" || return | |
[ ! -f "$FILE_BPE" ] && curl -O "${BASE_URL}${FILE_BPE}" | |
[ ! -f "$FILE_MODEL" ] && curl -O "${BASE_URL}${FILE_MODEL}" | |
cd .. | |
# Botpressサーバーと言語サーバーを両方起動(停止するときは同時に停止させる) | |
trap 'kill %1; kill %2' SIGINT | |
./bin/nlu lang --offline --dim $DIM --langDir $LANG_DIR & | |
sleep 5 | |
./bin/nlu nlu --doc=false --languageURL=http://localhost:3100 --ducklingEnabled=false & | |
sleep 3 | |
./bp |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment