Skip to content

Commit

Permalink
Merge pull request #9 from mnikonov/features/6
Browse files Browse the repository at this point in the history
Added links to pages where possible to obtain API key and Organization ID during configuration of OpenAI settings
  • Loading branch information
mnikonov authored Jun 12, 2023
2 parents d508dfb + a8c24a9 commit f113cb0
Show file tree
Hide file tree
Showing 3 changed files with 47 additions and 18 deletions.
8 changes: 8 additions & 0 deletions src/Gpt.Labs/Controls/Dialogs/EditOpenAISettingsDialog.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,21 @@
<TextBox x:Name="OpenAIOrganizationTextBox" x:Uid="OpenAIOrganizationTextBox"
Text="{x:Bind ViewModel.Organization, Mode=TwoWay}"
PlaceholderText="Enter OpenAI organization ID..."></TextBox>

<TextBlock Style="{StaticResource DescriptionStyle}">
<Run x:Uid="OpenAIOrganizationDescription1"/><Hyperlink NavigateUri="https://platform.openai.com/account/org-settings"><Run x:Uid="OpenAIOrganizationDescription2"/></Hyperlink><Run x:Uid="OpenAIOrganizationDescription3"/>
</TextBlock>

<TextBlock x:Name="OpenAIApiKeyLabel" x:Uid="OpenAIApiKeyLabel" Text="Secret key"
Style="{StaticResource LabelStyle}"/>

<TextBox x:Name="OpenAIApiKeyTextBox" x:Uid="OpenAIApiKeyTextBox"
Text="{x:Bind ViewModel.ApiKey, Mode=TwoWay}"
PlaceholderText="Enter OpenAI secret key..."></TextBox>

<TextBlock Style="{StaticResource DescriptionStyle}">
<Run x:Uid="OpenAIApiKeyDescription1"/><Hyperlink NavigateUri="https://platform.openai.com/account/api-keys"><Run x:Uid="OpenAIApiKeyDescription2"/></Hyperlink><Run x:Uid="OpenAIApiKeyDescription3"/>
</TextBlock>

<controls:ErrorsListPanel Margin="0 24 0 0"
ViewModel="{x:Bind ViewModel.Errors, Mode=OneWay}"
Expand Down
39 changes: 21 additions & 18 deletions src/Gpt.Labs/Controls/Wizards/Activation/OpenAISettingsControl.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,29 +6,32 @@
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d">

<StackPanel Margin="16 0" Spacing="4">

<TextBlock x:Uid="OpenAISettingsLabel" Text="OpenAI settings" Style="{StaticResource SubtitleTextBlockStyle}" Margin="0 0 0 6" />

<TextBlock x:Name="OpenAIOrganizationLabel" x:Uid="OpenAIOrganizationLabel" Text="Organization ID"
Style="{StaticResource LabelStyle}"/>

<Grid Margin="16 0">

<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>

<TextBlock Grid.Row="0" x:Uid="OpenAISettingsLabel" Text="OpenAI settings" Style="{StaticResource SubtitleTextBlockStyle}" Margin="0 0 0 16" />

<TextBlock Grid.Row="1" x:Name="OpenAIOrganizationLabel" x:Uid="OpenAIOrganizationLabel" Margin="0 0 0 6" Text="Organization ID" TextWrapping="Wrap" Style="{StaticResource CaptionTextBlockStyle}"/>

<TextBox Grid.Row="2" x:Name="OpenAIOrganizationTextBox" x:Uid="OpenAIOrganizationTextBox"
<TextBox x:Name="OpenAIOrganizationTextBox" x:Uid="OpenAIOrganizationTextBox"
Text="{x:Bind ViewModel.Organization, Mode=TwoWay}"
PlaceholderText="Enter OpenAI organization ID..."></TextBox>

<TextBlock Grid.Row="3" x:Name="OpenAIApiKeyLabel" x:Uid="OpenAIApiKeyLabel" Margin="0 16 0 6" Text="Secret key" TextWrapping="Wrap" Style="{StaticResource CaptionTextBlockStyle}"/>
<TextBlock Style="{StaticResource DescriptionStyle}">
<Run x:Uid="OpenAIOrganizationDescription1"/><Hyperlink NavigateUri="https://platform.openai.com/account/org-settings"><Run x:Uid="OpenAIOrganizationDescription2"/></Hyperlink><Run x:Uid="OpenAIOrganizationDescription3"/>
</TextBlock>

<TextBlock x:Name="OpenAIApiKeyLabel" x:Uid="OpenAIApiKeyLabel" Text="Secret key"
Style="{StaticResource LabelStyle}"/>

<TextBox Grid.Row="4" x:Name="OpenAIApiKeyTextBox" x:Uid="OpenAIApiKeyTextBox"
<TextBox x:Name="OpenAIApiKeyTextBox" x:Uid="OpenAIApiKeyTextBox"
Text="{x:Bind ViewModel.ApiKey, Mode=TwoWay}"
PlaceholderText="Enter OpenAI secret key..."></TextBox>
</Grid>

<TextBlock Style="{StaticResource DescriptionStyle}">
<Run x:Uid="OpenAIApiKeyDescription1"/><Hyperlink NavigateUri="https://platform.openai.com/account/api-keys"><Run x:Uid="OpenAIApiKeyDescription2"/></Hyperlink><Run x:Uid="OpenAIApiKeyDescription3"/>
</TextBlock>

</StackPanel>
</UserControl>
18 changes: 18 additions & 0 deletions src/Gpt.Labs/Strings/en/Resources.resw
Original file line number Diff line number Diff line change
Expand Up @@ -531,4 +531,22 @@ Accepts a json object that maps tokens (specified by their token ID in the token
<data name="SendImageToolTip.Content" xml:space="preserve">
<value>Create image variation</value>
</data>
<data name="OpenAIApiKeyDescription1.Text" xml:space="preserve">
<value>Get your API key from </value>
</data>
<data name="OpenAIApiKeyDescription2.Text" xml:space="preserve">
<value>API keys</value>
</data>
<data name="OpenAIApiKeyDescription3.Text" xml:space="preserve">
<value> page</value>
</data>
<data name="OpenAIOrganizationDescription1.Text" xml:space="preserve">
<value>Get your Organization ID from </value>
</data>
<data name="OpenAIOrganizationDescription2.Text" xml:space="preserve">
<value>Organization settings</value>
</data>
<data name="OpenAIOrganizationDescription3.Text" xml:space="preserve">
<value> page</value>
</data>
</root>

0 comments on commit f113cb0

Please sign in to comment.