From 87ccbca0994907ba0b01a932ddab5c4ea7c2aaa4 Mon Sep 17 00:00:00 2001 From: Richasy Date: Sun, 23 Jun 2024 15:33:14 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E7=A7=BB=E9=99=A4=20Ollama=20=E7=9A=84?= =?UTF-8?q?=E8=AE=BF=E9=97=AE=E5=AF=86=E9=92=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/Core/RodelChat.Core/Providers/OllamaProvider.cs | 2 +- .../RodelChat.Models/Client/ChatClientConfiguration.cs | 7 ++++++- .../ModelClientEndpointConfigSettingSection.xaml.cs | 6 +++++- .../Startup/Chat/ChatClientEndpointConfigSection.xaml.cs | 6 +++++- src/Libs/semantic-kernel | 2 +- 5 files changed, 18 insertions(+), 5 deletions(-) diff --git a/src/Core/RodelChat.Core/Providers/OllamaProvider.cs b/src/Core/RodelChat.Core/Providers/OllamaProvider.cs index 57a23e4d..04748121 100644 --- a/src/Core/RodelChat.Core/Providers/OllamaProvider.cs +++ b/src/Core/RodelChat.Core/Providers/OllamaProvider.cs @@ -15,7 +15,7 @@ public sealed class OllamaProvider : ProviderBase, IProvider /// Initializes a new instance of the class. /// public OllamaProvider(OllamaClientConfig config) - : base(config.Key, config.CustomModels) + : base("ollama", config.CustomModels) { SetBaseUri(ProviderConstants.OllamaApi, config.Endpoint); } diff --git a/src/Core/RodelChat.Models/Client/ChatClientConfiguration.cs b/src/Core/RodelChat.Models/Client/ChatClientConfiguration.cs index 58089879..4e60db26 100644 --- a/src/Core/RodelChat.Models/Client/ChatClientConfiguration.cs +++ b/src/Core/RodelChat.Models/Client/ChatClientConfiguration.cs @@ -296,9 +296,14 @@ public sealed class AnthropicClientConfig : ClientEndpointConfigBase /// public sealed class OllamaClientConfig : ClientEndpointConfigBase { + /// + /// Initializes a new instance of the class. + /// + public OllamaClientConfig() => Key = "ollama"; + /// public override bool IsValid() - => IsCustomModelNotEmpty() && !string.IsNullOrEmpty(Key) && !string.IsNullOrEmpty(Endpoint); + => IsCustomModelNotEmpty() && !string.IsNullOrEmpty(Endpoint); } /// diff --git a/src/Desktop/RodelAgent.UI/Controls/Settings/ModelClientEndpointConfigSettingSection.xaml.cs b/src/Desktop/RodelAgent.UI/Controls/Settings/ModelClientEndpointConfigSettingSection.xaml.cs index 8000f4a3..0271e6ed 100644 --- a/src/Desktop/RodelAgent.UI/Controls/Settings/ModelClientEndpointConfigSettingSection.xaml.cs +++ b/src/Desktop/RodelAgent.UI/Controls/Settings/ModelClientEndpointConfigSettingSection.xaml.cs @@ -41,6 +41,11 @@ protected override void OnViewModelChanged(DependencyPropertyChangedEventArgs e) PredefinedCard.Description = string.Format(ResourceToolkit.GetLocalizedString(Models.Constants.StringNames.PredefinedModelsDescription), newVM.Name); newVM.Config ??= CreateCurrentConfig(); + if (newVM.Config is OllamaClientConfig) + { + KeyCard.Visibility = Visibility.Collapsed; + } + Debug.Assert(ViewModel.Config != null, "ViewModel.Config should not be null."); ViewModel.CheckCurrentConfig(); } @@ -85,7 +90,6 @@ private ClientConfigBase CreateCurrentConfig() else if (config is OllamaClientConfig) { config.Endpoint = ProviderConstants.OllamaApi; - config.Key = "ollama"; } return config; diff --git a/src/Desktop/RodelAgent.UI/Controls/Startup/Chat/ChatClientEndpointConfigSection.xaml.cs b/src/Desktop/RodelAgent.UI/Controls/Startup/Chat/ChatClientEndpointConfigSection.xaml.cs index 97b8e715..b6c23474 100644 --- a/src/Desktop/RodelAgent.UI/Controls/Startup/Chat/ChatClientEndpointConfigSection.xaml.cs +++ b/src/Desktop/RodelAgent.UI/Controls/Startup/Chat/ChatClientEndpointConfigSection.xaml.cs @@ -31,6 +31,11 @@ protected override void OnViewModelChanged(DependencyPropertyChangedEventArgs e) } newVM.Config ??= CreateCurrentConfig(); + if (newVM.Config is OllamaClientConfig) + { + BaseSection.Visibility = Visibility.Collapsed; + } + Debug.Assert(ViewModel.Config != null, "ViewModel.Config should not be null."); ViewModel.CheckCurrentConfig(); } @@ -66,7 +71,6 @@ private ClientEndpointConfigBase CreateCurrentConfig() } else if (config is OllamaClientConfig) { - config.Key = "ollama"; config.Endpoint = ProviderConstants.OllamaApi; } diff --git a/src/Libs/semantic-kernel b/src/Libs/semantic-kernel index e243e9a3..d06f50a8 160000 --- a/src/Libs/semantic-kernel +++ b/src/Libs/semantic-kernel @@ -1 +1 @@ -Subproject commit e243e9a3074fd075730fec922fae1766853a43fd +Subproject commit d06f50a8953c6245c77cbd967527d3c9929ae60d From 015c9b268cba68364b90d0566bbe80a34df4c614 Mon Sep 17 00:00:00 2001 From: Richasy Date: Sun, 23 Jun 2024 15:38:16 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E6=9B=B4=E6=96=B0=20release=20=E6=A8=A1?= =?UTF-8?q?=E6=9D=BF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/release-drafter.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/release-drafter.yml b/.github/release-drafter.yml index 477e8ce5..63b6b6df 100644 --- a/.github/release-drafter.yml +++ b/.github/release-drafter.yml @@ -2,6 +2,8 @@ template: | ## 更改记录 / Changelog $CHANGES + + name-template: 'v$RESOLVED_VERSION 🌈' tag-template: 'v$RESOLVED_VERSION' categories: