Skip to content

Commit

Permalink
feat: add anthropic key to interactive config UI
Browse files Browse the repository at this point in the history
  • Loading branch information
steve8708 committed Jun 23, 2024
1 parent b54cc21 commit af0cd1f
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 7 deletions.
11 changes: 8 additions & 3 deletions src/helpers/config.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -198,15 +198,20 @@ describe('showConfigUI', () => {
hint: 'sk-...',
},
{
label: 'OpenAI API Endpoint',
value: 'OPENAI_API_ENDPOINT',
hint: 'https://api.openai.com/v1',
label: 'Anthropic Key',
value: 'ANTHROPIC_KEY',
hint: 'sk-ant-...',
},
{
label: 'Model',
value: 'MODEL',
hint: 'gpt-4o',
},
{
label: 'OpenAI API Endpoint',
value: 'OPENAI_API_ENDPOINT',
hint: 'https://api.openai.com/v1',
},
{
label: 'Done',
value: 'cancel',
Expand Down
16 changes: 12 additions & 4 deletions src/helpers/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -122,17 +122,25 @@ export const showConfigUI = async () => {
: '(not set)',
},
{
label: 'OpenAI API Endpoint',
value: 'OPENAI_API_ENDPOINT',
hint: hasOwn(config, 'OPENAI_API_ENDPOINT')
? config.OPENAI_API_ENDPOINT
label: 'Anthropic Key',
value: 'ANTHROPIC_KEY',
hint: hasOwn(config, 'ANTHROPIC_KEY')
? // Obfuscate the key
'sk-ant-...' + (config.ANTHROPIC_KEY?.slice(-3) || '')
: '(not set)',
},
{
label: 'Model',
value: 'MODEL',
hint: hasOwn(config, 'MODEL') ? config.MODEL : '(not set)',
},
{
label: 'OpenAI API Endpoint',
value: 'OPENAI_API_ENDPOINT',
hint: hasOwn(config, 'OPENAI_API_ENDPOINT')
? config.OPENAI_API_ENDPOINT
: '(not set)',
},
{
label: 'Done',
value: 'cancel',
Expand Down

0 comments on commit af0cd1f

Please sign in to comment.