Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Wandb API Key in settings #271

Merged
merged 1 commit into from
Feb 25, 2025
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
26 changes: 26 additions & 0 deletions src/renderer/components/TransformerLabSettings.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,13 @@ export default function TransformerLabSettings({ }) {
mutate: canLogInToHuggingFaceMutate,
} = useSWR(chatAPI.Endpoints.Models.HuggingFaceLogin(), fetcher);

const {
data: wandbLoginStatus,
error: wandbLoginStatusError,
isLoading: wandbLoginStatusIsLoading,
mutate: wandbLoginMutate,
} = useSWR(chatAPI.Endpoints.Models.testWandbLogin(), fetcher);

return (
<>
<Typography level="h1" marginBottom={3}>
Expand Down Expand Up @@ -130,6 +137,25 @@ export default function TransformerLabSettings({ }) {
</FormControl>
</>
)}{' '}
{wandbLoginStatus?.message === 'OK' ? (
<Alert color="success">Login to Weights &amp; Biases Successful</Alert>
) : (
<FormControl sx={{ maxWidth: '500px', mt: 2 }}>
<FormLabel>Weights &amp; Biases API Key</FormLabel>
<Input name="wandbToken" type="password" />
<Button
onClick={async () => {
const token = document.getElementsByName('wandbToken')[0].value;
await fetch(chatAPI.Endpoints.Config.Set('WANDB_API_KEY', token));
await fetch(chatAPI.Endpoints.Models.wandbLogin());
wandbLoginMutate();
}}
sx={{ marginTop: 1, width: '100px', alignSelf: 'flex-end' }}
>
Save
</Button>
</FormControl>
)}
<FormControl sx={{ maxWidth: '500px', mt: 2 }}>
<FormLabel>OpenAI API Key</FormLabel>
<Input name="openaiKey" type="password" />
Expand Down
2 changes: 2 additions & 0 deletions src/renderer/lib/transformerlab-api-sdk.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1093,6 +1093,8 @@ Endpoints.Models = {
API_URL() + 'model/import_from_local_path?model_path=' + modelPath,
HuggingFaceLogin: () => API_URL() + 'model/login_to_huggingface',
Delete: (modelId: string) => API_URL() + 'model/delete?model_id=' + modelId,
wandbLogin: () => API_URL() + 'model/login_to_wandb',
testWandbLogin: () => API_URL() + 'model/test_wandb_login',
SetOpenAIKey: () => API_URL() + 'model/set_openai_api_key',
SetAnthropicKey: () => API_URL() + 'model/set_anthropic_api_key',
CheckOpenAIAPIKey: () => API_URL() + 'model/check_openai_api_key',
Expand Down