Skip to content

Commit

Permalink
Fixed #115 (#116)
Browse files Browse the repository at this point in the history
  • Loading branch information
SommerEngineering authored Sep 5, 2024
1 parent 57905d5 commit 45770c2
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions app/MindWork AI Studio/Tools/RustService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ public async Task CopyText2Clipboard(ISnackbar snackbar, string text)
return;
}

var state = await response.Content.ReadFromJsonAsync<SetClipboardResponse>();
var state = await response.Content.ReadFromJsonAsync<SetClipboardResponse>(this.jsonRustSerializerOptions);
if (!state.Success)
{
this.logger!.LogError("Failed to copy the text to the clipboard.");
Expand Down Expand Up @@ -225,7 +225,9 @@ public async Task<UpdateResponse> CheckForUpdate()
try
{
var cts = new CancellationTokenSource(TimeSpan.FromSeconds(16));
return await this.http.GetFromJsonAsync<UpdateResponse>("/updates/check", cts.Token);
var response = await this.http.GetFromJsonAsync<UpdateResponse>("/updates/check", this.jsonRustSerializerOptions, cts.Token);
this.logger!.LogInformation($"Checked for an update: update available='{response.UpdateIsAvailable}'; error='{response.Error}'; next version='{response.NewVersion}'; changelog len='{response.Changelog.Length}'");
return response;
}
catch (Exception e)
{
Expand Down Expand Up @@ -267,7 +269,7 @@ public async Task<RequestedSecret> GetAPIKey(IProvider provider)
return new RequestedSecret(false, new EncryptedText(string.Empty), "Failed to get the API key due to an API issue.");
}

var secret = await result.Content.ReadFromJsonAsync<RequestedSecret>();
var secret = await result.Content.ReadFromJsonAsync<RequestedSecret>(this.jsonRustSerializerOptions);
if (!secret.Success)
this.logger!.LogError($"Failed to get the API key for provider '{provider.Id}': '{secret.Issue}'");

Expand All @@ -291,7 +293,7 @@ public async Task<StoreSecretResponse> SetAPIKey(IProvider provider, string key)
return new StoreSecretResponse(false, "Failed to get the API key due to an API issue.");
}

var state = await result.Content.ReadFromJsonAsync<StoreSecretResponse>();
var state = await result.Content.ReadFromJsonAsync<StoreSecretResponse>(this.jsonRustSerializerOptions);
if (!state.Success)
this.logger!.LogError($"Failed to store the API key for provider '{provider.Id}': '{state.Issue}'");

Expand All @@ -313,7 +315,7 @@ public async Task<DeleteSecretResponse> DeleteAPIKey(IProvider provider)
return new DeleteSecretResponse{Success = false, WasEntryFound = false, Issue = "Failed to delete the API key due to an API issue."};
}

var state = await result.Content.ReadFromJsonAsync<DeleteSecretResponse>();
var state = await result.Content.ReadFromJsonAsync<DeleteSecretResponse>(this.jsonRustSerializerOptions);
if (!state.Success)
this.logger!.LogError($"Failed to delete the API key for provider '{provider.Id}': '{state.Issue}'");

Expand Down

0 comments on commit 45770c2

Please sign in to comment.