Skip to content

Commit 295ae08

Browse files
committed
make platforn specific help for setting env var.
1 parent d3e2ef9 commit 295ae08

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

packages/agent/src/utils/errors.ts

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,13 +36,24 @@ export const getProviderApiKeyError = (provider: string): string => {
3636
}
3737

3838
const { keyName, docsUrl } = config;
39+
const platform = process.platform;
40+
let osSpecificInstructions = '';
41+
42+
if (platform === 'win32') {
43+
osSpecificInstructions = `- Using the windows command prompt, "setx ${keyName}=[your-api-key]"`;
44+
} else if (platform === 'darwin' || platform === 'linux') {
45+
osSpecificInstructions = `- As an environment variable, "export ${keyName}=[your-api-key]"`;
46+
} else {
47+
osSpecificInstructions = `- As an environment variable (platform-specific command)`;
48+
}
3949

4050
return `
4151
Error: ${keyName} environment variable is not set
4252
43-
Before using MyCoder with ${provider} models, you must have a ${keyName} specified either:
53+
Before using MyCoder with ${provider} models, you must have a ${keyName} specified.
4454
45-
- As an environment variable, "export ${keyName}=[your-api-key]" or
55+
You can set it via:
56+
${osSpecificInstructions}
4657
- In a .env file in the folder you run "mycoder" from
4758
4859
For setup instructions, visit: ${docsUrl}

0 commit comments

Comments
 (0)