Update prosty-rag.cmd
Browse files- prosty-rag.cmd +1 -1
prosty-rag.cmd
CHANGED
@@ -15,7 +15,7 @@ echo \" >/dev/null ">NUL "\" \`" <#"
|
|
15 |
:; # Uruchamianie
|
16 |
:; >$logfile
|
17 |
:; echo "Uruchamianie serwera embedfile na http://localhost:8081..."
|
18 |
-
:;
|
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 $?
|
|
|
15 |
:; # Uruchamianie
|
16 |
:; >$logfile
|
17 |
:; echo "Uruchamianie serwera embedfile na http://localhost:8081..."
|
18 |
+
:; perl -MIO::Socket::INET -we 'my $topK=3; $SIG{INT}=$SIG{TERM}=sub { exit(0); }; my $s=IO::Socket::INET->new(LocalAddr=>"localhost",LocalPort=>8081,Proto=>"tcp",Listen=>1,ReuseAddr=>1) or die $!; while(my $c=$s->accept) { $c->autoflush(1); my $req=<$c>//""; my ($q)=$req=~/\?q=([^ ]+)/; if(defined $q && $q ne "") { $q=~s/%([0-9A-Fa-f]{2})/chr(hex $1)/eg; $q=~s/[\n+]/ /g; open my $fh, "-|", "./bge-m3.embedfile","search","prosty-rag.db",$q or die $!; my @out=<$fh>; close $fh; @out=@out[0..($topK-1)] if @out > $topK; print $c "HTTP/1.0 200 OK\r\nAccess-Control-Allow-Origin: *\r\nContent-Type: text/plain; charset=utf-8\r\n\r\n",@out; } else { print $c "HTTP/1.0 400 Bad Request\r\nAccess-Control-Allow-Origin: *\r\n\r\nBrak zapytania"; } close $c; }' &
|
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 $?
|