fix: Ignore the Chain-of-Thought in AI response (#952)

- Improve chat response processing to handle thinking patterns using regular expressions.
- Migrate server value by removing trailing '/chat/completions' path.
This commit is contained in:
GadflyFang 2025-02-08 17:30:27 +08:00 committed by GitHub
parent 8cc056d2af
commit ef2e0a8a56
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 78 additions and 10 deletions

View file

@ -19,7 +19,15 @@ namespace SourceGit.Models
public string Server
{
get => _server;
set => SetProperty(ref _server, value);
set
{
// migrate old server value
if (!string.IsNullOrEmpty(value) && value.EndsWith("/chat/completions", StringComparison.Ordinal))
{
value = value.Substring(0, value.Length - "/chat/completions".Length);
}
SetProperty(ref _server, value);
}
}
public string ApiKey