为CGPTAPI添加详细桌宠状态

This commit is contained in:
ZouJin 2023-08-30 00:24:50 +08:00
parent 0cdcfe56d9
commit 13cc7e82d0
4 changed files with 43 additions and 2 deletions

View File

@ -33,6 +33,20 @@ namespace VPet_Simulator.Windows
tbTalk.Text = "";
Task.Run(() => OPENAI(cont));
}
public static string[] like_str = new string[] { "陌生", "普通", "喜欢", "爱" };
public static int like_ts(int like)
{
if (like > 50)
{
if (like < 100)
return 1;
else if (like < 200)
return 2;
else
return 3;
}
return 0;
}
/// <summary>
/// 使用OPENAI API进行回复
/// </summary>
@ -56,13 +70,13 @@ namespace VPet_Simulator.Windows
var last = vpetapi.messages.LastOrDefault();
if (last != null)
{
if(last.role == ChatGPT.API.Framework.Message.RoleType.user)
if (last.role == ChatGPT.API.Framework.Message.RoleType.user)
{
vpetapi.messages.Remove(last);
}
}
}
content = "[当前状态: {0}, 好感度:{1}({2})]".Translate(mw.Core.Save.Mode.ToString().Translate(), like_str[like_ts((int)mw.Core.Save.Likability)].Translate(), (int)mw.Core.Save.Likability) + content;
var resp = mw.CGPTClient.Ask("vpet", content);
var reply = resp.GetMessageContent();
if (resp.choices[0].finish_reason == "length")

View File

@ -0,0 +1,9 @@
[当前状态: {0}, 好感度:{1}({2})]#[Current status: {0}, Favorability:{1}({2})]:|
陌生#Strange:|
普通#Common:|
喜欢#Favorite:|
爱#Love:|
Happy#Happy:|
Nomal#Ordinary:|
PoorCondition#Bad:|
Ill#Sick:|

View File

@ -0,0 +1,9 @@
[当前状态: {0}, 好感度:{1}({2})]#[当前状态: {0}, 好感度:{1}({2})]:|
陌生#陌生:|
普通#普通:|
喜欢#喜欢:|
爱#爱:|
Happy#高兴:|
Nomal#普通:|
PoorCondition#状态不佳:|
Ill#生病:|

View File

@ -0,0 +1,9 @@
[当前状态: {0}, 好感度:{1}({2})]#[Current status: {0}, favorability: {1} ({2})]:|
陌生#strange:|
普通#ordinary:|
喜欢#like:|
爱#love:|
Happy#happy:|
Nomal#ordinary:|
PoorCondition#Run down :|
Ill#get sick:|