mirror of
https://github.com/LorisYounger/VPet.git
synced 2024-08-30 18:42:36 +00:00
修复 API调用400失败 Fix #81
This commit is contained in:
parent
37c693f705
commit
27bb96e345
@ -1,5 +1,6 @@
|
|||||||
using LinePutScript.Localization.WPF;
|
using LinePutScript.Localization.WPF;
|
||||||
using System;
|
using System;
|
||||||
|
using System.Linq;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using System.Windows;
|
using System.Windows;
|
||||||
using System.Windows.Controls;
|
using System.Windows.Controls;
|
||||||
@ -50,6 +51,18 @@ namespace VPet_Simulator.Windows
|
|||||||
Dispatcher.Invoke(() => this.IsEnabled = false);
|
Dispatcher.Invoke(() => this.IsEnabled = false);
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
if (mw.CGPTClient.Completions.TryGetValue("vpet", out var vpetapi))
|
||||||
|
{
|
||||||
|
var last = vpetapi.messages.LastOrDefault();
|
||||||
|
if (last != null)
|
||||||
|
{
|
||||||
|
if(last.role == ChatGPT.API.Framework.Message.RoleType.user)
|
||||||
|
{
|
||||||
|
vpetapi.messages.Remove(last);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
var resp = mw.CGPTClient.Ask("vpet", content);
|
var resp = mw.CGPTClient.Ask("vpet", content);
|
||||||
var reply = resp.GetMessageContent();
|
var reply = resp.GetMessageContent();
|
||||||
if (resp.choices[0].finish_reason == "length")
|
if (resp.choices[0].finish_reason == "length")
|
||||||
|
Loading…
Reference in New Issue
Block a user