mirror of
https://github.com/MindWorkAI/AI-Studio.git
synced 2026-11-04 15:27:21 +00:00
Added a home page prompt for missing API keys of enterprise providers (#1056)
Co-authored-by: Thorsten Sommer <SommerEngineering@users.noreply.github.com>
This commit is contained in:
1 parent
1f8d72aa45
commit
7d35536c87
29 files changed
+920
-31
No files matched your search
@@ -206,6 +206,30 @@ public sealed class ConfigurationSnippetImportTests : ToolRegistryTestBase
|
||||
[TestCase(PluginConfigurationObjectType.TRANSCRIPTION_PROVIDER)]
|
||||
public void AnUnencryptedAPIKeyIsLeftOut(PluginConfigurationObjectType type) => AssertAPIKeyLeftOut(Import(ExportProvider(type, API_KEY).Snippet, type));
|
||||
|
||||
[TestCase(PluginConfigurationObjectType.LLM_PROVIDER)]
|
||||
[TestCase(PluginConfigurationObjectType.EMBEDDING_PROVIDER)]
|
||||
[TestCase(PluginConfigurationObjectType.TRANSCRIPTION_PROVIDER)]
|
||||
public void AnImportedProviderNeverAsksForTheAPIKeyOfTheUser(PluginConfigurationObjectType type)
|
||||
{
|
||||
//
|
||||
// An export never writes the option, but a snippet may come from a configuration plugin of an
|
||||
// organization. The option implies the user-provided key, so both have to go:
|
||||
//
|
||||
var snippet = ExportProvider(type, null).Snippet;
|
||||
var tableStart = snippet.IndexOf("= {", StringComparison.Ordinal) + "= {".Length;
|
||||
var snippetWithPrompt = snippet.Insert(tableStart, """
|
||||
|
||||
["PromptForUserAPIKey"] = true,
|
||||
""");
|
||||
|
||||
var imported = (IUserProvidedAPIKey)Import(snippetWithPrompt, type).ConfigurationObject;
|
||||
Assert.Multiple(() =>
|
||||
{
|
||||
Assert.That(imported.PromptForUserAPIKey, Is.False);
|
||||
Assert.That(imported.AllowUserProvidedAPIKey, Is.False);
|
||||
});
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TheTokenOfADataSourceIsDecrypted() => Assert.That(Import(ExportDataSource(AuthMethod.TOKEN).Snippet, PluginConfigurationObjectType.DATA_SOURCE).Secret, Is.EqualTo(TOKEN));
|
||||
|
||||
|
||||
Reference in new issue
Block a user