Update indeksator.cmd
Browse files- indeksator.cmd +9 -5
indeksator.cmd
CHANGED
|
@@ -1,7 +1,9 @@
|
|
| 1 |
:; shopt -s nullglob expand_aliases || setopt nullglob aliases; alias @set='' @echo='echo'
|
| 2 |
@echo Indeksator Prosty RAG v0.4 - Jerzy Glowacki na licencji Apache 2.0
|
| 3 |
:; # Zmienne:
|
| 4 |
-
@set embedfile=
|
|
|
|
|
|
|
| 5 |
@set inputDir=baza
|
| 6 |
@set chunksFile=chunks.txt
|
| 7 |
@set dbFile=prosty-rag.db
|
|
@@ -12,7 +14,8 @@
|
|
| 12 |
:; >$chunksFile
|
| 13 |
:; # Instalacja
|
| 14 |
:; [ ! -d $inputDir ] && echo Pobieranie przyk艂adowego pliku $inputDir/wikipedia.txt... && curl --create-dirs -Lo $inputDir/wikipedia.txt https://huggingface.co/jglowa/prosty-rag/resolve/main/baza/wikipedia.txt?download=true && echo Gotowe!
|
| 15 |
-
:; [ ! -f $embedfile ] && echo Pobieranie $embedfile... && curl -Lo $embedfile https://
|
|
|
|
| 16 |
:; [ ! -f pdftotext ] && echo Pobieranie pdftotext... && curl -LO https://dl.xpdfreader.com/xpdf-tools-$OS-4.05.tar.gz && tar --strip-components 2 -xzf xpdf-tools-$OS-4.05.tar.gz xpdf-tools-$OS-4.05/bin64/pdftotext && rm xpdf-tools-$OS-4.05.tar.gz && echo Gotowe!
|
| 17 |
:; # Uruchamianie
|
| 18 |
:; echo "Indeksowanie plik贸w PDF/TXT/MD/CSV w folderze $inputDir..."
|
|
@@ -32,7 +35,7 @@
|
|
| 32 |
:; done
|
| 33 |
:; echo "Osadzanie plik贸w w bazie danych..."
|
| 34 |
:; [ -f $dbFile ] && rm $dbFile
|
| 35 |
-
:; ./$embedfile import $chunksFile $dbFile && ./$embedfile sh $dbFile "CREATE VIRTUAL TABLE fts_items USING fts5(line, tokenize='porter')" "INSERT INTO fts_items SELECT * FROM items" && echo "Gotowe! Po ka偶dej zmianie w folderze $inputDir nale偶y uruchomi膰 ponownie indeksator."
|
| 36 |
:; rm $chunksFile; exit $?
|
| 37 |
:; # Windows:
|
| 38 |
@echo off
|
|
@@ -43,7 +46,8 @@ for /l %%i in (1,1,%overlapWords%) do set buf[%%i]=
|
|
| 43 |
break>%chunksFile%
|
| 44 |
:; # Instalacja
|
| 45 |
if not exist %inputDir% echo Pobieranie przyk艂adowego pliku %inputDir%\wikipedia.txt... && curl --create-dirs -Lo %inputDir%\wikipedia.txt https://huggingface.co/jglowa/prosty-rag/resolve/main/baza/wikipedia.txt?download=true && echo Gotowe^^!
|
| 46 |
-
if not exist %embedfile% echo Pobieranie %embedfile%... && curl -Lo %embedfile% https://
|
|
|
|
| 47 |
if not exist pdftotext.exe echo Pobieranie pdftotext.exe... && curl -LO https://dl.xpdfreader.com/xpdf-tools-win-4.05.zip && tar --strip-components 2 -xf xpdf-tools-win-4.05.zip xpdf-tools-win-4.05/bin64/pdftotext.exe && del xpdf-tools-win-4.05.zip && echo Gotowe^^!
|
| 48 |
:; # Uruchamianie
|
| 49 |
echo Indeksowanie plik贸w PDF/TXT/MD/CSV w folderze %inputDir%...
|
|
@@ -77,7 +81,7 @@ for %%F in ("%inputDir%\*.txt" "%inputDir%\*.md") do (
|
|
| 77 |
)
|
| 78 |
echo Osadzanie plik贸w w bazie danych...
|
| 79 |
if exist %dbFile% del %dbFile%
|
| 80 |
-
%embedfile% import %chunksFile% %dbFile% && %embedfile% sh %dbFile% "CREATE VIRTUAL TABLE fts_items USING fts5(line, tokenize='porter')" "INSERT INTO fts_items SELECT * FROM items" && echo Gotowe^^! Po ka偶dej zmianie w folderze %inputDir% nale偶y uruchomi膰 ponownie indeksator.
|
| 81 |
del %chunksFile%
|
| 82 |
endlocal
|
| 83 |
pause
|
|
|
|
| 1 |
:; shopt -s nullglob expand_aliases || setopt nullglob aliases; alias @set='' @echo='echo'
|
| 2 |
@echo Indeksator Prosty RAG v0.4 - Jerzy Glowacki na licencji Apache 2.0
|
| 3 |
:; # Zmienne:
|
| 4 |
+
@set embedfile=prosty-rag.embedfile
|
| 5 |
+
@set embedmodelfile=bge-m3.gguf
|
| 6 |
+
@set embedmodelURL=https://huggingface.co/gpustack/bge-m3-GGUF/resolve/main/bge-m3-Q6_K.gguf?download=true
|
| 7 |
@set inputDir=baza
|
| 8 |
@set chunksFile=chunks.txt
|
| 9 |
@set dbFile=prosty-rag.db
|
|
|
|
| 14 |
:; >$chunksFile
|
| 15 |
:; # Instalacja
|
| 16 |
:; [ ! -d $inputDir ] && echo Pobieranie przyk艂adowego pliku $inputDir/wikipedia.txt... && curl --create-dirs -Lo $inputDir/wikipedia.txt https://huggingface.co/jglowa/prosty-rag/resolve/main/baza/wikipedia.txt?download=true && echo Gotowe!
|
| 17 |
+
:; [ ! -f $embedfile ] && echo Pobieranie $embedfile... && curl -Lo $embedfile https://github.com/niutech/llamafile/releases/download/0.9.3/embedfile && chmod +x $embedfile && echo Gotowe!
|
| 18 |
+
:; [ ! -f "$embedmodelfile" ] && echo Pobieranie $embedmodelfile... && curl -Lo "$embedmodelfile" $embedmodelURL && echo Gotowe!
|
| 19 |
:; [ ! -f pdftotext ] && echo Pobieranie pdftotext... && curl -LO https://dl.xpdfreader.com/xpdf-tools-$OS-4.05.tar.gz && tar --strip-components 2 -xzf xpdf-tools-$OS-4.05.tar.gz xpdf-tools-$OS-4.05/bin64/pdftotext && rm xpdf-tools-$OS-4.05.tar.gz && echo Gotowe!
|
| 20 |
:; # Uruchamianie
|
| 21 |
:; echo "Indeksowanie plik贸w PDF/TXT/MD/CSV w folderze $inputDir..."
|
|
|
|
| 35 |
:; done
|
| 36 |
:; echo "Osadzanie plik贸w w bazie danych..."
|
| 37 |
:; [ -f $dbFile ] && rm $dbFile
|
| 38 |
+
:; ./$embedfile -m $embedmodelfile import $chunksFile $dbFile && ./$embedfile -m $embedmodelfile sh $dbFile "CREATE VIRTUAL TABLE fts_items USING fts5(line, tokenize='porter')" "INSERT INTO fts_items SELECT * FROM items" && echo "Gotowe! Po ka偶dej zmianie w folderze $inputDir nale偶y uruchomi膰 ponownie indeksator."
|
| 39 |
:; rm $chunksFile; exit $?
|
| 40 |
:; # Windows:
|
| 41 |
@echo off
|
|
|
|
| 46 |
break>%chunksFile%
|
| 47 |
:; # Instalacja
|
| 48 |
if not exist %inputDir% echo Pobieranie przyk艂adowego pliku %inputDir%\wikipedia.txt... && curl --create-dirs -Lo %inputDir%\wikipedia.txt https://huggingface.co/jglowa/prosty-rag/resolve/main/baza/wikipedia.txt?download=true && echo Gotowe^^!
|
| 49 |
+
if not exist %embedfile% echo Pobieranie %embedfile%... && curl -Lo %embedfile% https://github.com/niutech/llamafile/releases/download/0.9.3/embedfile && echo Gotowe^^!
|
| 50 |
+
if not exist %embedmodelfile% echo Pobieranie %embedmodelfile%... && curl -Lo %embedmodelfile% %embedmodelURL% && echo Gotowe^^!
|
| 51 |
if not exist pdftotext.exe echo Pobieranie pdftotext.exe... && curl -LO https://dl.xpdfreader.com/xpdf-tools-win-4.05.zip && tar --strip-components 2 -xf xpdf-tools-win-4.05.zip xpdf-tools-win-4.05/bin64/pdftotext.exe && del xpdf-tools-win-4.05.zip && echo Gotowe^^!
|
| 52 |
:; # Uruchamianie
|
| 53 |
echo Indeksowanie plik贸w PDF/TXT/MD/CSV w folderze %inputDir%...
|
|
|
|
| 81 |
)
|
| 82 |
echo Osadzanie plik贸w w bazie danych...
|
| 83 |
if exist %dbFile% del %dbFile%
|
| 84 |
+
%embedfile% -m %embedmodelfile% import %chunksFile% %dbFile% && %embedfile% -m %embedmodelfile% sh %dbFile% "CREATE VIRTUAL TABLE fts_items USING fts5(line, tokenize='porter')" "INSERT INTO fts_items SELECT * FROM items" && echo Gotowe^^! Po ka偶dej zmianie w folderze %inputDir% nale偶y uruchomi膰 ponownie indeksator.
|
| 85 |
del %chunksFile%
|
| 86 |
endlocal
|
| 87 |
pause
|