conductor(checkpoint): Checkpoint end of Phase 4
This commit is contained in:
+47
-3
@@ -32,6 +32,7 @@ from src import bg_shader
|
||||
from src import thinking_parser
|
||||
from src import thinking_parser
|
||||
import re
|
||||
import difflib
|
||||
import subprocess
|
||||
if sys.platform == "win32":
|
||||
import win32gui
|
||||
@@ -587,6 +588,7 @@ class App:
|
||||
self._tool_log_dirty = True
|
||||
self._render_track_proposal_modal()
|
||||
self._render_patch_modal()
|
||||
self._render_base_prompt_diff_modal()
|
||||
self._render_save_preset_modal()
|
||||
self._render_preset_manager_window()
|
||||
self._render_tool_preset_manager_window()
|
||||
@@ -1113,6 +1115,41 @@ class App:
|
||||
|
||||
if self.perf_profiling_enabled: self.perf_monitor.end_component("_gui_func")
|
||||
|
||||
def _render_base_prompt_diff_modal(self) -> None:
|
||||
if not getattr(self.controller, "_show_base_prompt_diff_modal", False):
|
||||
return
|
||||
|
||||
imgui.open_popup("Base Prompt Diff")
|
||||
if imgui.begin_popup_modal("Base Prompt Diff", True, imgui.WindowFlags_.always_auto_resize)[0]:
|
||||
imgui.text_colored(C_IN, "Difference between Default and Custom Base System Prompt")
|
||||
imgui.separator()
|
||||
|
||||
default_lines = ai_client._SYSTEM_PROMPT.splitlines(keepends=True)
|
||||
custom_lines = self.ui_base_system_prompt.splitlines(keepends=True)
|
||||
|
||||
diff = list(difflib.unified_diff(default_lines, custom_lines, fromfile='Default', tofile='Custom'))
|
||||
|
||||
if not diff:
|
||||
imgui.text("No differences found.")
|
||||
else:
|
||||
imgui.begin_child("base_prompt_diff_scroll", imgui.ImVec2(800, 500), True)
|
||||
for line in diff:
|
||||
if line.startswith("+++") or line.startswith("---") or line.startswith("@@"):
|
||||
imgui.text_colored(vec4(77, 178, 255), line.rstrip())
|
||||
elif line.startswith("+"):
|
||||
imgui.text_colored(vec4(51, 230, 51), line.rstrip())
|
||||
elif line.startswith("-"):
|
||||
imgui.text_colored(vec4(230, 51, 51), line.rstrip())
|
||||
else:
|
||||
imgui.text(line.rstrip())
|
||||
imgui.end_child()
|
||||
|
||||
imgui.separator()
|
||||
if imgui.button("Close", imgui.ImVec2(120, 0)):
|
||||
self.controller._show_base_prompt_diff_modal = False
|
||||
imgui.close_current_popup()
|
||||
imgui.end_popup()
|
||||
|
||||
def _render_save_preset_modal(self) -> None:
|
||||
if not self._show_save_preset_modal: return
|
||||
imgui.open_popup("Save Layout Preset")
|
||||
@@ -4277,9 +4314,16 @@ def hello():
|
||||
imgui.separator()
|
||||
_, self.ui_use_default_base_prompt = imgui.checkbox("Use Default Base System Prompt", self.ui_use_default_base_prompt)
|
||||
imgui.same_line()
|
||||
if imgui.button("Reset to Default"):
|
||||
self.ui_base_system_prompt = ai_client._SYSTEM_PROMPT
|
||||
self.ui_use_default_base_prompt = False
|
||||
if imgui.button("Reset to Default##btn_reset_base_prompt"):
|
||||
self.controller._cb_reset_base_prompt()
|
||||
imgui.same_line()
|
||||
if imgui.button("Show Diff##btn_show_base_prompt_diff"):
|
||||
self.controller._cb_show_base_prompt_diff()
|
||||
imgui.set_item_tooltip("Compare current base prompt with the default.")
|
||||
|
||||
imgui.same_line()
|
||||
imgui.text_disabled("(?)")
|
||||
imgui.set_item_tooltip("The Base System Prompt contains foundational instructions for the AI, including its role as a coding assistant and safety guidelines. You can override it here if needed.")
|
||||
|
||||
header_flags = imgui.TreeNodeFlags_.default_open if not self.ui_use_default_base_prompt else 0
|
||||
if imgui.collapsing_header("Base System Prompt (foundational instructions)", header_flags):
|
||||
|
||||
Reference in New Issue
Block a user