Skip to content

Commit 11e41ca

Browse files
committed
Адаптация скрипта запуска на Linux
1 parent f678878 commit 11e41ca

File tree

1 file changed

+45
-9
lines changed

1 file changed

+45
-9
lines changed

start_webui_linux.sh

Lines changed: 45 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,62 @@
1-
#!/usr/bin/bash
1+
#!/bin/bash
2+
echo "Opening NeuroGPT..."
23

34
export HIDE_OTHER_PROVIDERS=false
45
export SHOW_ALL_PROVIDERS=false
5-
cp config.json config_temp.json
6+
7+
echo "Checking for updates..."
8+
python -c "import json; import collections; config = json.load(open('config.json')); keys = list(config.keys()); keys.insert(2, keys.pop(keys.index('daku_api_key'))); config = collections.OrderedDict([(key, config[key]) for key in keys]); json.dump(config, open('config.json', 'w'), indent=4)"
9+
10+
# Создаем временную копию файла config.json
11+
cp config.json config_temp.json
612
git checkout main
713
git fetch --all
814
git reset --hard origin/main
915
git pull
16+
1017
# Восстанавливаем оригинальный файл config.json
11-
cp config_temp.json config.json
12-
rm config_temp.json
18+
mv config_temp.json config.json
19+
20+
# Checking for Python version
21+
version=$(python3 --version | cut -d " " -f 2)
22+
if [[ "$version" < "3.10.0" ]]; then
23+
echo "Your version of Python ${version} is not supported. Please install Python 3.10.X"
24+
exit 1
25+
elif [[ "$version" > "3.11.14" ]]; then
26+
echo "Your version of Python ${version} is not supported. Please install Python 3.10.X"
27+
exit 1
28+
fi
1329

1430
python3 -m venv venv
15-
source venv/bin/activate
31+
. venv/bin/activate
1632
python3 -m pip install --upgrade pip
1733
python3 -m pip install -U setuptools
1834
python3 -m pip install -r requirements.txt
1935

20-
python3 -m spacy download en_core_web_sm
21-
python3 -m spacy download zh_core_web_sm
22-
python3 -m spacy download ru_core_news_sm
36+
# Checking for spacy language models and download if not exists
37+
if [ ! -d "venv/lib/python3.10/site-packages/en_core_web_sm" ]; then
38+
echo "English language model not found, downloading..."
39+
python3 -m spacy download en_core_web_sm
40+
fi
41+
42+
if [ ! -d "venv/lib/python3.10/site-packages/zh_core_web_sm" ]; then
43+
echo "Chinese language model not found, downloading..."
44+
python3 -m spacy download zh_core_web_sm
45+
fi
46+
47+
if [ ! -d "venv/lib/python3.10/site-packages/ru_core_news_sm" ]; then
48+
echo "Russian language model not found, downloading..."
49+
python3 -m spacy download ru_core_news_sm
50+
fi
2351

52+
echo "Completed."
53+
echo "Running NeuroGPT..."
2454

25-
python3 webui_ru.py
55+
# Determine the language of the operating system
56+
language=$(locale | grep LANG= | cut -d "=" -f2 | cut -d "_" -f1)
2657

58+
if [ "$language" = "ru" ]; then
59+
python3 webui_ru.py
60+
else
61+
python3 webui_en.py
62+
fi

0 commit comments

Comments
 (0)