Skip to content

Commit

Permalink
update domain of AiHttpClient
Browse files Browse the repository at this point in the history
  • Loading branch information
rwecho committed Dec 25, 2023
1 parent 6a67082 commit a0fda4a
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 2 deletions.
4 changes: 4 additions & 0 deletions src/V2ex.Blazor.Shared/Pages/TopicPage.razor
Original file line number Diff line number Diff line change
Expand Up @@ -870,6 +870,10 @@
await formattedMarkupStringViewRef.RelaunchContentAsync();
}
}
catch(InvalidOperationException)
{
await this.Toast.Show("无法连接到服务");
}
finally
{
isFormatting = false;
Expand Down
2 changes: 1 addition & 1 deletion src/V2ex.Blazor.Shared/Services/AiHttpClientHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ public AiHttpClientHandler(IPreferences preferences)
var cookies = this.Preferences.Get(CookiesFileName, Array.Empty<Cookie>());
foreach (var cookie in cookies)
{
cookie.Domain = "localhost";
cookie.Domain = "v2ex-maui.vercel.app";
this.CookieContainer.Add(cookie);
}
}
Expand Down
8 changes: 7 additions & 1 deletion src/V2ex.Blazor.Shared/Services/ChatGPTService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,12 @@ public async Task<Stream> FormatTopicAsync(string topicId)
{
var version = this.AppInfoService.GetVersionNumber();
var response = await HttpClient.GetAsync($"/api/topic/{topicId}?version={version}", HttpCompletionOption.ResponseHeadersRead);
return await response.Content.ReadAsStreamAsync();

if(response.IsSuccessStatusCode)
{
return await response.Content.ReadAsStreamAsync();
}

throw new InvalidOperationException(response.ReasonPhrase);
}
}

0 comments on commit a0fda4a

Please sign in to comment.