zc
This commit is contained in:
Binary file not shown.
@@ -5,6 +5,7 @@ using System.Text;
|
||||
using RimWorld;
|
||||
using Verse;
|
||||
using Verse.AI.Group;
|
||||
using WulaFallenEmpire;
|
||||
|
||||
namespace WulaFallenEmpire.EventSystem.AI.Tools
|
||||
{
|
||||
@@ -107,7 +108,7 @@ namespace WulaFallenEmpire.EventSystem.AI.Tools
|
||||
if (pawnsToSpawn.Count == 0) return "Error: No valid units specified.";
|
||||
|
||||
// Apply Goodwill modifier to points
|
||||
var eventVarManager = Find.World.GetComponent<WulaFallenEmpire.EventVariableManager>();
|
||||
var eventVarManager = Find.World.GetComponent<EventVariableManager>();
|
||||
int goodwill = eventVarManager.GetVariable<int>("Wula_Goodwill_To_PIA", 0);
|
||||
float goodwillFactor = 1.0f;
|
||||
bool hostile = faction.HostileTo(Faction.OfPlayer);
|
||||
|
||||
@@ -444,7 +444,8 @@ When the player requests any form of resources, you MUST follow this multi-turn
|
||||
{
|
||||
// If there is text, we treat it as the final response for this turn.
|
||||
// We don't recurse. We just update the UI state.
|
||||
ParseResponse(xml);
|
||||
// We've already added the full 'xml' to history, so tell ParseResponse not to add it again.
|
||||
ParseResponse(xml, addToHistory: false);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -460,13 +461,16 @@ When the player requests any form of resources, you MUST follow this multi-turn
|
||||
}
|
||||
}
|
||||
|
||||
private void ParseResponse(string rawResponse)
|
||||
private void ParseResponse(string rawResponse, bool addToHistory = true)
|
||||
{
|
||||
_currentResponse = rawResponse;
|
||||
var parts = rawResponse.Split(new[] { "OPTIONS:" }, StringSplitOptions.None);
|
||||
if (_history.Count == 0 || _history.Last().role != "assistant" || _history.Last().message != rawResponse)
|
||||
if (addToHistory)
|
||||
{
|
||||
_history.Add(("assistant", rawResponse));
|
||||
if (_history.Count == 0 || _history.Last().role != "assistant" || _history.Last().message != rawResponse)
|
||||
{
|
||||
_history.Add(("assistant", rawResponse));
|
||||
}
|
||||
}
|
||||
if (parts.Length > 1)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user