Update prosty-rag.cmd
Browse files- prosty-rag.cmd +9 -5
prosty-rag.cmd
CHANGED
|
@@ -5,6 +5,7 @@ echo \" >/dev/null ">NUL "\" \`" <#"
|
|
| 5 |
:; embedfile="bge-m3.embedfile"
|
| 6 |
:; dbfile="prosty-rag.db"
|
| 7 |
:; indeksator="indeksator.cmd"
|
|
|
|
| 8 |
:; prompt="Jeste艣 pomocnym asystentem. Odpowiedz na pytania u偶ytkownika korzystaj膮c z podanego kontekstu, zawieraj膮cego wybrane fragmenty plik贸w. Na ko艅cu podaj odwo艂anie do pliku 藕r贸d艂a. Je艣li nie potrafisz odpowiedzie膰, to napisz to. Nie zmy艣laj."
|
| 9 |
:; # Instalacja
|
| 10 |
:; [ ! -f $llamafile ] && echo Pobieranie $llamafile... && curl -Lo $llamafile https://huggingface.co/jglowa/prosty-rag/resolve/main/prosty-rag.llamafile?download=true && chmod +x $llamafile && echo Gotowe!
|
|
@@ -12,11 +13,12 @@ echo \" >/dev/null ">NUL "\" \`" <#"
|
|
| 12 |
:; [ ! -f $indeksator ] && echo Pobieranie $indeksator... && curl -Lo $indeksator https://huggingface.co/jglowa/prosty-rag/resolve/main/indeksator.cmd?download=true && chmod +x $indeksator && echo Gotowe!
|
| 13 |
:; [ ! -f $dbfile ] && ./$indeksator
|
| 14 |
:; # Uruchamianie
|
|
|
|
| 15 |
:; echo "Uruchamianie serwera embedfile na http://localhost:8081..."
|
| 16 |
:; rm -f response; mkfifo response; cat response | nc -lkp 8081 -q 1 > >(read req; q="${req#*\?q=}"; q="${q%% *}"; q="${q//+/ }"; q=$(printf "%b" "${q//%/\\x}"); printf "HTTP/1.0 200 OK\r\nContent-Type: text/plain; charset=utf-8\r\n\r\n%s" "$(./$embedfile search $dbfile "$q")" > response) &
|
| 17 |
:; echo "Uruchamianie serwera llamafile na http://localhost:8080..."
|
| 18 |
-
:; ./$llamafile --server --v2 --prompt "$prompt" --flash-attn 1 $@ &
|
| 19 |
-
:; echo "Uruchamianie czatu na stronie http://localhost:8080 w przegl膮darce..." &&
|
| 20 |
:; # Windows:
|
| 21 |
@echo off
|
| 22 |
chcp 65001 >nul
|
|
@@ -25,6 +27,7 @@ set llamafile=prosty-rag.llamafile
|
|
| 25 |
set embedfile=bge-m3.embedfile
|
| 26 |
set dbfile=prosty-rag.db
|
| 27 |
set indeksator=indeksator.cmd
|
|
|
|
| 28 |
set "prompt=Jeste艣 pomocnym asystentem. Odpowiedz na pytania u偶ytkownika korzystaj膮c z podanego kontekstu, zawieraj膮cego wybrane fragmenty plik贸w. Na ko艅cu podaj odwo艂anie do pliku 藕r贸d艂a. Je艣li nie potrafisz odpowiedzie膰, to napisz to. Nie zmy艣laj."
|
| 29 |
:; # Instalacja
|
| 30 |
if not exist %llamafile% echo Pobieranie %llamafile%... && curl -Lo %llamafile% https://huggingface.co/jglowa/prosty-rag/resolve/main/prosty-rag.llamafile?download=true && echo Gotowe^^!
|
|
@@ -32,10 +35,11 @@ if not exist %embedfile% echo Pobieranie %embedfile%... && curl -Lo %embedfile%
|
|
| 32 |
if not exist %indeksator% echo Pobieranie %indeksator%... && curl -Lo %indeksator% https://huggingface.co/jglowa/prosty-rag/resolve/main/indeksator.cmd?download=true && echo Gotowe^^!
|
| 33 |
if not exist %dbfile% call %indeksator%
|
| 34 |
:; # Uruchamianie
|
|
|
|
| 35 |
start cmd /c "powershell -Command "Invoke-Expression $([System.IO.File]::ReadAllText('%~f0'))""
|
| 36 |
-
start cmd /c "echo Uruchamianie
|
| 37 |
-
|
| 38 |
-
|
| 39 |
endlocal
|
| 40 |
goto :eof
|
| 41 |
:; # PowerShell
|
|
|
|
| 5 |
:; embedfile="bge-m3.embedfile"
|
| 6 |
:; dbfile="prosty-rag.db"
|
| 7 |
:; indeksator="indeksator.cmd"
|
| 8 |
+
:; logfile="prosty-rag.log"
|
| 9 |
:; prompt="Jeste艣 pomocnym asystentem. Odpowiedz na pytania u偶ytkownika korzystaj膮c z podanego kontekstu, zawieraj膮cego wybrane fragmenty plik贸w. Na ko艅cu podaj odwo艂anie do pliku 藕r贸d艂a. Je艣li nie potrafisz odpowiedzie膰, to napisz to. Nie zmy艣laj."
|
| 10 |
:; # Instalacja
|
| 11 |
:; [ ! -f $llamafile ] && echo Pobieranie $llamafile... && curl -Lo $llamafile https://huggingface.co/jglowa/prosty-rag/resolve/main/prosty-rag.llamafile?download=true && chmod +x $llamafile && echo Gotowe!
|
|
|
|
| 13 |
:; [ ! -f $indeksator ] && echo Pobieranie $indeksator... && curl -Lo $indeksator https://huggingface.co/jglowa/prosty-rag/resolve/main/indeksator.cmd?download=true && chmod +x $indeksator && echo Gotowe!
|
| 14 |
:; [ ! -f $dbfile ] && ./$indeksator
|
| 15 |
:; # Uruchamianie
|
| 16 |
+
:; >$logfile
|
| 17 |
:; echo "Uruchamianie serwera embedfile na http://localhost:8081..."
|
| 18 |
:; rm -f response; mkfifo response; cat response | nc -lkp 8081 -q 1 > >(read req; q="${req#*\?q=}"; q="${q%% *}"; q="${q//+/ }"; q=$(printf "%b" "${q//%/\\x}"); printf "HTTP/1.0 200 OK\r\nContent-Type: text/plain; charset=utf-8\r\n\r\n%s" "$(./$embedfile search $dbfile "$q")" > response) &
|
| 19 |
:; echo "Uruchamianie serwera llamafile na http://localhost:8080..."
|
| 20 |
+
:; ./$llamafile --server --v2 --prompt "$prompt" --flash-attn 1 $@ 2>&1 | tee $logfile &
|
| 21 |
+
:; (tail -f $logfile &) | grep -q "server listen" && echo "Uruchamianie czatu na stronie http://localhost:8080 w przegl膮darce..." && xdg-open "http://localhost:8080" || open "http://localhost:8080"; wait; exit $?
|
| 22 |
:; # Windows:
|
| 23 |
@echo off
|
| 24 |
chcp 65001 >nul
|
|
|
|
| 27 |
set embedfile=bge-m3.embedfile
|
| 28 |
set dbfile=prosty-rag.db
|
| 29 |
set indeksator=indeksator.cmd
|
| 30 |
+
set logfile=prosty-rag.log
|
| 31 |
set "prompt=Jeste艣 pomocnym asystentem. Odpowiedz na pytania u偶ytkownika korzystaj膮c z podanego kontekstu, zawieraj膮cego wybrane fragmenty plik贸w. Na ko艅cu podaj odwo艂anie do pliku 藕r贸d艂a. Je艣li nie potrafisz odpowiedzie膰, to napisz to. Nie zmy艣laj."
|
| 32 |
:; # Instalacja
|
| 33 |
if not exist %llamafile% echo Pobieranie %llamafile%... && curl -Lo %llamafile% https://huggingface.co/jglowa/prosty-rag/resolve/main/prosty-rag.llamafile?download=true && echo Gotowe^^!
|
|
|
|
| 35 |
if not exist %indeksator% echo Pobieranie %indeksator%... && curl -Lo %indeksator% https://huggingface.co/jglowa/prosty-rag/resolve/main/indeksator.cmd?download=true && echo Gotowe^^!
|
| 36 |
if not exist %dbfile% call %indeksator%
|
| 37 |
:; # Uruchamianie
|
| 38 |
+
break>%logfile%
|
| 39 |
start cmd /c "powershell -Command "Invoke-Expression $([System.IO.File]::ReadAllText('%~f0'))""
|
| 40 |
+
start cmd /c "echo Uruchamianie serwera llamafile na http://localhost:8080... && %llamafile% --server --v2 --prompt "%prompt%" --flash-attn 1 %* 2>&1 | find /v "" >%logfile%"
|
| 41 |
+
:waitForReady
|
| 42 |
+
findstr /c:"server listen" %logfile% >nul && echo Uruchamianie czatu na http://localhost:8080 w przegl膮darce... && start http://localhost:8080 || (timeout 1 >nul & goto waitForReady)
|
| 43 |
endlocal
|
| 44 |
goto :eof
|
| 45 |
:; # PowerShell
|