mirror of
https://github.com/LorisYounger/VPet.git
synced 2024-08-30 18:42:36 +00:00
为CGPTAPI添加详细桌宠状态
This commit is contained in:
parent
0cdcfe56d9
commit
13cc7e82d0
@ -33,6 +33,20 @@ namespace VPet_Simulator.Windows
|
|||||||
tbTalk.Text = "";
|
tbTalk.Text = "";
|
||||||
Task.Run(() => OPENAI(cont));
|
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>
|
/// <summary>
|
||||||
/// 使用OPENAI API进行回复
|
/// 使用OPENAI API进行回复
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -56,13 +70,13 @@ namespace VPet_Simulator.Windows
|
|||||||
var last = vpetapi.messages.LastOrDefault();
|
var last = vpetapi.messages.LastOrDefault();
|
||||||
if (last != null)
|
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);
|
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 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")
|
||||||
|
@ -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:|
|
@ -0,0 +1,9 @@
|
|||||||
|
[当前状态: {0}, 好感度:{1}({2})]#[当前状态: {0}, 好感度:{1}({2})]:|
|
||||||
|
陌生#陌生:|
|
||||||
|
普通#普通:|
|
||||||
|
喜欢#喜欢:|
|
||||||
|
爱#爱:|
|
||||||
|
Happy#高兴:|
|
||||||
|
Nomal#普通:|
|
||||||
|
PoorCondition#状态不佳:|
|
||||||
|
Ill#生病:|
|
@ -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:|
|
Loading…
Reference in New Issue
Block a user