mirror of
https://github.com/MindWorkAI/AI-Studio.git
synced 2026-10-13 22:53:48 +00:00
Fixed the provider and embedding dialogs not loading the stored API key for self-hosted providers
This commit is contained in:
3 files changed
+12
-25
No files matched your search
@@ -209,17 +209,10 @@ public partial class EmbeddingProviderDialog : MSGComponentBase, ISecretId
|
|||||||
if (this.DataLLMProvider is LLMProviders.SELF_HOSTED)
|
if (this.DataLLMProvider is LLMProviders.SELF_HOSTED)
|
||||||
this.dataManuallyModel = this.DataModel.Id;
|
this.dataManuallyModel = this.DataModel.Id;
|
||||||
|
|
||||||
//
|
// Load the API key. A self-hosted server may well need one: LM Studio can ask for a
|
||||||
// We cannot load the API key for self-hosted providers:
|
// token of its own, and any of these servers can sit behind an authenticating proxy.
|
||||||
//
|
// So we try for every host and treat a missing key as the normal case (isTrying).
|
||||||
if (this.DataLLMProvider is LLMProviders.SELF_HOSTED && this.DataHost is not Host.OLLAMA && this.DataHost is not Host.VLLM)
|
// ReloadModels() below reads dataAPIKey, so the key has to be here before it runs:
|
||||||
{
|
|
||||||
await this.ReloadModels();
|
|
||||||
await base.OnInitializedAsync();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Load the API key:
|
|
||||||
var requestedSecret = await this.RustService.GetAPIKey(this, SecretStoreType.EMBEDDING_PROVIDER, isTrying: this.DataLLMProvider is LLMProviders.SELF_HOSTED);
|
var requestedSecret = await this.RustService.GetAPIKey(this, SecretStoreType.EMBEDDING_PROVIDER, isTrying: this.DataLLMProvider is LLMProviders.SELF_HOSTED);
|
||||||
if (requestedSecret.Success)
|
if (requestedSecret.Success)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -264,17 +264,10 @@ public partial class ProviderDialog : MSGComponentBase, ISecretId
|
|||||||
if (this.DataLLMProvider.IsLLMModelProvidedManually())
|
if (this.DataLLMProvider.IsLLMModelProvidedManually())
|
||||||
this.dataManuallyModel = this.DataModel.Id;
|
this.dataManuallyModel = this.DataModel.Id;
|
||||||
|
|
||||||
//
|
// Load the API key. A self-hosted server may well need one: LM Studio can ask for a
|
||||||
// We cannot load the API key for self-hosted providers:
|
// token of its own, and any of these servers can sit behind an authenticating proxy.
|
||||||
//
|
// So we try for every host and treat a missing key as the normal case (isTrying).
|
||||||
if (this.DataLLMProvider is LLMProviders.SELF_HOSTED && this.DataHost is not Host.OLLAMA && this.DataHost is not Host.VLLM)
|
// ReloadModels() below reads dataAPIKey, so the key has to be here before it runs:
|
||||||
{
|
|
||||||
await this.ReloadModels();
|
|
||||||
await base.OnInitializedAsync();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Load the API key:
|
|
||||||
var requestedSecret = await this.RustService.GetAPIKey(this, SecretStoreType.LLM_PROVIDER, isTrying: this.DataLLMProvider is LLMProviders.SELF_HOSTED);
|
var requestedSecret = await this.RustService.GetAPIKey(this, SecretStoreType.LLM_PROVIDER, isTrying: this.DataLLMProvider is LLMProviders.SELF_HOSTED);
|
||||||
if (requestedSecret.Success)
|
if (requestedSecret.Success)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -199,9 +199,10 @@ public partial class TranscriptionProviderDialog : MSGComponentBase, ISecretId
|
|||||||
if (this.DataLLMProvider is LLMProviders.SELF_HOSTED)
|
if (this.DataLLMProvider is LLMProviders.SELF_HOSTED)
|
||||||
this.dataManuallyModel = this.DataModel.Id;
|
this.dataManuallyModel = this.DataModel.Id;
|
||||||
|
|
||||||
// Load the API key. Self-hosted providers may or may not need one (e.g., VLLM behind
|
// Load the API key. A self-hosted server may well need one: LM Studio can ask for a
|
||||||
// an authenticated proxy does), so we always try -- ReloadModels() below relies on
|
// token of its own, and any of these servers can sit behind an authenticating proxy.
|
||||||
// dataAPIKey already being populated, otherwise it would send an empty Bearer token:
|
// So we try for every host and treat a missing key as the normal case (isTrying).
|
||||||
|
// ReloadModels() below reads dataAPIKey, so the key has to be here before it runs:
|
||||||
var requestedSecret = await this.RustService.GetAPIKey(this, SecretStoreType.TRANSCRIPTION_PROVIDER, isTrying: this.DataLLMProvider is LLMProviders.SELF_HOSTED);
|
var requestedSecret = await this.RustService.GetAPIKey(this, SecretStoreType.TRANSCRIPTION_PROVIDER, isTrying: this.DataLLMProvider is LLMProviders.SELF_HOSTED);
|
||||||
if (requestedSecret.Success)
|
if (requestedSecret.Success)
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in new issue
Block a user