fix: cannot create API-KEYS.txt

pull/10/head
sean1832 1 year ago
parent 9ef506637a
commit 65e77aa7a1

@ -13,5 +13,14 @@ def create():
{'note_dir': '', 'delimiter': '', 'append_mode': False, 'force_mode': False}) {'note_dir': '', 'delimiter': '', 'append_mode': False, 'force_mode': False})
print(f'brain memo file created: {user_dir}/brain-memo.json') print(f'brain memo file created: {user_dir}/brain-memo.json')
util.create_file_not_exist(f'{user_dir}/input.txt', '')
print(f'input file created: {user_dir}/input.txt')
if not os.path.exists(f'{user_dir}/API-KEYS.txt'):
print('Create API profile...')
api_key = input('Enter your OpenAI API key: ')
util.create_file_not_exist(f'{user_dir}/API-KEYS.txt', api_key)
print(f'API key file created: {user_dir}/API-KEYS.txt')
create() create()

@ -60,9 +60,9 @@ def create_path_not_exist(path):
os.makedirs(directory) os.makedirs(directory)
def create_file_not_exist(path): def create_file_not_exist(path, content=''):
if not os.path.exists(path): if not os.path.exists(path):
write_file('', path) write_file(content, path)
def read_file(filepath, delimiter='', force=False): def read_file(filepath, delimiter='', force=False):

@ -5,14 +5,12 @@ python -m venv venv
echo Virtural environment created successfully! echo Virtural environment created successfully!
ping 127.0.0.1 -n 2 > NUL ping 127.0.0.1 -n 2 > NUL
echo Activating Virtural environment! echo Activating Virtural environment!
call .\venv\Scripts\activate call .\venv\Scripts\activate
echo updating pip echo updating pip
python -m pip install --upgrade pip python -m pip install --upgrade pip
pip3 install -r requirements.txt pip3 install -r requirements.txt
ping 127.0.0.1 -n 2 > NUL ping 127.0.0.1 -n 2 > NUL
echo Virtual requirements installed successfully! echo Virtual requirements installed successfully!
@ -22,14 +20,6 @@ echo Creating OpenAI API keys profile...
REM if .user\ not exist, create one REM if .user\ not exist, create one
if not exist .user\ (md .user\) if not exist .user\ (md .user\)
REM Create API KEY file
if not exist .user\API-KEYS.txt (
set /p API_KEYS=[Enter your API keys]:
echo %API_KEYS%> .user\API-KEYS.txt
echo API key written to file!
)
REM copy example prompt REM copy example prompt
if not exist .user\prompt (md .user\prompt) if not exist .user\prompt (md .user\prompt)
xcopy "example_prompt\*.*" ".user\prompt" /s /i xcopy "example_prompt\*.*" ".user\prompt" /s /i
@ -37,17 +27,9 @@ xcopy "example_prompt\*.*" ".user\prompt" /s /i
REM wait 2 tick REM wait 2 tick
ping 127.0.0.1 -n 2 > NUL ping 127.0.0.1 -n 2 > NUL
REM create input txt file python initial_file_creator.py
if not exist .user\input.txt (
echo.> .user\input.txt
echo input file created!
)
python web_ui/initial_file_creator.py
echo Setup complete! Exiting... echo Setup complete! Exiting...
pause pause
Loading…
Cancel
Save