From a977b24b9b6cedd9b1bc80e53350d33516218467 Mon Sep 17 00:00:00 2001 From: LD-Reborn Date: Mon, 20 Jul 2026 07:54:02 +0200 Subject: [PATCH] fix: fixes name in various files --- .github/workflows/deploy.yml | 10 ++++----- Ngino.sln | 8 +++---- README.md | 22 +++++++++---------- deploy/install-client.sh | 22 +++++++++---------- src/Ngino.Client/ChannelHttpContent.cs | 2 +- src/Ngino.Client/ClientOptions.cs | 8 +++---- src/Ngino.Client/Ngino.Client.csproj | 2 +- src/Ngino.Client/Program.cs | 8 +++---- src/Ngino.Client/Properties/AssemblyInfo.cs | 2 +- src/Ngino.Client/TunnelClient.cs | 6 ++--- src/Ngino.Client/TunnelWorker.cs | 2 +- src/Ngino.Client/UpstreamRequest.cs | 4 ++-- src/Ngino.Protocol/HeaderPair.cs | 2 +- src/Ngino.Protocol/ProtocolConstants.cs | 10 ++++----- src/Ngino.Protocol/TunnelMessage.cs | 2 +- src/Ngino.Protocol/TunnelMessageTypes.cs | 2 +- .../WebSocketMessageTransport.cs | 2 +- src/Ngino.Server/AdminEndpoints.cs | 6 ++--- src/Ngino.Server/AuthRateLimiter.cs | 2 +- src/Ngino.Server/Data/ApplicationDbContext.cs | 4 ++-- src/Ngino.Server/EmbeddingCache.cs | 6 ++--- src/Ngino.Server/ManagementStore.cs | 2 +- src/Ngino.Server/Models/ApplicationUser.cs | 2 +- src/Ngino.Server/Ngino.Server.csproj | 2 +- src/Ngino.Server/PendingCommand.cs | 4 ++-- src/Ngino.Server/PendingProxyRequest.cs | 4 ++-- src/Ngino.Server/Program.cs | 12 +++++----- src/Ngino.Server/ResponseTokenCounter.cs | 2 +- src/Ngino.Server/ReverseProxyEndpoint.cs | 8 +++---- src/Ngino.Server/ServerSettings.cs | 20 ++++++++--------- src/Ngino.Server/TokenAuthentication.cs | 4 ++-- src/Ngino.Server/TunnelConnection.cs | 4 ++-- src/Ngino.Server/TunnelHub.cs | 4 ++-- src/Ngino.Server/appsettings.Example.json | 2 +- src/Ngino.Server/wwwroot/admin/index.html | 4 ++-- .../PackageAuditTests.cs | 6 ++--- .../ReverseLlama.Client.Tests.csproj | 2 +- .../TunnelClientModelTests.cs | 6 ++--- .../UpstreamRequestTests.cs | 4 ++-- 39 files changed, 112 insertions(+), 112 deletions(-) diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index b866317..46f9388 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -18,13 +18,13 @@ jobs: dotnet-version: '10.0.x' - name: Restore dependencies - run: dotnet restore src/ReverseLlama.Server + run: dotnet restore src/Ngino.Server - name: Build - run: dotnet build src/ReverseLlama.Server --configuration Release --no-restore + run: dotnet build src/Ngino.Server --configuration Release --no-restore - name: Publish - run: dotnet publish src/ReverseLlama.Server -c Release -o publish + run: dotnet publish src/Ngino.Server -c Release -o publish - name: Copy files to server uses: appleboy/scp-action@v1.0.0 @@ -34,7 +34,7 @@ jobs: password: ${{ secrets.DEPLOY_SSH_PASSWORD }} port: ${{ secrets.DEPLOY_SSH_PORT }} source: "publish/*" - target: "/var/www/ReverseLlama" + target: "/var/www/Ngino" strip_components: 1 - name: Restart app @@ -45,4 +45,4 @@ jobs: password: ${{ secrets.DEPLOY_SSH_PASSWORD }} port: ${{ secrets.DEPLOY_SSH_PORT }} script: | - sudo systemctl restart ReverseLlama.service \ No newline at end of file + sudo systemctl restart Ngino.service \ No newline at end of file diff --git a/Ngino.sln b/Ngino.sln index d526251..8aca58c 100644 --- a/Ngino.sln +++ b/Ngino.sln @@ -5,15 +5,15 @@ VisualStudioVersion = 17.0.31903.59 MinimumVisualStudioVersion = 10.0.40219.1 Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{827E0CD3-B72D-47B6-A68D-7590B98EB39B}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ReverseLlama.Protocol", "src\ReverseLlama.Protocol\ReverseLlama.Protocol.csproj", "{D85E1D3C-0AC3-4810-8285-16BE903EC8AB}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Ngino.Protocol", "src\Ngino.Protocol\Ngino.Protocol.csproj", "{D85E1D3C-0AC3-4810-8285-16BE903EC8AB}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ReverseLlama.Server", "src\ReverseLlama.Server\ReverseLlama.Server.csproj", "{FB853CB0-5AEF-4278-82E7-3C8E506F9DFE}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Ngino.Server", "src\Ngino.Server\Ngino.Server.csproj", "{FB853CB0-5AEF-4278-82E7-3C8E506F9DFE}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ReverseLlama.Client", "src\ReverseLlama.Client\ReverseLlama.Client.csproj", "{0633EAE6-B82A-4A27-851C-B5D6E11CBE03}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Ngino.Client", "src\Ngino.Client\Ngino.Client.csproj", "{0633EAE6-B82A-4A27-851C-B5D6E11CBE03}" EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "tests", "tests", "{0AB3BF05-4346-4AA6-1389-037BE0695223}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ReverseLlama.Client.Tests", "tests\ReverseLlama.Client.Tests\ReverseLlama.Client.Tests.csproj", "{B03E7794-2888-4B56-A30F-B6C25BCFB89A}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Ngino.Client.Tests", "tests\Ngino.Client.Tests\Ngino.Client.Tests.csproj", "{B03E7794-2888-4B56-A30F-B6C25BCFB89A}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution diff --git a/README.md b/README.md index 381af8a..924eff4 100644 --- a/README.md +++ b/README.md @@ -62,14 +62,14 @@ dotnet run --project src/Ngino.Client -- --server http://your-server:5050 --upst Call Ollama through the server. Model-bearing requests on the root path are routed to a connected client that reports that model, preferring the client with the fewest in-flight requests. You can still address one client explicitly by id: ```powershell -curl.exe -H "X-Reverse-Llama-Token: change-me" http://your-server:5050/api/tags -curl.exe -H "X-Reverse-Llama-Token: change-me" http://your-server:5050/clients/gpu-01/api/tags +curl.exe -H "X-Ngino-Token: change-me" http://your-server:5050/api/tags +curl.exe -H "X-Ngino-Token: change-me" http://your-server:5050/clients/gpu-01/api/tags curl.exe http://your-server:5050/token/change-me/api/tags curl.exe http://your-server:5050/token/change-me/clients/gpu-01/api/tags ``` ```powershell -curl.exe -H "X-Reverse-Llama-Token: change-me" ` +curl.exe -H "X-Ngino-Token: change-me" ` -H "Content-Type: application/json" ` -d '{"model":"llama3.1","prompt":"hello"}' ` http://your-server:5050/api/generate @@ -79,9 +79,9 @@ curl.exe -H "X-Reverse-Llama-Token: change-me" ` Server options: -- `--token ` or `REVERSE_LLAMA_TOKEN`: optional shared token. If set, proxy calls must authenticate with `X-Reverse-Llama-Token`, `Authorization: Bearer `, or the `/token//...` path prefix. -- `--tunnel-path `: defaults to `/_reverse-llama/tunnel`. -- `--status-path `: defaults to `/_reverse-llama/status`. +- `--token ` or `REVERSE_LLAMA_TOKEN`: optional shared token. If set, proxy calls must authenticate with `X-Ngino-Token`, `Authorization: Bearer `, or the `/token//...` path prefix. +- `--tunnel-path `: defaults to `/_ngino/tunnel`. +- `--status-path `: defaults to `/_ngino/status`. - `--chunk-size ` or `REVERSE_LLAMA_CHUNK_SIZE`: defaults to `65536`. - `--embedding-cache-path ` or `REVERSE_LLAMA_EMBEDDING_CACHE_PATH`: SQLite cache file for embedding vectors. Defaults to `App_Data\embedding-cache.sqlite` under the server app directory. - `--management-database-path ` or `REVERSE_LLAMA_MANAGEMENT_DATABASE_PATH`: SQLite database for admin user keys, client keys, client disable state, and request/model metrics. Defaults to `App_Data\management.sqlite` under the server app directory. @@ -91,7 +91,7 @@ Admin UI: - `GET /admin` opens the Keycloak-protected management UI. - The temporary Keycloak settings live under `Authentication:Keycloak` in `appsettings.json`. -- User keys created in the UI are accepted anywhere the shared token is accepted: `X-Reverse-Llama-Token`, `Authorization: Bearer `, `?token=...`, and `/token//...`. +- User keys created in the UI are accepted anywhere the shared token is accepted: `X-Ngino-Token`, `Authorization: Bearer `, `?token=...`, and `/token//...`. - Model add/remove/load/unload commands are sent through the connected tunnel client to Ollama (`/api/pull`, `/api/delete`, `/api/generate`, and `/api/show`). Client options: @@ -100,11 +100,11 @@ Client options: - `--upstream ` or `REVERSE_LLAMA_UPSTREAM`: local Ollama URL, defaults to `http://localhost:11434`. - `--token ` or `REVERSE_LLAMA_TOKEN`: optional shared token. - `--client-id ` or `REVERSE_LLAMA_CLIENT_ID`: identifies this machine on the server; defaults to the machine name. -- `--tunnel-path ` or `REVERSE_LLAMA_TUNNEL_PATH`: defaults to `/_reverse-llama/tunnel`. +- `--tunnel-path ` or `REVERSE_LLAMA_TUNNEL_PATH`: defaults to `/_ngino/tunnel`. - `--reconnect-delay ` or `REVERSE_LLAMA_RECONNECT_DELAY_SECONDS`: defaults to `5`. - `--chunk-size ` or `REVERSE_LLAMA_CHUNK_SIZE`: defaults to `65536`. -The token is accepted as `X-Reverse-Llama-Token`, as `Authorization: Bearer `, or as a path prefix like `/token//api/tags` or `/token//clients/{id}/v1`. The Bearer form lets OpenAI-compatible clients (e.g. n8n's OpenAI nodes pointed at `/clients/{id}/v1`) authenticate with their API-key field. The path-token form is useful for clients that cannot send custom headers. The server strips its own token header/Bearer value and removes the path prefix before forwarding; any other `Authorization` value is forwarded untouched. +The token is accepted as `X-Ngino-Token`, as `Authorization: Bearer `, or as a path prefix like `/token//api/tags` or `/token//clients/{id}/v1`. The Bearer form lets OpenAI-compatible clients (e.g. n8n's OpenAI nodes pointed at `/clients/{id}/v1`) authenticate with their API-key field. The path-token form is useful for clients that cannot send custom headers. The server strips its own token header/Bearer value and removes the path prefix before forwarding; any other `Authorization` value is forwarded untouched. ## Multiple clients @@ -118,7 +118,7 @@ Any number of machines can connect at the same time; each registers under its cl ## Embedding cache -The server keeps an in-memory KV cache for embedding vectors and persists it to SQLite. The cache key is the requested `model` plus the exact input text. It applies to `POST /api/embed`, `POST /api/embeddings`, and `POST /v1/embeddings`; cache hits return JSON in the same endpoint family shape and include `X-Reverse-Llama-Embedding-Cache: hit`. +The server keeps an in-memory KV cache for embedding vectors and persists it to SQLite. The cache key is the requested `model` plus the exact input text. It applies to `POST /api/embed`, `POST /api/embeddings`, and `POST /v1/embeddings`; cache hits return JSON in the same endpoint family shape and include `X-Ngino-Embedding-Cache: hit`. The authenticated status endpoint reports whether the cache is available, plus the cache count and database path. If SQLite cannot be initialized, proxy traffic continues without embedding-cache writes. @@ -141,7 +141,7 @@ The script ensures .NET 10 and Ollama are installed, builds the client self-cont ## Security notes - Use HTTPS or a private network/VPN when exposing this outside a trusted network. -- **Tokens in URLs** (`/token//...` and `?token=...`) are logged by web servers (Apache, Nginx, Kestrel), reverse proxies, and browsers (history). Malicious MITM proxies can also read them. Prefer header-based auth (`X-Reverse-Llama-Token` or `Authorization: Bearer`) when your client supports it. +- **Tokens in URLs** (`/token//...` and `?token=...`) are logged by web servers (Apache, Nginx, Kestrel), reverse proxies, and browsers (history). Malicious MITM proxies can also read them. Prefer header-based auth (`X-Ngino-Token` or `Authorization: Bearer`) when your client supports it. - The token is simple shared-secret protection, not a full access-control system. ## AI Disclosure diff --git a/deploy/install-client.sh b/deploy/install-client.sh index bd389f6..cb63dbb 100755 --- a/deploy/install-client.sh +++ b/deploy/install-client.sh @@ -33,10 +33,10 @@ usage() { cat < ReverseLlama server URL (e.g. http://my-server:5050) + --server Ngino server URL (e.g. http://my-server:5050) --token Shared secret token for the server Optional: @@ -71,7 +71,7 @@ done # ── Prompt for missing required values ─────────────────────────────────────── if [[ -z "$SERVER_URL" ]]; then - read -rp "ReverseLlama server URL (e.g. http://my-server:5050): " SERVER_URL + read -rp "Ngino server URL (e.g. http://my-server:5050): " SERVER_URL fi if [[ -z "$SERVER_URL" ]]; then die "Server URL is required." @@ -225,7 +225,7 @@ else fi # ── Build client from source ───────────────────────────────────────────────── -CLIENT_SRC="$REPO_ROOT/src/ReverseLlama.Client" +CLIENT_SRC="$REPO_ROOT/src/Ngino.Client" if [[ ! -d "$CLIENT_SRC" ]]; then die "Client source not found at $CLIENT_SRC. Run this script from the repository or pass --install-dir." fi @@ -238,18 +238,18 @@ case "$ARCH" in *) die "Unsupported architecture: $ARCH" ;; esac -info "Building ReverseLlama client (self-contained, $DOTNET_RID)..." +info "Building Ngino client (self-contained, $DOTNET_RID)..." BUILD_DIR="$(mktemp -d /tmp/ngino-build.XXXXXX)" trap 'rm -rf "$BUILD_DIR"' EXIT -"$DOTNET_CMD" publish "$CLIENT_SRC/ReverseLlama.Client.csproj" \ +"$DOTNET_CMD" publish "$CLIENT_SRC/Ngino.Client.csproj" \ -c Release \ -r "$DOTNET_RID" \ --self-contained true \ -o "$BUILD_DIR" -if [[ ! -f "$BUILD_DIR/ReverseLlama.Client" ]]; then - die "Build failed. ReverseLlama.Client binary not found in output." +if [[ ! -f "$BUILD_DIR/Ngino.Client" ]]; then + die "Build failed. Ngino.Client binary not found in output." fi info "Build successful." @@ -258,7 +258,7 @@ info "Build successful." info "Installing to $INSTALL_DIR..." mkdir -p "$INSTALL_DIR" cp -a "$BUILD_DIR"/. "$INSTALL_DIR/" -chmod +x "$INSTALL_DIR/ReverseLlama.Client" +chmod +x "$INSTALL_DIR/Ngino.Client" info "Client installed to $INSTALL_DIR." @@ -279,7 +279,7 @@ fi cat > "$SERVICE_FILE" < """ - ReverseLlama.Client options: + Ngino.Client options: --server Server base URL, e.g. http://my-server:5050 --upstream Local upstream URL, e.g. http://localhost:11434 --token Optional token matching the server --client-id Identifies this machine on the server; defaults to the machine name - --tunnel-path Defaults to /_reverse-llama/tunnel + --tunnel-path Defaults to /_ngino/tunnel --reconnect-delay Defaults to 5 --chunk-size Defaults to 65536 """; diff --git a/src/Ngino.Client/Ngino.Client.csproj b/src/Ngino.Client/Ngino.Client.csproj index 27d71c3..31c5cc5 100644 --- a/src/Ngino.Client/Ngino.Client.csproj +++ b/src/Ngino.Client/Ngino.Client.csproj @@ -1,7 +1,7 @@  - + diff --git a/src/Ngino.Client/Program.cs b/src/Ngino.Client/Program.cs index e295caf..4d5a1e4 100644 --- a/src/Ngino.Client/Program.cs +++ b/src/Ngino.Client/Program.cs @@ -1,13 +1,13 @@ using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Hosting; using Microsoft.Extensions.Logging; -using ReverseLlama.Client; +using Ngino.Client; try { var options = ClientOptions.Parse(args); - Console.WriteLine("ReverseLlama client"); + Console.WriteLine("Ngino client"); Console.WriteLine($" client id: {options.ClientId}"); Console.WriteLine($" server tunnel: {options.TunnelUri}"); Console.WriteLine($" local upstream: {options.Upstream}"); @@ -17,9 +17,9 @@ try builder.Services.AddSingleton(options); builder.Services.AddSingleton(); builder.Services.AddHostedService(); - builder.Services.AddWindowsService(service => service.ServiceName = "ReverseLlamaClient"); + builder.Services.AddWindowsService(service => service.ServiceName = "NginoClient"); // The EventLog provider defaults to Warning; connection state is worth seeing there. - builder.Logging.AddFilter("ReverseLlama.Client", LogLevel.Information); + builder.Logging.AddFilter("Ngino.Client", LogLevel.Information); await builder.Build().RunAsync(); return 0; diff --git a/src/Ngino.Client/Properties/AssemblyInfo.cs b/src/Ngino.Client/Properties/AssemblyInfo.cs index 4458d19..6e9394c 100644 --- a/src/Ngino.Client/Properties/AssemblyInfo.cs +++ b/src/Ngino.Client/Properties/AssemblyInfo.cs @@ -1,3 +1,3 @@ using System.Runtime.CompilerServices; -[assembly: InternalsVisibleTo("ReverseLlama.Client.Tests")] +[assembly: InternalsVisibleTo("Ngino.Client.Tests")] diff --git a/src/Ngino.Client/TunnelClient.cs b/src/Ngino.Client/TunnelClient.cs index 7a72cc1..f61e38c 100644 --- a/src/Ngino.Client/TunnelClient.cs +++ b/src/Ngino.Client/TunnelClient.cs @@ -4,16 +4,16 @@ using System.Text; using System.Text.Json; using Microsoft.Extensions.Logging; using Microsoft.Extensions.Logging.Abstractions; -using ReverseLlama.Protocol; +using Ngino.Protocol; -namespace ReverseLlama.Client; +namespace Ngino.Client; internal sealed class TunnelClient { private static readonly TimeSpan ModelRefreshInterval = TimeSpan.FromSeconds(15); private static readonly TimeSpan ModelRefreshTimeout = TimeSpan.FromSeconds(10); private static readonly JsonSerializerOptions JsonOptions = new(JsonSerializerDefaults.Web); - private const string EmbeddingWarmupInput = "ReverseLlama warmup"; + private const string EmbeddingWarmupInput = "Ngino warmup"; private readonly ConcurrentDictionary _activeRequests = new(); private readonly HttpClient _httpClient; diff --git a/src/Ngino.Client/TunnelWorker.cs b/src/Ngino.Client/TunnelWorker.cs index 9e1b156..986413e 100644 --- a/src/Ngino.Client/TunnelWorker.cs +++ b/src/Ngino.Client/TunnelWorker.cs @@ -1,6 +1,6 @@ using Microsoft.Extensions.Hosting; -namespace ReverseLlama.Client; +namespace Ngino.Client; internal sealed class TunnelWorker : BackgroundService { diff --git a/src/Ngino.Client/UpstreamRequest.cs b/src/Ngino.Client/UpstreamRequest.cs index 3d4358e..2c37270 100644 --- a/src/Ngino.Client/UpstreamRequest.cs +++ b/src/Ngino.Client/UpstreamRequest.cs @@ -1,8 +1,8 @@ using System.Net.Http.Headers; using System.Threading.Channels; -using ReverseLlama.Protocol; +using Ngino.Protocol; -namespace ReverseLlama.Client; +namespace Ngino.Client; internal sealed class UpstreamRequest { diff --git a/src/Ngino.Protocol/HeaderPair.cs b/src/Ngino.Protocol/HeaderPair.cs index 4a06fac..b41ee40 100644 --- a/src/Ngino.Protocol/HeaderPair.cs +++ b/src/Ngino.Protocol/HeaderPair.cs @@ -1,4 +1,4 @@ -namespace ReverseLlama.Protocol; +namespace Ngino.Protocol; public sealed class HeaderPair { diff --git a/src/Ngino.Protocol/ProtocolConstants.cs b/src/Ngino.Protocol/ProtocolConstants.cs index 36235d9..a3ce956 100644 --- a/src/Ngino.Protocol/ProtocolConstants.cs +++ b/src/Ngino.Protocol/ProtocolConstants.cs @@ -1,10 +1,10 @@ -namespace ReverseLlama.Protocol; +namespace Ngino.Protocol; public static class ProtocolConstants { - public const string DefaultStatusPath = "/_reverse-llama/status"; - public const string DefaultTunnelPath = "/_reverse-llama/tunnel"; - public const string TokenHeader = "X-Reverse-Llama-Token"; - public const string ClientIdHeader = "X-Reverse-Llama-Client-Id"; + public const string DefaultStatusPath = "/_ngino/status"; + public const string DefaultTunnelPath = "/_ngino/tunnel"; + public const string TokenHeader = "X-Ngino-Token"; + public const string ClientIdHeader = "X-Ngino-Client-Id"; public const string ReplacedCloseDescription = "reverse-llama-replaced"; } diff --git a/src/Ngino.Protocol/TunnelMessage.cs b/src/Ngino.Protocol/TunnelMessage.cs index 1828527..b4ab8f0 100644 --- a/src/Ngino.Protocol/TunnelMessage.cs +++ b/src/Ngino.Protocol/TunnelMessage.cs @@ -1,4 +1,4 @@ -namespace ReverseLlama.Protocol; +namespace Ngino.Protocol; public sealed class TunnelMessage { diff --git a/src/Ngino.Protocol/TunnelMessageTypes.cs b/src/Ngino.Protocol/TunnelMessageTypes.cs index 375c2e1..ceafe8d 100644 --- a/src/Ngino.Protocol/TunnelMessageTypes.cs +++ b/src/Ngino.Protocol/TunnelMessageTypes.cs @@ -1,4 +1,4 @@ -namespace ReverseLlama.Protocol; +namespace Ngino.Protocol; public static class TunnelMessageTypes { diff --git a/src/Ngino.Protocol/WebSocketMessageTransport.cs b/src/Ngino.Protocol/WebSocketMessageTransport.cs index 2a24a47..f79b748 100644 --- a/src/Ngino.Protocol/WebSocketMessageTransport.cs +++ b/src/Ngino.Protocol/WebSocketMessageTransport.cs @@ -1,7 +1,7 @@ using System.Net.WebSockets; using System.Text.Json; -namespace ReverseLlama.Protocol; +namespace Ngino.Protocol; public static class WebSocketMessageTransport { diff --git a/src/Ngino.Server/AdminEndpoints.cs b/src/Ngino.Server/AdminEndpoints.cs index 2db8756..d1b01d8 100644 --- a/src/Ngino.Server/AdminEndpoints.cs +++ b/src/Ngino.Server/AdminEndpoints.cs @@ -9,10 +9,10 @@ using Microsoft.AspNetCore.Identity; using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.StaticFiles; using Microsoft.EntityFrameworkCore; -using ReverseLlama.Server.Data; -using ReverseLlama.Server.Models; +using Ngino.Server.Data; +using Ngino.Server.Models; -namespace ReverseLlama.Server; +namespace Ngino.Server; internal static class AdminEndpoints { diff --git a/src/Ngino.Server/AuthRateLimiter.cs b/src/Ngino.Server/AuthRateLimiter.cs index 3c1e6ca..2a7f7b6 100644 --- a/src/Ngino.Server/AuthRateLimiter.cs +++ b/src/Ngino.Server/AuthRateLimiter.cs @@ -1,7 +1,7 @@ using System.Collections.Concurrent; using ElmahCore; -namespace ReverseLlama.Server; +namespace Ngino.Server; internal sealed class AuthRateLimiter { diff --git a/src/Ngino.Server/Data/ApplicationDbContext.cs b/src/Ngino.Server/Data/ApplicationDbContext.cs index aea5c2c..40857b7 100644 --- a/src/Ngino.Server/Data/ApplicationDbContext.cs +++ b/src/Ngino.Server/Data/ApplicationDbContext.cs @@ -1,8 +1,8 @@ using Microsoft.AspNetCore.Identity.EntityFrameworkCore; using Microsoft.EntityFrameworkCore; -using ReverseLlama.Server.Models; +using Ngino.Server.Models; -namespace ReverseLlama.Server.Data; +namespace Ngino.Server.Data; internal sealed class ApplicationDbContext : IdentityDbContext { diff --git a/src/Ngino.Server/EmbeddingCache.cs b/src/Ngino.Server/EmbeddingCache.cs index ef997db..235ba9e 100644 --- a/src/Ngino.Server/EmbeddingCache.cs +++ b/src/Ngino.Server/EmbeddingCache.cs @@ -2,9 +2,9 @@ using System.Collections.Concurrent; using System.Text.Json; using Microsoft.AspNetCore.Http.Features; using Microsoft.Data.Sqlite; -using ReverseLlama.Protocol; +using Ngino.Protocol; -namespace ReverseLlama.Server; +namespace Ngino.Server; internal sealed class EmbeddingCache { @@ -121,7 +121,7 @@ internal sealed class EmbeddingCache context.Response.StatusCode = StatusCodes.Status200OK; context.Response.ContentType = JsonContentType; context.Response.ContentLength = body.Length; - context.Response.Headers["X-Reverse-Llama-Embedding-Cache"] = "hit"; + context.Response.Headers["X-Ngino-Embedding-Cache"] = "hit"; await context.Response.Body.WriteAsync(body, context.RequestAborted); return true; diff --git a/src/Ngino.Server/ManagementStore.cs b/src/Ngino.Server/ManagementStore.cs index ae12b32..c8aa592 100644 --- a/src/Ngino.Server/ManagementStore.cs +++ b/src/Ngino.Server/ManagementStore.cs @@ -3,7 +3,7 @@ using System.Text; using System.Text.RegularExpressions; using Microsoft.Data.Sqlite; -namespace ReverseLlama.Server; +namespace Ngino.Server; internal sealed class ManagementStore { diff --git a/src/Ngino.Server/Models/ApplicationUser.cs b/src/Ngino.Server/Models/ApplicationUser.cs index ea76fb1..b2b4d6d 100644 --- a/src/Ngino.Server/Models/ApplicationUser.cs +++ b/src/Ngino.Server/Models/ApplicationUser.cs @@ -1,6 +1,6 @@ using Microsoft.AspNetCore.Identity; -namespace ReverseLlama.Server.Models; +namespace Ngino.Server.Models; internal sealed class ApplicationUser : IdentityUser { diff --git a/src/Ngino.Server/Ngino.Server.csproj b/src/Ngino.Server/Ngino.Server.csproj index d10ecd0..e681b53 100644 --- a/src/Ngino.Server/Ngino.Server.csproj +++ b/src/Ngino.Server/Ngino.Server.csproj @@ -10,7 +10,7 @@ - + diff --git a/src/Ngino.Server/PendingCommand.cs b/src/Ngino.Server/PendingCommand.cs index a2e11c4..00cac8f 100644 --- a/src/Ngino.Server/PendingCommand.cs +++ b/src/Ngino.Server/PendingCommand.cs @@ -1,6 +1,6 @@ -using ReverseLlama.Protocol; +using Ngino.Protocol; -namespace ReverseLlama.Server; +namespace Ngino.Server; internal sealed class PendingCommand { diff --git a/src/Ngino.Server/PendingProxyRequest.cs b/src/Ngino.Server/PendingProxyRequest.cs index 3bf39ae..73284de 100644 --- a/src/Ngino.Server/PendingProxyRequest.cs +++ b/src/Ngino.Server/PendingProxyRequest.cs @@ -1,7 +1,7 @@ using System.Threading.Channels; -using ReverseLlama.Protocol; +using Ngino.Protocol; -namespace ReverseLlama.Server; +namespace Ngino.Server; internal sealed class PendingProxyRequest { diff --git a/src/Ngino.Server/Program.cs b/src/Ngino.Server/Program.cs index 67317af..a49b8c7 100644 --- a/src/Ngino.Server/Program.cs +++ b/src/Ngino.Server/Program.cs @@ -7,10 +7,10 @@ using Microsoft.AspNetCore.Authentication.OpenIdConnect; using Microsoft.AspNetCore.Identity; using Microsoft.EntityFrameworkCore; using Microsoft.IdentityModel.Protocols.OpenIdConnect; -using ReverseLlama.Protocol; -using ReverseLlama.Server; -using ReverseLlama.Server.Data; -using ReverseLlama.Server.Models; +using Ngino.Protocol; +using Ngino.Server; +using Ngino.Server.Data; +using Ngino.Server.Models; var builder = WebApplication.CreateBuilder(args); var settings = ServerSettings.FromConfiguration(builder.Configuration); @@ -33,7 +33,7 @@ if (settings.Keycloak.IsConfigured) }) .AddCookie(options => { - options.Cookie.Name = "ReverseLlama.Admin"; + options.Cookie.Name = "Ngino.Admin"; options.Cookie.SameSite = SameSiteMode.Lax; options.Cookie.SecurePolicy = settings.SecureCookies ? CookieSecurePolicy.Always : CookieSecurePolicy.None; options.LoginPath = "/admin/login"; @@ -103,7 +103,7 @@ if (!settings.Keycloak.IsConfigured) builder.Services.ConfigureApplicationCookie(options => { - options.Cookie.Name = "ReverseLlama.Admin"; + options.Cookie.Name = "Ngino.Admin"; options.Cookie.SameSite = SameSiteMode.Lax; options.Cookie.SecurePolicy = settings.SecureCookies ? CookieSecurePolicy.Always : CookieSecurePolicy.None; options.LoginPath = "/admin/login"; diff --git a/src/Ngino.Server/ResponseTokenCounter.cs b/src/Ngino.Server/ResponseTokenCounter.cs index bbe661d..7479054 100644 --- a/src/Ngino.Server/ResponseTokenCounter.cs +++ b/src/Ngino.Server/ResponseTokenCounter.cs @@ -1,7 +1,7 @@ using System.Text; using System.Text.Json; -namespace ReverseLlama.Server; +namespace Ngino.Server; internal sealed class ResponseTokenCounter { diff --git a/src/Ngino.Server/ReverseProxyEndpoint.cs b/src/Ngino.Server/ReverseProxyEndpoint.cs index be50ffa..ff7d704 100644 --- a/src/Ngino.Server/ReverseProxyEndpoint.cs +++ b/src/Ngino.Server/ReverseProxyEndpoint.cs @@ -2,13 +2,13 @@ using System.Text.Json; using ElmahCore; using Microsoft.AspNetCore.Http.Features; using Microsoft.Extensions.Primitives; -using ReverseLlama.Protocol; +using Ngino.Protocol; -namespace ReverseLlama.Server; +namespace Ngino.Server; internal static class ReverseProxyEndpoint { - private const string UnauthorizedMessage = "Missing or invalid ReverseLlama token."; + private const string UnauthorizedMessage = "Missing or invalid Ngino token."; private static readonly HashSet HopByHopHeaders = new(StringComparer.OrdinalIgnoreCase) { @@ -501,7 +501,7 @@ internal static class ReverseProxyEndpoint ManagementStore managementStore, string? userKeyId = null) { - var logger = loggerFactory.CreateLogger("ReverseLlama.Server.ReverseProxy"); + var logger = loggerFactory.CreateLogger("Ngino.Server.ReverseProxy"); var requestId = Guid.NewGuid().ToString("n"); var pending = connection.RegisterPending(requestId); var startedAt = DateTimeOffset.UtcNow; diff --git a/src/Ngino.Server/ServerSettings.cs b/src/Ngino.Server/ServerSettings.cs index 0d05e25..5c20d9f 100644 --- a/src/Ngino.Server/ServerSettings.cs +++ b/src/Ngino.Server/ServerSettings.cs @@ -1,7 +1,7 @@ using Microsoft.Extensions.Configuration; -using ReverseLlama.Protocol; +using Ngino.Protocol; -namespace ReverseLlama.Server; +namespace Ngino.Server; internal sealed class ServerSettings { @@ -29,22 +29,22 @@ internal sealed class ServerSettings { return new ServerSettings { - StatusPath = NormalizePath(Read(configuration, "ReverseLlama:StatusPath", "status-path") ?? ProtocolConstants.DefaultStatusPath), - TunnelPath = NormalizePath(Read(configuration, "ReverseLlama:TunnelPath", "tunnel-path") ?? ProtocolConstants.DefaultTunnelPath), - Token = Read(configuration, "ReverseLlama:Token", "token") ?? Environment.GetEnvironmentVariable("REVERSE_LLAMA_TOKEN"), - ClientToken = Read(configuration, "ReverseLlama:ClientToken", "client-token") ?? Environment.GetEnvironmentVariable("REVERSE_LLAMA_CLIENT_TOKEN"), - ChunkSize = ReadInt(configuration, 64 * 1024, "ReverseLlama:ChunkSize", "chunk-size", "REVERSE_LLAMA_CHUNK_SIZE"), + StatusPath = NormalizePath(Read(configuration, "Ngino:StatusPath", "status-path") ?? ProtocolConstants.DefaultStatusPath), + TunnelPath = NormalizePath(Read(configuration, "Ngino:TunnelPath", "tunnel-path") ?? ProtocolConstants.DefaultTunnelPath), + Token = Read(configuration, "Ngino:Token", "token") ?? Environment.GetEnvironmentVariable("REVERSE_LLAMA_TOKEN"), + ClientToken = Read(configuration, "Ngino:ClientToken", "client-token") ?? Environment.GetEnvironmentVariable("REVERSE_LLAMA_CLIENT_TOKEN"), + ChunkSize = ReadInt(configuration, 64 * 1024, "Ngino:ChunkSize", "chunk-size", "REVERSE_LLAMA_CHUNK_SIZE"), EmbeddingCachePath = Read( configuration, - "ReverseLlama:EmbeddingCachePath", + "Ngino:EmbeddingCachePath", "embedding-cache-path", "REVERSE_LLAMA_EMBEDDING_CACHE_PATH"), ManagementDatabasePath = Read( configuration, - "ReverseLlama:ManagementDatabasePath", + "Ngino:ManagementDatabasePath", "management-database-path", "REVERSE_LLAMA_MANAGEMENT_DATABASE_PATH"), - SecureCookies = ReadBool(configuration, true, "ReverseLlama:SecureCookies", "secure-cookies", "REVERSE_LLAMA_SECURE_COOKIES"), + SecureCookies = ReadBool(configuration, true, "Ngino:SecureCookies", "secure-cookies", "REVERSE_LLAMA_SECURE_COOKIES"), Keycloak = new KeycloakSettings { Authority = Read(configuration, "Authentication:Keycloak:Authority", "REVERSE_LLAMA_KEYCLOAK_AUTHORITY"), diff --git a/src/Ngino.Server/TokenAuthentication.cs b/src/Ngino.Server/TokenAuthentication.cs index ad08cae..9f6c6fc 100644 --- a/src/Ngino.Server/TokenAuthentication.cs +++ b/src/Ngino.Server/TokenAuthentication.cs @@ -1,8 +1,8 @@ using System.Security.Cryptography; using System.Text; -using ReverseLlama.Protocol; +using Ngino.Protocol; -namespace ReverseLlama.Server; +namespace Ngino.Server; internal static class TokenAuthentication { diff --git a/src/Ngino.Server/TunnelConnection.cs b/src/Ngino.Server/TunnelConnection.cs index 489ed8c..4c987cf 100644 --- a/src/Ngino.Server/TunnelConnection.cs +++ b/src/Ngino.Server/TunnelConnection.cs @@ -1,8 +1,8 @@ using System.Collections.Concurrent; using System.Net.WebSockets; -using ReverseLlama.Protocol; +using Ngino.Protocol; -namespace ReverseLlama.Server; +namespace Ngino.Server; internal sealed class TunnelConnection { diff --git a/src/Ngino.Server/TunnelHub.cs b/src/Ngino.Server/TunnelHub.cs index 60bbcef..e46f144 100644 --- a/src/Ngino.Server/TunnelHub.cs +++ b/src/Ngino.Server/TunnelHub.cs @@ -1,9 +1,9 @@ using System.Collections.Concurrent; using System.Net.WebSockets; using System.Threading; -using ReverseLlama.Protocol; +using Ngino.Protocol; -namespace ReverseLlama.Server; +namespace Ngino.Server; internal sealed class TunnelHub { diff --git a/src/Ngino.Server/appsettings.Example.json b/src/Ngino.Server/appsettings.Example.json index d09ec67..b541a4b 100644 --- a/src/Ngino.Server/appsettings.Example.json +++ b/src/Ngino.Server/appsettings.Example.json @@ -11,7 +11,7 @@ "Authentication": { "Keycloak": { "Authority": "http://your-keycloak-server/realms/master", - "ClientId": "ReverseLlama", + "ClientId": "Ngino", "ClientSecret": "YOUR-Client-SECRET-GOES-HERE-AND-YES-ITS-VERY-LONG", "RequireHttpsMetadata": false } diff --git a/src/Ngino.Server/wwwroot/admin/index.html b/src/Ngino.Server/wwwroot/admin/index.html index 9ce345b..76713ae 100644 --- a/src/Ngino.Server/wwwroot/admin/index.html +++ b/src/Ngino.Server/wwwroot/admin/index.html @@ -3,7 +3,7 @@ - ReverseLlama Admin + Ngino Admin @@ -12,7 +12,7 @@
RL - ReverseLlama + Ngino Admin
diff --git a/tests/ReverseLlama.Client.Tests/PackageAuditTests.cs b/tests/ReverseLlama.Client.Tests/PackageAuditTests.cs index 29bba8a..086a81f 100644 --- a/tests/ReverseLlama.Client.Tests/PackageAuditTests.cs +++ b/tests/ReverseLlama.Client.Tests/PackageAuditTests.cs @@ -2,7 +2,7 @@ using System.Diagnostics; using System.Text.Json; using Xunit; -namespace ReverseLlama.Client.Tests; +namespace Ngino.Client.Tests; public sealed class PackageAuditTests { @@ -32,7 +32,7 @@ public sealed class PackageAuditTests var directory = new DirectoryInfo(AppContext.BaseDirectory); while (directory is not null) { - var solutionPath = Path.Combine(directory.FullName, "ReverseLlama.sln"); + var solutionPath = Path.Combine(directory.FullName, "Ngino.sln"); if (File.Exists(solutionPath)) { return solutionPath; @@ -41,7 +41,7 @@ public sealed class PackageAuditTests directory = directory.Parent; } - throw new InvalidOperationException("Could not find ReverseLlama.sln from the test output directory."); + throw new InvalidOperationException("Could not find Ngino.sln from the test output directory."); } private static async Task RunDotnetPackageAuditAsync(string solutionPath) diff --git a/tests/ReverseLlama.Client.Tests/ReverseLlama.Client.Tests.csproj b/tests/ReverseLlama.Client.Tests/ReverseLlama.Client.Tests.csproj index 579d3cd..a1d0bde 100644 --- a/tests/ReverseLlama.Client.Tests/ReverseLlama.Client.Tests.csproj +++ b/tests/ReverseLlama.Client.Tests/ReverseLlama.Client.Tests.csproj @@ -18,7 +18,7 @@ - +
diff --git a/tests/ReverseLlama.Client.Tests/TunnelClientModelTests.cs b/tests/ReverseLlama.Client.Tests/TunnelClientModelTests.cs index 7d81f33..7005970 100644 --- a/tests/ReverseLlama.Client.Tests/TunnelClientModelTests.cs +++ b/tests/ReverseLlama.Client.Tests/TunnelClientModelTests.cs @@ -1,8 +1,8 @@ using System.Text.Json; -using ReverseLlama.Client; +using Ngino.Client; using Xunit; -namespace ReverseLlama.Client.Tests; +namespace Ngino.Client.Tests; public sealed class TunnelClientModelTests { @@ -56,7 +56,7 @@ public sealed class TunnelClientModelTests Assert.Equal(HttpMethod.Post, request.Method); Assert.Equal("http://localhost:11434/api/embed", request.RequestUri!.AbsoluteUri); Assert.Equal("bge-m3:latest", document.RootElement.GetProperty("model").GetString()); - Assert.Equal("ReverseLlama warmup", document.RootElement.GetProperty("input").GetString()); + Assert.Equal("Ngino warmup", document.RootElement.GetProperty("input").GetString()); Assert.Equal(expectedKeepAlive, document.RootElement.GetProperty("keep_alive").GetInt32()); } } diff --git a/tests/ReverseLlama.Client.Tests/UpstreamRequestTests.cs b/tests/ReverseLlama.Client.Tests/UpstreamRequestTests.cs index bd5b5a0..cffe339 100644 --- a/tests/ReverseLlama.Client.Tests/UpstreamRequestTests.cs +++ b/tests/ReverseLlama.Client.Tests/UpstreamRequestTests.cs @@ -1,7 +1,7 @@ -using ReverseLlama.Client; +using Ngino.Client; using Xunit; -namespace ReverseLlama.Client.Tests; +namespace Ngino.Client.Tests; public sealed class UpstreamRequestTests {