diff --git a/src/renderer/components/TransformerLabSettings.tsx b/src/renderer/components/TransformerLabSettings.tsx index 054da53480eb795ce73fd6a15c3056f8ae116440..af116b035759b5a95cf021d9c0d79e48fcdf616e 100644 --- a/src/renderer/components/TransformerLabSettings.tsx +++ b/src/renderer/components/TransformerLabSettings.tsx @@ -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}> @@ -130,6 +137,25 @@ export default function TransformerLabSettings({ }) { </FormControl> </> )}{' '} + {wandbLoginStatus?.message === 'OK' ? ( + <Alert color="success">Login to Weights & Biases Successful</Alert> + ) : ( + <FormControl sx={{ maxWidth: '500px', mt: 2 }}> + <FormLabel>Weights & 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" /> diff --git a/src/renderer/lib/transformerlab-api-sdk.ts b/src/renderer/lib/transformerlab-api-sdk.ts index cbf523690bf68daa602222c7ccb62cd4682d1823..6ec0a82b46cfa540ce391a50f13bfdbf93ea3428 100644 --- a/src/renderer/lib/transformerlab-api-sdk.ts +++ b/src/renderer/lib/transformerlab-api-sdk.ts @@ -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',