From cc6d7ca6a9f4e324042a0f7c1fc4c550c44bd5c4 Mon Sep 17 00:00:00 2001 From: Thorsten Sommer Date: Tue, 3 Dec 2024 13:05:46 +0100 Subject: [PATCH] Refactored the host extensions into its own file --- .../Provider/SelfHosted/Host.cs | 32 ------------------ .../Provider/SelfHosted/HostExtensions.cs | 33 +++++++++++++++++++ 2 files changed, 33 insertions(+), 32 deletions(-) create mode 100644 app/MindWork AI Studio/Provider/SelfHosted/HostExtensions.cs diff --git a/app/MindWork AI Studio/Provider/SelfHosted/Host.cs b/app/MindWork AI Studio/Provider/SelfHosted/Host.cs index 0e3a26d2..c90ecc9a 100644 --- a/app/MindWork AI Studio/Provider/SelfHosted/Host.cs +++ b/app/MindWork AI Studio/Provider/SelfHosted/Host.cs @@ -7,36 +7,4 @@ public enum Host LM_STUDIO, LLAMACPP, OLLAMA, -} - -public static class HostExtensions -{ - public static string Name(this Host host) => host switch - { - Host.NONE => "None", - - Host.LM_STUDIO => "LM Studio", - Host.LLAMACPP => "llama.cpp", - Host.OLLAMA => "ollama", - - _ => "Unknown", - }; - - public static string BaseURL(this Host host) => host switch - { - Host.LM_STUDIO => "/v1/", - Host.LLAMACPP => "/v1/", - Host.OLLAMA => "/v1/", - - _ => "/v1/", - }; - - public static string ChatURL(this Host host) => host switch - { - Host.LM_STUDIO => "chat/completions", - Host.LLAMACPP => "chat/completions", - Host.OLLAMA => "chat/completions", - - _ => "chat/completions", - }; } \ No newline at end of file diff --git a/app/MindWork AI Studio/Provider/SelfHosted/HostExtensions.cs b/app/MindWork AI Studio/Provider/SelfHosted/HostExtensions.cs new file mode 100644 index 00000000..1075009e --- /dev/null +++ b/app/MindWork AI Studio/Provider/SelfHosted/HostExtensions.cs @@ -0,0 +1,33 @@ +namespace AIStudio.Provider.SelfHosted; + +public static class HostExtensions +{ + public static string Name(this Host host) => host switch + { + Host.NONE => "None", + + Host.LM_STUDIO => "LM Studio", + Host.LLAMACPP => "llama.cpp", + Host.OLLAMA => "ollama", + + _ => "Unknown", + }; + + public static string BaseURL(this Host host) => host switch + { + Host.LM_STUDIO => "/v1/", + Host.LLAMACPP => "/v1/", + Host.OLLAMA => "/v1/", + + _ => "/v1/", + }; + + public static string ChatURL(this Host host) => host switch + { + Host.LM_STUDIO => "chat/completions", + Host.LLAMACPP => "chat/completions", + Host.OLLAMA => "chat/completions", + + _ => "chat/completions", + }; +} \ No newline at end of file