From 4a9c2e3a761ffc85b1c071a14810a6f53d0aae47 Mon Sep 17 00:00:00 2001 From: Thorsten Sommer Date: Tue, 3 Dec 2024 13:34:46 +0100 Subject: [PATCH] Refactored provider dashboard metadata into provider extensions --- app/MindWork AI Studio/Pages/Settings.razor | 2 +- .../Pages/Settings.razor.cs | 24 ------------------- .../Provider/LLMProvidersExtensions.cs | 24 +++++++++++++++++++ 3 files changed, 25 insertions(+), 25 deletions(-) diff --git a/app/MindWork AI Studio/Pages/Settings.razor b/app/MindWork AI Studio/Pages/Settings.razor index 70c88162..44bca9cd 100644 --- a/app/MindWork AI Studio/Pages/Settings.razor +++ b/app/MindWork AI Studio/Pages/Settings.razor @@ -52,7 +52,7 @@ } - + Open Dashboard diff --git a/app/MindWork AI Studio/Pages/Settings.razor.cs b/app/MindWork AI Studio/Pages/Settings.razor.cs index 79bd79e7..8d8188e3 100644 --- a/app/MindWork AI Studio/Pages/Settings.razor.cs +++ b/app/MindWork AI Studio/Pages/Settings.razor.cs @@ -124,30 +124,6 @@ public partial class Settings : ComponentBase, IMessageBusReceiver, IDisposable this.UpdateProviders(); await this.MessageBus.SendMessage(this, Event.CONFIGURATION_CHANGED); } - - private bool HasDashboard(LLMProviders llmProvider) => llmProvider switch - { - LLMProviders.OPEN_AI => true, - LLMProviders.MISTRAL => true, - LLMProviders.ANTHROPIC => true, - LLMProviders.GROQ => true, - LLMProviders.FIREWORKS => true, - LLMProviders.GOOGLE => true, - - _ => false, - }; - - private string GetProviderDashboardURL(LLMProviders llmProvider) => llmProvider switch - { - LLMProviders.OPEN_AI => "https://platform.openai.com/usage", - LLMProviders.MISTRAL => "https://console.mistral.ai/usage/", - LLMProviders.ANTHROPIC => "https://console.anthropic.com/settings/plans", - LLMProviders.GROQ => "https://console.groq.com/settings/usage", - LLMProviders.GOOGLE => "https://console.cloud.google.com/billing", - LLMProviders.FIREWORKS => "https://fireworks.ai/account/billing", - - _ => string.Empty, - }; private string GetProviderModelName(AIStudio.Settings.Provider provider) { diff --git a/app/MindWork AI Studio/Provider/LLMProvidersExtensions.cs b/app/MindWork AI Studio/Provider/LLMProvidersExtensions.cs index 26b4b571..1c5adc12 100644 --- a/app/MindWork AI Studio/Provider/LLMProvidersExtensions.cs +++ b/app/MindWork AI Studio/Provider/LLMProvidersExtensions.cs @@ -157,6 +157,30 @@ public static class LLMProvidersExtensions _ => string.Empty, }; + public static string GetDashboardURL(this LLMProviders provider) => provider switch + { + LLMProviders.OPEN_AI => "https://platform.openai.com/usage", + LLMProviders.MISTRAL => "https://console.mistral.ai/usage/", + LLMProviders.ANTHROPIC => "https://console.anthropic.com/settings/plans", + LLMProviders.GROQ => "https://console.groq.com/settings/usage", + LLMProviders.GOOGLE => "https://console.cloud.google.com/billing", + LLMProviders.FIREWORKS => "https://fireworks.ai/account/billing", + + _ => string.Empty, + }; + + public static bool HasDashboard(this LLMProviders provider) => provider switch + { + LLMProviders.OPEN_AI => true, + LLMProviders.MISTRAL => true, + LLMProviders.ANTHROPIC => true, + LLMProviders.GROQ => true, + LLMProviders.FIREWORKS => true, + LLMProviders.GOOGLE => true, + + _ => false, + }; + public static string GetModelsOverviewURL(this LLMProviders provider) => provider switch { LLMProviders.FIREWORKS => "https://fireworks.ai/models?show=Serverless",