Merge pull request #339 from Fosowl/dev
Fix : #338 python not found for key generation
This commit is contained in:
@@ -282,7 +282,7 @@ Start services:
|
|||||||
start ./start_services.cmd # Window
|
start ./start_services.cmd # Window
|
||||||
```
|
```
|
||||||
|
|
||||||
Use the CLI: `python3 cli.py`
|
Use the CLI: `uv run cli.py`
|
||||||
|
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|||||||
+1
-1
@@ -243,7 +243,7 @@ start ./start_services.cmd full # Windows
|
|||||||
start ./start_services.cmd # Windows
|
start ./start_services.cmd # Windows
|
||||||
```
|
```
|
||||||
|
|
||||||
然后运行:`python3 cli.py`
|
然后运行:`uv run cli.py`
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -239,7 +239,7 @@ start ./start_services.cmd full # Windows
|
|||||||
start ./start_services.cmd # Windows
|
start ./start_services.cmd # Windows
|
||||||
```
|
```
|
||||||
|
|
||||||
然後運行:`python3 cli.py`
|
然後運行:`uv run cli.py`
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -243,7 +243,7 @@ Inicia los servicios:
|
|||||||
start ./start_services.cmd # Windows
|
start ./start_services.cmd # Windows
|
||||||
```
|
```
|
||||||
|
|
||||||
Luego ejecuta: `python3 cli.py`
|
Luego ejecuta: `uv run cli.py`
|
||||||
|
|
||||||
## Uso
|
## Uso
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -243,7 +243,7 @@ Démarrez les services :
|
|||||||
start ./start_services.cmd # Windows
|
start ./start_services.cmd # Windows
|
||||||
```
|
```
|
||||||
|
|
||||||
Puis lancez : `python3 cli.py`
|
Puis lancez : `uv run cli.py`
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -238,7 +238,7 @@ CLIで実行する場合はホストにパッケージをインストールし
|
|||||||
start ./start_services.cmd # Windows
|
start ./start_services.cmd # Windows
|
||||||
```
|
```
|
||||||
|
|
||||||
その後 `python3 cli.py` を実行
|
その後 `uv run cli.py` を実行
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -243,7 +243,7 @@ Inicie os serviços:
|
|||||||
start ./start_services.cmd # Windows
|
start ./start_services.cmd # Windows
|
||||||
```
|
```
|
||||||
|
|
||||||
Depois execute: `python3 cli.py`
|
Depois execute: `uv run cli.py`
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
|
|||||||
@@ -5,7 +5,6 @@ set LLM_ROUTER_DIR=llm_router
|
|||||||
if exist "%SCRIPTS_DIR%\windows_install.bat" (
|
if exist "%SCRIPTS_DIR%\windows_install.bat" (
|
||||||
echo Running Windows installation script...
|
echo Running Windows installation script...
|
||||||
call "%SCRIPTS_DIR%\windows_install.bat"
|
call "%SCRIPTS_DIR%\windows_install.bat"
|
||||||
cd "%LLM_ROUTER_DIR%" && call dl_safetensors.bat
|
|
||||||
) else (
|
) else (
|
||||||
echo Error: %SCRIPTS_DIR%\windows_install.bat not found!
|
echo Error: %SCRIPTS_DIR%\windows_install.bat not found!
|
||||||
exit /b 1
|
exit /b 1
|
||||||
|
|||||||
@@ -41,13 +41,13 @@ class Tools():
|
|||||||
self.config = configparser.ConfigParser()
|
self.config = configparser.ConfigParser()
|
||||||
self.work_dir = self.create_work_dir()
|
self.work_dir = self.create_work_dir()
|
||||||
self.excutable_blocks_found = False
|
self.excutable_blocks_found = False
|
||||||
self.safe_mode = True
|
self.safe_mode = False
|
||||||
self.allow_language_exec_bash = False
|
self.allow_language_exec_bash = False
|
||||||
|
|
||||||
def get_work_dir(self):
|
def get_work_dir(self):
|
||||||
return self.work_dir
|
return self.work_dir
|
||||||
|
|
||||||
def set_allow_language_exec_bash(value: bool) -> None:
|
def set_allow_language_exec_bash(self, value: bool) -> None:
|
||||||
self.allow_language_exec_bash = value
|
self.allow_language_exec_bash = value
|
||||||
|
|
||||||
def safe_get_work_dir_path(self):
|
def safe_get_work_dir_path(self):
|
||||||
@@ -152,7 +152,7 @@ class Tools():
|
|||||||
self.excutable_blocks_found = False
|
self.excutable_blocks_found = False
|
||||||
return tmp
|
return tmp
|
||||||
|
|
||||||
def load_exec_block(self, llm_text: str) -> tuple[list[str], str | None]:
|
def load_exec_block(self, llm_text: str):
|
||||||
"""
|
"""
|
||||||
Extract code/query blocks from LLM-generated text and process them for execution.
|
Extract code/query blocks from LLM-generated text and process them for execution.
|
||||||
This method parses the text looking for code blocks marked with the tool's tag (e.g. ```python).
|
This method parses the text looking for code blocks marked with the tool's tag (e.g. ```python).
|
||||||
|
|||||||
+19
-7
@@ -7,19 +7,31 @@ if "%1"=="full" (
|
|||||||
echo !msg!
|
echo !msg!
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@echo off
|
||||||
where openssl >nul 2>&1
|
openssl rand -hex 32 >nul 2>&1
|
||||||
if %ERRORLEVEL% == 0 (
|
if %ERRORLEVEL% == 0 (
|
||||||
for /f %%i in ('openssl rand -hex 32') do set SEARXNG_SECRET_KEY=%%i
|
for /f %%i in ('openssl rand -hex 32') do set SEARXNG_SECRET_KEY=%%i
|
||||||
) else (
|
goto :key_generated
|
||||||
where python >nul 2>&1
|
)
|
||||||
|
|
||||||
|
python --version >nul 2>&1
|
||||||
if %ERRORLEVEL% == 0 (
|
if %ERRORLEVEL% == 0 (
|
||||||
for /f %%i in ('python -c "import secrets; print(secrets.token_hex(32))"') do set SEARXNG_SECRET_KEY=%%i
|
for /f %%i in ('python -c "import secrets; print(secrets.token_hex(32))"') do set SEARXNG_SECRET_KEY=%%i
|
||||||
) else (
|
goto :key_generated
|
||||||
|
)
|
||||||
|
|
||||||
|
py --version >nul 2>&1
|
||||||
|
if %ERRORLEVEL% == 0 (
|
||||||
|
for /f %%i in ('py -c "import secrets; print(secrets.token_hex(32))"') do set SEARXNG_SECRET_KEY=%%i
|
||||||
|
goto :key_generated
|
||||||
|
)
|
||||||
|
|
||||||
echo Error: Neither openssl nor python is available to generate a secret key.
|
echo Error: Neither openssl nor python is available to generate a secret key.
|
||||||
|
echo Please install Python from https://python.org or OpenSSL
|
||||||
exit /b 2
|
exit /b 2
|
||||||
)
|
|
||||||
)
|
:key_generated
|
||||||
|
echo Secret key generated successfully
|
||||||
|
|
||||||
REM Generate secret key
|
REM Generate secret key
|
||||||
for /f %%i in ('powershell -command "[System.Web.Security.Membership]::GeneratePassword(64,0)"') do set SEARXNG_SECRET_KEY=%%i
|
for /f %%i in ('powershell -command "[System.Web.Security.Membership]::GeneratePassword(64,0)"') do set SEARXNG_SECRET_KEY=%%i
|
||||||
|
|||||||
Reference in New Issue
Block a user