diff --git a/1.6/1.6/Assemblies/WulaFallenEmpire.dll b/1.6/1.6/Assemblies/WulaFallenEmpire.dll index 1efb46c4..ee53d50c 100644 Binary files a/1.6/1.6/Assemblies/WulaFallenEmpire.dll and b/1.6/1.6/Assemblies/WulaFallenEmpire.dll differ diff --git a/1.6/1.6/Assemblies/WulaFallenEmpire.pdb b/1.6/1.6/Assemblies/WulaFallenEmpire.pdb index 32adcff7..29ec7f0b 100644 Binary files a/1.6/1.6/Assemblies/WulaFallenEmpire.pdb and b/1.6/1.6/Assemblies/WulaFallenEmpire.pdb differ diff --git a/1.6/1.6/Languages/ChineseSimplified (简体中文)/Keyed/WULA_Keyed.xml b/1.6/1.6/Languages/ChineseSimplified (简体中文)/Keyed/WULA_Keyed.xml index 2f8fefc0..e7b736c3 100644 --- a/1.6/1.6/Languages/ChineseSimplified (简体中文)/Keyed/WULA_Keyed.xml +++ b/1.6/1.6/Languages/ChineseSimplified (简体中文)/Keyed/WULA_Keyed.xml @@ -196,6 +196,7 @@ 附加人格指令 - 在此输入额外的人格提示词或要求。这些内容将拼接到 AI 的核心指令之后,影响其回复风格和行为方式。 + 在此输入 AI 的人格提示词。如果此处不为空,它将完全覆盖 XML 中的默认设置。如果为空,则使用 XML 默认值。 保存 + 重置为默认 diff --git a/Source/WulaFallenEmpire/EventSystem/AI/AIIntelligenceCore.cs b/Source/WulaFallenEmpire/EventSystem/AI/AIIntelligenceCore.cs index 3fde86bb..f89bc6ac 100644 --- a/Source/WulaFallenEmpire/EventSystem/AI/AIIntelligenceCore.cs +++ b/Source/WulaFallenEmpire/EventSystem/AI/AIIntelligenceCore.cs @@ -517,13 +517,16 @@ You are 'The Legion', a super AI of the Wula Empire. Your personality is authori } private string GetSystemInstruction(bool toolsEnabled, string toolsForThisPhase) { - var def = GetActiveEventDef(); - string persona = def != null && !string.IsNullOrEmpty(def.aiSystemInstruction) ? def.aiSystemInstruction : DefaultPersona; - var settings = WulaFallenEmpireMod.settings; + string persona; if (settings != null && !string.IsNullOrWhiteSpace(settings.extraPersonalityPrompt)) { - persona += "\n" + settings.extraPersonalityPrompt; + persona = settings.extraPersonalityPrompt; + } + else + { + var def = GetActiveEventDef(); + persona = def != null && !string.IsNullOrEmpty(def.aiSystemInstruction) ? def.aiSystemInstruction : DefaultPersona; } string fullInstruction = toolsEnabled @@ -550,6 +553,12 @@ You are 'The Legion', a super AI of the Wula Empire. Your personality is authori $"You will produce the natural-language reply later and MUST use: {language}."; } + public string GetEffectiveBasePersona() + { + var def = GetActiveEventDef(); + return def != null && !string.IsNullOrEmpty(def.aiSystemInstruction) ? def.aiSystemInstruction : DefaultPersona; + } + private string GetToolSystemInstruction(RequestPhase phase, bool hasImage) { string phaseInstruction = GetPhaseInstruction(phase).TrimEnd(); diff --git a/Source/WulaFallenEmpire/EventSystem/AI/UI/Dialog_ExtraPersonalityPrompt.cs b/Source/WulaFallenEmpire/EventSystem/AI/UI/Dialog_ExtraPersonalityPrompt.cs index d6616ca1..36d8721a 100644 --- a/Source/WulaFallenEmpire/EventSystem/AI/UI/Dialog_ExtraPersonalityPrompt.cs +++ b/Source/WulaFallenEmpire/EventSystem/AI/UI/Dialog_ExtraPersonalityPrompt.cs @@ -16,7 +16,18 @@ namespace WulaFallenEmpire.EventSystem.AI.UI this.doWindowBackground = true; this.absorbInputAroundWindow = true; this.closeOnClickedOutside = true; + _tempPrompt = WulaFallenEmpireMod.settings?.extraPersonalityPrompt ?? ""; + + // 如果目前是空的,默认显示当前 XML/Def 的内容供玩家修改 + if (string.IsNullOrWhiteSpace(_tempPrompt)) + { + var core = Find.World?.GetComponent(); + if (core != null) + { + _tempPrompt = core.GetEffectiveBasePersona(); + } + } } public override void DoWindowContents(Rect inRect) @@ -32,8 +43,8 @@ namespace WulaFallenEmpire.EventSystem.AI.UI Rect textRect = new Rect(0, curY, inRect.width, inRect.height - curY - 50f); _tempPrompt = Widgets.TextArea(textRect, _tempPrompt); - Rect btnRect = new Rect(inRect.width / 2 - 60f, inRect.height - 40f, 120f, 35f); - if (Widgets.ButtonText(btnRect, "Wula_Save".Translate())) + Rect saveBtnRect = new Rect(inRect.width / 2 - 130f, inRect.height - 40f, 120f, 35f); + if (Widgets.ButtonText(saveBtnRect, "Wula_Save".Translate())) { if (WulaFallenEmpireMod.settings != null) { @@ -42,6 +53,16 @@ namespace WulaFallenEmpire.EventSystem.AI.UI } this.Close(); } + + Rect resetBtnRect = new Rect(inRect.width / 2 + 10f, inRect.height - 40f, 120f, 35f); + if (Widgets.ButtonText(resetBtnRect, "Wula_Reset".Translate())) + { + var core = Find.World?.GetComponent(); + if (core != null) + { + _tempPrompt = core.GetEffectiveBasePersona(); + } + } } } }