Skip to content
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
13 changes: 11 additions & 2 deletions src/typechat.examplesLib/Config.cs
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ public static OpenAIConfig LoadOpenAI(string? sectionName = null)
{
sectionName ??= "OpenAI";
OpenAIConfig config = LoadConfig<OpenAIConfig>(DefaultConfigFile, DefaultConfigFile_Dev, sectionName);

return config;
}

Expand All @@ -48,8 +49,16 @@ public static OpenAIConfig LoadOpenAI(string? sectionName = null)

public Config()
{
_openAI = LoadOpenAI();
_openAIEmbeddings = LoadOpenAI("OpenAI_Embeddings");
if (File.Exists(DefaultConfigFile) || File.Exists(DefaultConfigFile_Dev))
{
_openAI = LoadOpenAI();
_openAIEmbeddings = LoadOpenAI("OpenAI_Embeddings");
}
else
{
_openAI = OpenAIConfig.FromEnvironment();
_openAIEmbeddings = OpenAIConfig.FromEnvironment(isEmbedding: true);
}
}

public OpenAIConfig OpenAI => _openAI;
Expand Down
2 changes: 1 addition & 1 deletion tests/TypeChat.IntegrationTests/Readme.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Running Tests
The integration tests require an Open AI key and will just skip if one is not available.
To supply a key:
- Create appSettings.Development.json in this folder and override the ApiKey property defined in appSettings.json
- Create appSettings.Development.json in this folder and override the ApiKey property defined in appSettings.json.example
- In Visual Studio, set File properties to Copy Always
- Build
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
</ItemGroup>

<ItemGroup>
<Content Include="appSettings.json" Link="appSettings.json">
<Content Include="appSettings.json.example" Link="appSettings.json.example">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
</ItemGroup>
Expand Down