mirror of
https://github.com/MindWorkAI/AI-Studio.git
synced 2026-11-11 06:27:40 +00:00
Turned getter-like extension methods into extension properties (#1157)
This commit is contained in:
1 parent
0375318b1b
commit
f649febf88
286 files changed
+1379
-1109
No files matched your search
@@ -10,7 +10,7 @@ using AIStudio.Tools.PluginSystem;
|
||||
|
||||
namespace AIStudio.Provider.SelfHosted;
|
||||
|
||||
public sealed class ProviderSelfHosted(Host host, string hostname) : BaseProvider(LLMProviders.SELF_HOSTED, new Uri($"{hostname}{host.BaseURL()}"), ExternalHttpTrustPolicy.ALLOW_CUSTOM_ROOTS_WHEN_HOST_WHITELISTED, LOGGER)
|
||||
public sealed class ProviderSelfHosted(Host host, string hostname) : BaseProvider(LLMProviders.SELF_HOSTED, new Uri($"{hostname}{host.BaseURL}"), ExternalHttpTrustPolicy.ALLOW_CUSTOM_ROOTS_WHEN_HOST_WHITELISTED, LOGGER)
|
||||
{
|
||||
private static readonly ILogger<ProviderSelfHosted> LOGGER = Program.LOGGER_FACTORY.CreateLogger<ProviderSelfHosted>();
|
||||
|
||||
@@ -19,13 +19,13 @@ public sealed class ProviderSelfHosted(Host host, string hostname) : BaseProvide
|
||||
#region Implementation of IProvider
|
||||
|
||||
/// <inheritdoc />
|
||||
public override string Id => LLMProviders.SELF_HOSTED.ToSecretId();
|
||||
public override string Id => LLMProviders.SELF_HOSTED.SecretId;
|
||||
|
||||
/// <inheritdoc />
|
||||
public override string InstanceName { get; set; } = "Self-hosted";
|
||||
|
||||
/// <inheritdoc />
|
||||
public override bool HasModelLoadingCapability => host.IsModelListSupported();
|
||||
public override bool HasModelLoadingCapability => host.IsModelListSupported;
|
||||
|
||||
/// <inheritdoc />
|
||||
public override async IAsyncEnumerable<ContentStreamChunk> StreamChatCompletion(Provider.Model chatModel, ChatThread chatThread, SettingsManager settingsManager, [EnumeratorCancellation] CancellationToken token = default)
|
||||
@@ -63,7 +63,7 @@ public sealed class ProviderSelfHosted(Host host, string hostname) : BaseProvide
|
||||
};
|
||||
},
|
||||
isTryingSecret: true,
|
||||
requestPath: host.ChatURL(),
|
||||
requestPath: host.ChatURL,
|
||||
token: token))
|
||||
yield return content;
|
||||
}
|
||||
@@ -97,7 +97,7 @@ public sealed class ProviderSelfHosted(Host host, string hostname) : BaseProvide
|
||||
if (host is Host.LLAMA_CPP)
|
||||
return await this.LoadLlamaCppTextModels(apiKeyProvisional, token);
|
||||
|
||||
if (!host.IsChatSupported() || !host.IsModelListSupported())
|
||||
if (!host.IsChatSupported || !host.IsModelListSupported)
|
||||
return ModelLoadResult.FromModels([]);
|
||||
|
||||
var result = await this.LoadModels(SecretStoreType.LLM_PROVIDER, apiKeyProvisional, token);
|
||||
@@ -123,7 +123,7 @@ public sealed class ProviderSelfHosted(Host host, string hostname) : BaseProvide
|
||||
{
|
||||
try
|
||||
{
|
||||
if (!host.IsEmbeddingSupported() || !host.IsModelListSupported())
|
||||
if (!host.IsEmbeddingSupported || !host.IsModelListSupported)
|
||||
return ModelLoadResult.FromModels([]);
|
||||
|
||||
var result = await this.LoadModels(SecretStoreType.EMBEDDING_PROVIDER, apiKeyProvisional, token);
|
||||
@@ -150,7 +150,7 @@ public sealed class ProviderSelfHosted(Host host, string hostname) : BaseProvide
|
||||
new Provider.Model("loaded-model", TB("Model as configured by whisper.cpp")),
|
||||
]);
|
||||
|
||||
if (!host.IsTranscriptionSupported() || !host.IsModelListSupported())
|
||||
if (!host.IsTranscriptionSupported || !host.IsModelListSupported)
|
||||
return ModelLoadResult.FromModels([]);
|
||||
|
||||
//
|
||||
|
||||
Reference in new issue
Block a user