diff --git a/1.6/1.6/Assemblies/WulaFallenEmpire.dll b/1.6/1.6/Assemblies/WulaFallenEmpire.dll index ff016977..b48161e5 100644 Binary files a/1.6/1.6/Assemblies/WulaFallenEmpire.dll and b/1.6/1.6/Assemblies/WulaFallenEmpire.dll differ diff --git a/Source/WulaFallenEmpire/EventSystem/AI/Tools/Tool_SendReinforcement.cs b/Source/WulaFallenEmpire/EventSystem/AI/Tools/Tool_SendReinforcement.cs index 8b49d80f..61babbb7 100644 --- a/Source/WulaFallenEmpire/EventSystem/AI/Tools/Tool_SendReinforcement.cs +++ b/Source/WulaFallenEmpire/EventSystem/AI/Tools/Tool_SendReinforcement.cs @@ -129,6 +129,7 @@ namespace WulaFallenEmpire.EventSystem.AI.Tools float baseMaxPoints = StorytellerUtility.DefaultThreatPointsNow(map); float adjustedMaxPoints = baseMaxPoints * goodwillFactor * 1.5f; + Log.Message($"[WulaAI] send_reinforcement: totalCost={totalCost}, adjustedMaxPoints={adjustedMaxPoints}"); if (totalCost > adjustedMaxPoints) { return $"Error: Total cost {totalCost} exceeds limit {adjustedMaxPoints:F0}. Reduce unit count."; diff --git a/Source/WulaFallenEmpire/EventSystem/AI/UI/Dialog_AIConversation.cs b/Source/WulaFallenEmpire/EventSystem/AI/UI/Dialog_AIConversation.cs index e8372470..05bb7939 100644 --- a/Source/WulaFallenEmpire/EventSystem/AI/UI/Dialog_AIConversation.cs +++ b/Source/WulaFallenEmpire/EventSystem/AI/UI/Dialog_AIConversation.cs @@ -18,6 +18,7 @@ namespace WulaFallenEmpire.EventSystem.AI.UI private string _inputText = ""; private bool _isThinking = false; private Vector2 _scrollPosition = Vector2.zero; + private bool _scrollToBottom = false; private List _tools = new List(); private Dictionary _portraits = new Dictionary(); private const int MaxHistoryTokens = 100000; @@ -472,6 +473,11 @@ When the player requests any form of resources, you MUST follow this multi-turn _history.Add(("assistant", rawResponse)); } } + + if (!string.IsNullOrEmpty(ParseResponseForDisplay(rawResponse))) + { + _scrollToBottom = true; + } if (parts.Length > 1) { _options.Clear(); @@ -567,6 +573,11 @@ When the player requests any form of resources, you MUST follow this multi-turn viewHeight += Text.CalcHeight(text, rect.width - 16f) + padding; } Rect viewRect = new Rect(0f, 0f, rect.width - 16f, viewHeight); + if (_scrollToBottom) + { + _scrollPosition.y = float.MaxValue; + _scrollToBottom = false; + } Widgets.BeginScrollView(rect, ref _scrollPosition, viewRect); float curY = 0f; for (int i = 0; i < filteredHistory.Count; i++) @@ -689,6 +700,7 @@ When the player requests any form of resources, you MUST follow this multi-turn private async void SelectOption(string text) { _history.Add(("user", text)); + _scrollToBottom = true; await GenerateResponse(); }