mirror of
https://github.com/MindWorkAI/AI-Studio.git
synced 2026-10-08 09:49:40 +00:00
Merge branch 'main' into chunk-data
This commit is contained in:
commit
2e06af13e0
133 files changed
+3704
-968
No files matched your search
@@ -114,6 +114,7 @@ public partial class ProviderDialog : MSGComponentBase, ISecretId
|
||||
private Task dataTokenizerValidationTask = Task.CompletedTask;
|
||||
private bool dataStoreWasAttempted;
|
||||
private int dataTokenizerValidationRevision;
|
||||
private bool usesLegacySystemModelFallback;
|
||||
private bool showExpertSettings;
|
||||
|
||||
// We get the form reference from Blazor code to validate it manually:
|
||||
@@ -134,6 +135,7 @@ public partial class ProviderDialog : MSGComponentBase, ISecretId
|
||||
GetHost = () => this.DataHost,
|
||||
IsModelProvidedManually = () => this.DataLLMProvider.IsLLMModelProvidedManually(),
|
||||
GetCustomTokenizerValidationIssue = () => this.dataCustomTokenizerValidationIssue,
|
||||
IsModelSelectionHidden = () => this.IsLLMModelSelectionHidden,
|
||||
};
|
||||
}
|
||||
|
||||
@@ -143,9 +145,9 @@ public partial class ProviderDialog : MSGComponentBase, ISecretId
|
||||
|
||||
// Determine the model based on the provider and host configuration:
|
||||
Model model;
|
||||
if (this.DataLLMProvider.IsLLMModelSelectionHidden(this.DataHost))
|
||||
if (this.IsLLMModelSelectionHidden)
|
||||
{
|
||||
// Use system model placeholder for hosts that don't support model selection (e.g., llama.cpp):
|
||||
// Use system model placeholder for legacy hosts that don't support model selection:
|
||||
model = Model.SYSTEM_MODEL;
|
||||
}
|
||||
else if (this.DataLLMProvider is LLMProviders.FIREWORKS or LLMProviders.HUGGINGFACE)
|
||||
@@ -242,7 +244,7 @@ public partial class ProviderDialog : MSGComponentBase, ISecretId
|
||||
|
||||
#region Implementation of ISecretId
|
||||
|
||||
public string SecretId => this.DataLLMProvider.ToName();
|
||||
public string SecretId => this.DataLLMProvider.ToSecretId();
|
||||
|
||||
public string SecretName => this.DataInstanceName;
|
||||
|
||||
@@ -385,6 +387,7 @@ public partial class ProviderDialog : MSGComponentBase, ISecretId
|
||||
this.dataManuallyModel = string.Empty;
|
||||
this.availableModels.Clear();
|
||||
this.dataLoadingModelsIssue = string.Empty;
|
||||
this.usesLegacySystemModelFallback = false;
|
||||
}
|
||||
|
||||
private async Task ReloadModels()
|
||||
@@ -406,6 +409,7 @@ public partial class ProviderDialog : MSGComponentBase, ISecretId
|
||||
|
||||
this.availableModels.Clear();
|
||||
this.availableModels.AddRange(orderedModels);
|
||||
this.UpdateModelSelectionAfterLoading();
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
@@ -419,6 +423,34 @@ public partial class ProviderDialog : MSGComponentBase, ISecretId
|
||||
LLMProviders.SELF_HOSTED => T("(Optional) API Key"),
|
||||
_ => T("API Key"),
|
||||
};
|
||||
|
||||
private bool IsLLMModelSelectionHidden => this.DataLLMProvider.IsLLMModelSelectionHidden(this.DataHost) ||
|
||||
this.DataLLMProvider is LLMProviders.SELF_HOSTED &&
|
||||
this.DataHost is Host.LLAMA_CPP &&
|
||||
this.usesLegacySystemModelFallback;
|
||||
|
||||
private void UpdateModelSelectionAfterLoading()
|
||||
{
|
||||
if (this.DataLLMProvider is not LLMProviders.SELF_HOSTED || this.DataHost is not Host.LLAMA_CPP)
|
||||
return;
|
||||
|
||||
this.usesLegacySystemModelFallback = this.availableModels.Count is 1 && this.availableModels[0].IsSystemModel;
|
||||
if (this.usesLegacySystemModelFallback)
|
||||
{
|
||||
this.DataModel = Model.SYSTEM_MODEL;
|
||||
return;
|
||||
}
|
||||
|
||||
var availableModel = this.availableModels.FirstOrDefault(model =>
|
||||
string.Equals(model.Id, this.DataModel.Id, StringComparison.OrdinalIgnoreCase));
|
||||
if (availableModel != default)
|
||||
{
|
||||
this.DataModel = availableModel;
|
||||
return;
|
||||
}
|
||||
|
||||
this.DataModel = this.availableModels.Count is 1 ? this.availableModels[0] : default;
|
||||
}
|
||||
|
||||
private void ToggleExpertSettings() => this.showExpertSettings = !this.showExpertSettings;
|
||||
|
||||
|
||||
Reference in new issue
Block a user