fix: fixes name in various files
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
using System.Net;
|
||||
using System.Threading.Channels;
|
||||
|
||||
namespace ReverseLlama.Client;
|
||||
namespace Ngino.Client;
|
||||
|
||||
internal sealed class ChannelHttpContent : HttpContent
|
||||
{
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
using ReverseLlama.Protocol;
|
||||
using Ngino.Protocol;
|
||||
|
||||
namespace ReverseLlama.Client;
|
||||
namespace Ngino.Client;
|
||||
|
||||
internal sealed class ClientOptions
|
||||
{
|
||||
@@ -59,12 +59,12 @@ internal sealed class ClientOptions
|
||||
|
||||
public static string Usage =>
|
||||
"""
|
||||
ReverseLlama.Client options:
|
||||
Ngino.Client options:
|
||||
--server <url> Server base URL, e.g. http://my-server:5050
|
||||
--upstream <url> Local upstream URL, e.g. http://localhost:11434
|
||||
--token <value> Optional token matching the server
|
||||
--client-id <name> Identifies this machine on the server; defaults to the machine name
|
||||
--tunnel-path <path> Defaults to /_reverse-llama/tunnel
|
||||
--tunnel-path <path> Defaults to /_ngino/tunnel
|
||||
--reconnect-delay <sec> Defaults to 5
|
||||
--chunk-size <bytes> Defaults to 65536
|
||||
""";
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\ReverseLlama.Protocol\ReverseLlama.Protocol.csproj" />
|
||||
<ProjectReference Include="..\Ngino.Protocol\Ngino.Protocol.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
||||
@@ -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<TunnelClient>();
|
||||
builder.Services.AddHostedService<TunnelWorker>();
|
||||
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<Microsoft.Extensions.Logging.EventLog.EventLogLoggerProvider>("ReverseLlama.Client", LogLevel.Information);
|
||||
builder.Logging.AddFilter<Microsoft.Extensions.Logging.EventLog.EventLogLoggerProvider>("Ngino.Client", LogLevel.Information);
|
||||
|
||||
await builder.Build().RunAsync();
|
||||
return 0;
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
using System.Runtime.CompilerServices;
|
||||
|
||||
[assembly: InternalsVisibleTo("ReverseLlama.Client.Tests")]
|
||||
[assembly: InternalsVisibleTo("Ngino.Client.Tests")]
|
||||
|
||||
@@ -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<string, UpstreamRequest> _activeRequests = new();
|
||||
private readonly HttpClient _httpClient;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
using Microsoft.Extensions.Hosting;
|
||||
|
||||
namespace ReverseLlama.Client;
|
||||
namespace Ngino.Client;
|
||||
|
||||
internal sealed class TunnelWorker : BackgroundService
|
||||
{
|
||||
|
||||
@@ -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
|
||||
{
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
namespace ReverseLlama.Protocol;
|
||||
namespace Ngino.Protocol;
|
||||
|
||||
public sealed class HeaderPair
|
||||
{
|
||||
|
||||
@@ -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";
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
namespace ReverseLlama.Protocol;
|
||||
namespace Ngino.Protocol;
|
||||
|
||||
public sealed class TunnelMessage
|
||||
{
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
namespace ReverseLlama.Protocol;
|
||||
namespace Ngino.Protocol;
|
||||
|
||||
public static class TunnelMessageTypes
|
||||
{
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
using System.Net.WebSockets;
|
||||
using System.Text.Json;
|
||||
|
||||
namespace ReverseLlama.Protocol;
|
||||
namespace Ngino.Protocol;
|
||||
|
||||
public static class WebSocketMessageTransport
|
||||
{
|
||||
|
||||
@@ -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
|
||||
{
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
using System.Collections.Concurrent;
|
||||
using ElmahCore;
|
||||
|
||||
namespace ReverseLlama.Server;
|
||||
namespace Ngino.Server;
|
||||
|
||||
internal sealed class AuthRateLimiter
|
||||
{
|
||||
|
||||
@@ -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<ApplicationUser>
|
||||
{
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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
|
||||
{
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
using Microsoft.AspNetCore.Identity;
|
||||
|
||||
namespace ReverseLlama.Server.Models;
|
||||
namespace Ngino.Server.Models;
|
||||
|
||||
internal sealed class ApplicationUser : IdentityUser
|
||||
{
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
<PackageReference Include="SQLitePCLRaw.bundle_e_sqlite3" Version="3.0.3" />
|
||||
<PackageReference Include="System.Text.Encodings.Web" Version="8.0.0" />
|
||||
<PackageReference Include="System.Text.Json" Version="8.0.5" />
|
||||
<ProjectReference Include="..\ReverseLlama.Protocol\ReverseLlama.Protocol.csproj" />
|
||||
<ProjectReference Include="..\Ngino.Protocol\Ngino.Protocol.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
<PropertyGroup>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
using ReverseLlama.Protocol;
|
||||
using Ngino.Protocol;
|
||||
|
||||
namespace ReverseLlama.Server;
|
||||
namespace Ngino.Server;
|
||||
|
||||
internal sealed class PendingCommand
|
||||
{
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
using System.Threading.Channels;
|
||||
using ReverseLlama.Protocol;
|
||||
using Ngino.Protocol;
|
||||
|
||||
namespace ReverseLlama.Server;
|
||||
namespace Ngino.Server;
|
||||
|
||||
internal sealed class PendingProxyRequest
|
||||
{
|
||||
|
||||
@@ -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";
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
using System.Text;
|
||||
using System.Text.Json;
|
||||
|
||||
namespace ReverseLlama.Server;
|
||||
namespace Ngino.Server;
|
||||
|
||||
internal sealed class ResponseTokenCounter
|
||||
{
|
||||
|
||||
@@ -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<string> 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;
|
||||
|
||||
@@ -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"),
|
||||
|
||||
@@ -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
|
||||
{
|
||||
|
||||
@@ -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
|
||||
{
|
||||
|
||||
@@ -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
|
||||
{
|
||||
|
||||
@@ -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
|
||||
}
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<title>ReverseLlama Admin</title>
|
||||
<title>Ngino Admin</title>
|
||||
<link rel="stylesheet" href="/admin/app.css">
|
||||
</head>
|
||||
<body>
|
||||
@@ -12,7 +12,7 @@
|
||||
<div class="brand">
|
||||
<span class="brand-mark">RL</span>
|
||||
<span>
|
||||
<strong>ReverseLlama</strong>
|
||||
<strong>Ngino</strong>
|
||||
<small>Admin</small>
|
||||
</span>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user