Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

移除 Ollama 设置项中访问密钥选项 #14

Merged
merged 3 commits into from
Jun 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .github/release-drafter.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ template: |
## 更改记录 / Changelog

$CHANGES

<a title="Get from Microsoft" href="https://www.microsoft.com/store/apps/9NB0NB3MLQTM?launch=true&amp;mode=full" target="_blank"><picture><source srcset="https://get.microsoft.com/images/en-US%20light.svg" media="(prefers-color-scheme: dark)"><source srcset="https://get.microsoft.com/images/en-US%20dark.svg" media="(prefers-color-scheme: light), (prefers-color-scheme: no-preference)"><img src="https://get.microsoft.com/images/en-US%20dark.svg" width="144"></picture></a>
name-template: 'v$RESOLVED_VERSION 🌈'
tag-template: 'v$RESOLVED_VERSION'
categories:
Expand Down
2 changes: 1 addition & 1 deletion src/Core/RodelChat.Core/Providers/OllamaProvider.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ public sealed class OllamaProvider : ProviderBase, IProvider
/// Initializes a new instance of the <see cref="OllamaProvider"/> class.
/// </summary>
public OllamaProvider(OllamaClientConfig config)
: base(config.Key, config.CustomModels)
: base("ollama", config.CustomModels)
{
SetBaseUri(ProviderConstants.OllamaApi, config.Endpoint);
}
Expand Down
7 changes: 6 additions & 1 deletion src/Core/RodelChat.Models/Client/ChatClientConfiguration.cs
Original file line number Diff line number Diff line change
Expand Up @@ -309,9 +309,14 @@ public sealed class SiliconFlowClientConfig : ClientConfigBase
/// </summary>
public sealed class OllamaClientConfig : ClientEndpointConfigBase
{
/// <summary>
/// Initializes a new instance of the <see cref="OllamaClientConfig"/> class.
/// </summary>
public OllamaClientConfig() => Key = "ollama";

/// <inheritdoc/>
public override bool IsValid()
=> IsCustomModelNotEmpty() && !string.IsNullOrEmpty(Key) && !string.IsNullOrEmpty(Endpoint);
=> IsCustomModelNotEmpty() && !string.IsNullOrEmpty(Endpoint);
}

/// <summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
Expand Down Expand Up @@ -85,7 +90,6 @@ private ClientConfigBase CreateCurrentConfig()
else if (config is OllamaClientConfig)
{
config.Endpoint = ProviderConstants.OllamaApi;
config.Key = "ollama";
}

return config;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
Expand Down Expand Up @@ -66,7 +71,6 @@ private ClientEndpointConfigBase CreateCurrentConfig()
}
else if (config is OllamaClientConfig)
{
config.Key = "ollama";
config.Endpoint = ProviderConstants.OllamaApi;
}

Expand Down
Loading