checkpoint: before ai yeets it again
This commit is contained in:
@@ -75,7 +75,7 @@ DockId=0xAFC85805,2
|
|||||||
|
|
||||||
[Window][Theme]
|
[Window][Theme]
|
||||||
Pos=0,1786
|
Pos=0,1786
|
||||||
Size=788,351
|
Size=676,351
|
||||||
Collapsed=0
|
Collapsed=0
|
||||||
DockId=0x00000002,2
|
DockId=0x00000002,2
|
||||||
|
|
||||||
@@ -92,7 +92,7 @@ DockId=0x00000010,2
|
|||||||
|
|
||||||
[Window][Context Hub]
|
[Window][Context Hub]
|
||||||
Pos=0,1786
|
Pos=0,1786
|
||||||
Size=788,351
|
Size=676,351
|
||||||
Collapsed=0
|
Collapsed=0
|
||||||
DockId=0x00000002,1
|
DockId=0x00000002,1
|
||||||
|
|
||||||
@@ -103,26 +103,26 @@ Collapsed=0
|
|||||||
DockId=0x0000000D,0
|
DockId=0x0000000D,0
|
||||||
|
|
||||||
[Window][Discussion Hub]
|
[Window][Discussion Hub]
|
||||||
Pos=1668,25
|
Pos=1668,22
|
||||||
Size=915,2112
|
Size=915,2115
|
||||||
Collapsed=0
|
Collapsed=0
|
||||||
DockId=0x00000013,0
|
DockId=0x00000013,0
|
||||||
|
|
||||||
[Window][Operations Hub]
|
[Window][Operations Hub]
|
||||||
Pos=790,25
|
Pos=678,22
|
||||||
Size=876,2112
|
Size=988,2115
|
||||||
Collapsed=0
|
Collapsed=0
|
||||||
DockId=0x00000005,0
|
DockId=0x00000005,0
|
||||||
|
|
||||||
[Window][Files & Media]
|
[Window][Files & Media]
|
||||||
Pos=0,1786
|
Pos=0,1786
|
||||||
Size=788,351
|
Size=676,351
|
||||||
Collapsed=0
|
Collapsed=0
|
||||||
DockId=0x00000002,0
|
DockId=0x00000002,0
|
||||||
|
|
||||||
[Window][AI Settings]
|
[Window][AI Settings]
|
||||||
Pos=0,25
|
Pos=0,22
|
||||||
Size=788,1759
|
Size=676,1762
|
||||||
Collapsed=0
|
Collapsed=0
|
||||||
DockId=0x00000001,0
|
DockId=0x00000001,0
|
||||||
|
|
||||||
@@ -132,14 +132,14 @@ Size=416,325
|
|||||||
Collapsed=0
|
Collapsed=0
|
||||||
|
|
||||||
[Window][MMA Dashboard]
|
[Window][MMA Dashboard]
|
||||||
Pos=2585,25
|
Pos=2585,22
|
||||||
Size=1255,2112
|
Size=1255,2115
|
||||||
Collapsed=0
|
Collapsed=0
|
||||||
DockId=0x00000010,0
|
DockId=0x00000010,0
|
||||||
|
|
||||||
[Window][Log Management]
|
[Window][Log Management]
|
||||||
Pos=2585,25
|
Pos=2585,22
|
||||||
Size=1255,2112
|
Size=1255,2115
|
||||||
Collapsed=0
|
Collapsed=0
|
||||||
DockId=0x00000010,1
|
DockId=0x00000010,1
|
||||||
|
|
||||||
@@ -339,9 +339,9 @@ Collapsed=0
|
|||||||
DockId=0x0000000F,0
|
DockId=0x0000000F,0
|
||||||
|
|
||||||
[Window][Tool Preset Manager]
|
[Window][Tool Preset Manager]
|
||||||
Pos=1298,303
|
Pos=1301,302
|
||||||
Size=2219,1661
|
Size=1469,1267
|
||||||
Collapsed=1
|
Collapsed=0
|
||||||
|
|
||||||
[Window][Persona Editor]
|
[Window][Persona Editor]
|
||||||
Pos=909,391
|
Pos=909,391
|
||||||
@@ -438,8 +438,8 @@ Column 1 Width=180
|
|||||||
Column 2 Weight=1.0000
|
Column 2 Weight=1.0000
|
||||||
|
|
||||||
[Table][0xD0277E63,2]
|
[Table][0xD0277E63,2]
|
||||||
RefScale=17
|
RefScale=14
|
||||||
Column 0 Width=141
|
Column 0 Width=116
|
||||||
Column 1 Weight=1.0000
|
Column 1 Weight=1.0000
|
||||||
|
|
||||||
[Table][0x3AAF84D5,2]
|
[Table][0x3AAF84D5,2]
|
||||||
@@ -448,13 +448,13 @@ Column 0 Width=150
|
|||||||
Column 1 Weight=1.0000
|
Column 1 Weight=1.0000
|
||||||
|
|
||||||
[Table][0x8D8494AB,2]
|
[Table][0x8D8494AB,2]
|
||||||
RefScale=24
|
RefScale=14
|
||||||
Column 0 Width=200
|
Column 0 Width=116
|
||||||
Column 1 Weight=1.0000
|
Column 1 Weight=1.0000
|
||||||
|
|
||||||
[Table][0x2C261E6E,2]
|
[Table][0x2C261E6E,2]
|
||||||
RefScale=24
|
RefScale=14
|
||||||
Column 0 Width=150
|
Column 0 Width=87
|
||||||
Column 1 Weight=1.0000
|
Column 1 Weight=1.0000
|
||||||
|
|
||||||
[Table][0x9CB1E6FD,2]
|
[Table][0x9CB1E6FD,2]
|
||||||
@@ -466,14 +466,14 @@ Column 1 Weight=1.0000
|
|||||||
DockNode ID=0x00000008 Pos=3125,170 Size=593,1157 Split=Y
|
DockNode ID=0x00000008 Pos=3125,170 Size=593,1157 Split=Y
|
||||||
DockNode ID=0x00000009 Parent=0x00000008 SizeRef=1029,147 Selected=0x0469CA7A
|
DockNode ID=0x00000009 Parent=0x00000008 SizeRef=1029,147 Selected=0x0469CA7A
|
||||||
DockNode ID=0x0000000A Parent=0x00000008 SizeRef=1029,145 Selected=0xDF822E02
|
DockNode ID=0x0000000A Parent=0x00000008 SizeRef=1029,145 Selected=0xDF822E02
|
||||||
DockSpace ID=0xAFC85805 Window=0x079D3A04 Pos=0,25 Size=3840,2112 Split=X
|
DockSpace ID=0xAFC85805 Window=0x079D3A04 Pos=0,22 Size=3840,2115 Split=X
|
||||||
DockNode ID=0x00000003 Parent=0xAFC85805 SizeRef=2583,1183 Split=X
|
DockNode ID=0x00000003 Parent=0xAFC85805 SizeRef=2583,1183 Split=X
|
||||||
DockNode ID=0x0000000B Parent=0x00000003 SizeRef=404,1186 Split=X Selected=0xF4139CA2
|
DockNode ID=0x0000000B Parent=0x00000003 SizeRef=404,1186 Split=X Selected=0xF4139CA2
|
||||||
DockNode ID=0x00000007 Parent=0x0000000B SizeRef=788,858 Split=Y Selected=0x8CA2375C
|
DockNode ID=0x00000007 Parent=0x0000000B SizeRef=676,858 Split=Y Selected=0x8CA2375C
|
||||||
DockNode ID=0x00000001 Parent=0x00000007 SizeRef=824,1759 CentralNode=1 Selected=0x7BD57D6A
|
DockNode ID=0x00000001 Parent=0x00000007 SizeRef=824,1759 CentralNode=1 Selected=0x7BD57D6A
|
||||||
DockNode ID=0x00000002 Parent=0x00000007 SizeRef=824,351 Selected=0x1DCB2623
|
DockNode ID=0x00000002 Parent=0x00000007 SizeRef=824,351 Selected=0x1DCB2623
|
||||||
DockNode ID=0x0000000E Parent=0x0000000B SizeRef=1793,858 Split=X Selected=0x418C7449
|
DockNode ID=0x0000000E Parent=0x0000000B SizeRef=1905,858 Split=X Selected=0x418C7449
|
||||||
DockNode ID=0x00000012 Parent=0x0000000E SizeRef=876,402 Split=Y Selected=0x418C7449
|
DockNode ID=0x00000012 Parent=0x0000000E SizeRef=988,402 Split=Y Selected=0x418C7449
|
||||||
DockNode ID=0x00000005 Parent=0x00000012 SizeRef=876,1455 Selected=0x418C7449
|
DockNode ID=0x00000005 Parent=0x00000012 SizeRef=876,1455 Selected=0x418C7449
|
||||||
DockNode ID=0x00000006 Parent=0x00000012 SizeRef=876,654 Selected=0x1D56B311
|
DockNode ID=0x00000006 Parent=0x00000012 SizeRef=876,654 Selected=0x1D56B311
|
||||||
DockNode ID=0x00000013 Parent=0x0000000E SizeRef=915,402 Selected=0x6F2B5B04
|
DockNode ID=0x00000013 Parent=0x0000000E SizeRef=915,402 Selected=0x6F2B5B04
|
||||||
|
|||||||
76
src/gui_2.py
76
src/gui_2.py
@@ -940,6 +940,7 @@ class App:
|
|||||||
|
|
||||||
def _render_preset_manager_content(self, is_embedded: bool = False) -> None:
|
def _render_preset_manager_content(self, is_embedded: bool = False) -> None:
|
||||||
avail = imgui.get_content_region_avail()
|
avail = imgui.get_content_region_avail()
|
||||||
|
if not hasattr(self, "_prompt_md_preview"): self._prompt_md_preview = False
|
||||||
|
|
||||||
if imgui.begin_table("prompt_main_split", 2, imgui.TableFlags_.resizable | imgui.TableFlags_.borders_inner_v):
|
if imgui.begin_table("prompt_main_split", 2, imgui.TableFlags_.resizable | imgui.TableFlags_.borders_inner_v):
|
||||||
imgui.table_setup_column("List", imgui.TableColumnFlags_.width_fixed, 200)
|
imgui.table_setup_column("List", imgui.TableColumnFlags_.width_fixed, 200)
|
||||||
@@ -968,7 +969,6 @@ class App:
|
|||||||
# Right Editor
|
# Right Editor
|
||||||
imgui.table_next_column()
|
imgui.table_next_column()
|
||||||
avail_r = imgui.get_content_region_avail()
|
avail_r = imgui.get_content_region_avail()
|
||||||
# Reserve 45px for footer buttons
|
|
||||||
if imgui.begin_child("prompt_edit_pane", imgui.ImVec2(0, avail_r.y - 45), False):
|
if imgui.begin_child("prompt_edit_pane", imgui.ImVec2(0, avail_r.y - 45), False):
|
||||||
p_disp = self._editing_preset_name or "(New Preset)"
|
p_disp = self._editing_preset_name or "(New Preset)"
|
||||||
imgui.text_colored(C_IN, f"Editing Prompt Preset: {p_disp}")
|
imgui.text_colored(C_IN, f"Editing Prompt Preset: {p_disp}")
|
||||||
@@ -1008,45 +1008,41 @@ class App:
|
|||||||
# Footer Buttons
|
# Footer Buttons
|
||||||
imgui.separator()
|
imgui.separator()
|
||||||
imgui.dummy(imgui.ImVec2(0, 4))
|
imgui.dummy(imgui.ImVec2(0, 4))
|
||||||
if imgui.button("Save", imgui.ImVec2(100, 0)):
|
if imgui.button("Save##p", imgui.ImVec2(100, 0)):
|
||||||
if self._editing_preset_name.strip():
|
if self._editing_preset_name.strip():
|
||||||
p = models.Preset(name=self._editing_preset_name.strip(), system_prompt=self._editing_preset_system_prompt)
|
p = models.Preset(name=self._editing_preset_name.strip(), system_prompt=self._editing_preset_system_prompt)
|
||||||
self.controller._cb_save_preset(p, self._editing_preset_scope)
|
self.controller._cb_save_preset(p, self._editing_preset_scope)
|
||||||
self.ai_status = f"Saved: {p.name}"
|
self.ai_status = f"Saved: {p.name}"
|
||||||
imgui.same_line()
|
imgui.same_line()
|
||||||
if imgui.button("Delete", imgui.ImVec2(100, 0)):
|
if imgui.button("Delete##p", imgui.ImVec2(100, 0)):
|
||||||
if self._editing_preset_name:
|
if self._editing_preset_name:
|
||||||
self.controller._cb_delete_preset(self._editing_preset_name, self._editing_preset_scope)
|
self.controller._cb_delete_preset(self._editing_preset_name, self._editing_preset_scope)
|
||||||
self._editing_preset_name = ""
|
self._editing_preset_name = ""
|
||||||
self._selected_preset_idx = -1
|
self._selected_preset_idx = -1
|
||||||
if not is_embedded:
|
if not is_embedded:
|
||||||
imgui.same_line()
|
imgui.same_line()
|
||||||
if imgui.button("Close", imgui.ImVec2(100, 0)):
|
if imgui.button("Close##p", imgui.ImVec2(100, 0)):
|
||||||
self.show_preset_manager_window = False
|
self.show_preset_manager_window = False
|
||||||
imgui.end_table()
|
imgui.end_table()
|
||||||
|
|
||||||
def _render_preset_manager_window(self, is_embedded: bool = False) -> None:
|
def _render_preset_manager_window(self, is_embedded: bool = False) -> None:
|
||||||
if not self.show_preset_manager_window and not is_embedded: return
|
if not self.show_preset_manager_window and not is_embedded: return
|
||||||
|
|
||||||
if not is_embedded:
|
if not is_embedded:
|
||||||
imgui.set_next_window_size(imgui.ImVec2(1000, 800), imgui.Cond_.first_use_ever)
|
imgui.set_next_window_size(imgui.ImVec2(1000, 800), imgui.Cond_.first_use_ever)
|
||||||
opened, self.show_preset_manager_window = imgui.begin("Prompt Presets Manager", self.show_preset_manager_window)
|
opened, self.show_preset_manager_window = imgui.begin("Prompt Presets Manager", self.show_preset_manager_window)
|
||||||
if not opened:
|
if not opened:
|
||||||
imgui.end()
|
imgui.end(); return
|
||||||
return
|
self._render_preset_manager_content(is_embedded=is_embedded)
|
||||||
|
if not is_embedded: imgui.end()
|
||||||
try:
|
|
||||||
self._render_preset_manager_content(is_embedded=is_embedded)
|
|
||||||
except Exception as e:
|
|
||||||
import traceback
|
|
||||||
traceback.print_exc()
|
|
||||||
imgui.text_colored(vec4(255, 0, 0), f"Error in Prompt Presets Manager: {e}")
|
|
||||||
finally:
|
|
||||||
if not is_embedded:
|
|
||||||
imgui.end()
|
|
||||||
|
|
||||||
def _render_tool_preset_manager_content(self, is_embedded: bool = False) -> None:
|
def _render_tool_preset_manager_content(self, is_embedded: bool = False) -> None:
|
||||||
avail = imgui.get_content_region_avail()
|
avail = imgui.get_content_region_avail()
|
||||||
|
if not hasattr(self, "_tool_split_v"): self._tool_split_v = 0.4
|
||||||
|
if not hasattr(self, "_bias_split_v"): self._bias_split_v = 0.6
|
||||||
|
if not hasattr(self, "_tool_list_open"): self._tool_list_open = True
|
||||||
|
if not hasattr(self, "_bias_list_open"): self._bias_list_open = True
|
||||||
|
if not hasattr(self, "_bias_weights_open"): self._bias_weights_open = True
|
||||||
|
if not hasattr(self, "_bias_cats_open"): self._bias_cats_open = True
|
||||||
|
|
||||||
if imgui.begin_table("tp_main_split", 2, imgui.TableFlags_.resizable | imgui.TableFlags_.borders_inner_v):
|
if imgui.begin_table("tp_main_split", 2, imgui.TableFlags_.resizable | imgui.TableFlags_.borders_inner_v):
|
||||||
imgui.table_setup_column("List", imgui.TableColumnFlags_.width_fixed, 200)
|
imgui.table_setup_column("List", imgui.TableColumnFlags_.width_fixed, 200)
|
||||||
@@ -1079,14 +1075,13 @@ class App:
|
|||||||
imgui.table_setup_column("L", imgui.TableColumnFlags_.width_fixed, 80); imgui.table_setup_column("F", imgui.TableColumnFlags_.width_stretch)
|
imgui.table_setup_column("L", imgui.TableColumnFlags_.width_fixed, 80); imgui.table_setup_column("F", imgui.TableColumnFlags_.width_stretch)
|
||||||
imgui.table_next_row(); imgui.table_next_column(); imgui.text("Name:"); imgui.table_next_column(); imgui.set_next_item_width(-1); _, self._editing_tool_preset_name = imgui.input_text("##etpn", self._editing_tool_preset_name)
|
imgui.table_next_row(); imgui.table_next_column(); imgui.text("Name:"); imgui.table_next_column(); imgui.set_next_item_width(-1); _, self._editing_tool_preset_name = imgui.input_text("##etpn", self._editing_tool_preset_name)
|
||||||
imgui.table_next_row(); imgui.table_next_column(); imgui.text("Scope:"); imgui.table_next_column()
|
imgui.table_next_row(); imgui.table_next_column(); imgui.text("Scope:"); imgui.table_next_column()
|
||||||
if imgui.radio_button("Global##tps", self._editing_tool_preset_scope == "global"): self._editing_tool_preset_scope = "global"
|
if imgui.radio_button("Global", self._editing_tool_preset_scope == "global"): self._editing_tool_preset_scope = "global"
|
||||||
imgui.same_line();
|
imgui.same_line();
|
||||||
if imgui.radio_button("Project##tps", self._editing_tool_preset_scope == "project"): self._editing_tool_preset_scope = "project"
|
if imgui.radio_button("Project", self._editing_tool_preset_scope == "project"): self._editing_tool_preset_scope = "project"
|
||||||
imgui.end_table()
|
imgui.end_table()
|
||||||
|
|
||||||
rem_y = imgui.get_content_region_avail().y - 80
|
rem_y = imgui.get_content_region_avail().y - 80
|
||||||
if self._tool_list_open and self._bias_list_open:
|
if self._tool_list_open and self._bias_list_open: h1, h2 = rem_y * self._tool_split_v, rem_y - (rem_y * self._tool_split_v) - 10
|
||||||
h1 = rem_y * self._tool_split_v; h2 = rem_y - h1 - 10
|
|
||||||
elif self._tool_list_open: h1, h2 = rem_y, 0
|
elif self._tool_list_open: h1, h2 = rem_y, 0
|
||||||
elif self._bias_list_open: h1, h2 = 0, rem_y
|
elif self._bias_list_open: h1, h2 = 0, rem_y
|
||||||
else: h1, h2 = 0, 0
|
else: h1, h2 = 0, 0
|
||||||
@@ -1100,7 +1095,6 @@ class App:
|
|||||||
f_idx = cat_opts.index(self.ui_tool_filter_category) if self.ui_tool_filter_category in cat_opts else 0
|
f_idx = cat_opts.index(self.ui_tool_filter_category) if self.ui_tool_filter_category in cat_opts else 0
|
||||||
imgui.set_next_item_width(200); ch_cat, next_f_idx = imgui.combo("##tp_filter", f_idx, cat_opts)
|
imgui.set_next_item_width(200); ch_cat, next_f_idx = imgui.combo("##tp_filter", f_idx, cat_opts)
|
||||||
if ch_cat: self.ui_tool_filter_category = cat_opts[next_f_idx]
|
if ch_cat: self.ui_tool_filter_category = cat_opts[next_f_idx]
|
||||||
|
|
||||||
if imgui.begin_child("tp_scroll", imgui.ImVec2(0, h1), True):
|
if imgui.begin_child("tp_scroll", imgui.ImVec2(0, h1), True):
|
||||||
for cat_name, default_tools in models.DEFAULT_TOOL_CATEGORIES.items():
|
for cat_name, default_tools in models.DEFAULT_TOOL_CATEGORIES.items():
|
||||||
if self.ui_tool_filter_category != "All" and self.ui_tool_filter_category != cat_name: continue
|
if self.ui_tool_filter_category != "All" and self.ui_tool_filter_category != cat_name: continue
|
||||||
@@ -1153,8 +1147,7 @@ class App:
|
|||||||
if imgui.begin_child("bedit_pane", imgui.ImVec2(0, 0), False):
|
if imgui.begin_child("bedit_pane", imgui.ImVec2(0, 0), False):
|
||||||
imgui.text("Name:"); imgui.same_line(); imgui.set_next_item_width(-1); _, self._editing_bias_profile_name = imgui.input_text("##bname", self._editing_bias_profile_name)
|
imgui.text("Name:"); imgui.same_line(); imgui.set_next_item_width(-1); _, self._editing_bias_profile_name = imgui.input_text("##bname", self._editing_bias_profile_name)
|
||||||
rem_bias_y = imgui.get_content_region_avail().y - 45
|
rem_bias_y = imgui.get_content_region_avail().y - 45
|
||||||
if self._bias_weights_open and self._bias_cats_open:
|
if self._bias_weights_open and self._bias_cats_open: bh1, bh2 = rem_bias_y * self._bias_split_v, rem_bias_y - (rem_bias_y * self._bias_split_v) - 10
|
||||||
bh1 = rem_bias_y * self._bias_split_v; bh2 = rem_bias_y - bh1 - 10
|
|
||||||
elif self._bias_weights_open: bh1, bh2 = rem_bias_y, 0
|
elif self._bias_weights_open: bh1, bh2 = rem_bias_y, 0
|
||||||
elif self._bias_cats_open: bh1, bh2 = 0, rem_bias_y
|
elif self._bias_cats_open: bh1, bh2 = 0, rem_bias_y
|
||||||
else: bh1, bh2 = 0, 0
|
else: bh1, bh2 = 0, 0
|
||||||
@@ -1205,34 +1198,26 @@ class App:
|
|||||||
|
|
||||||
# --- Footer Buttons ---
|
# --- Footer Buttons ---
|
||||||
imgui.separator()
|
imgui.separator()
|
||||||
if imgui.button("Save", imgui.ImVec2(100, 0)):
|
if imgui.button("Save##tp", imgui.ImVec2(100, 0)):
|
||||||
if self._editing_tool_preset_name.strip(): self.controller._cb_save_tool_preset(self._editing_tool_preset_name.strip(), self._editing_tool_preset_categories, self._editing_tool_preset_scope); self.ai_status = f"Saved: {self._editing_tool_preset_name}"
|
if self._editing_tool_preset_name.strip(): self.controller._cb_save_tool_preset(self._editing_tool_preset_name.strip(), self._editing_tool_preset_categories, self._editing_tool_preset_scope); self.ai_status = f"Saved: {self._editing_tool_preset_name}"
|
||||||
imgui.same_line()
|
imgui.same_line()
|
||||||
if imgui.button("Delete", imgui.ImVec2(100, 0)):
|
if imgui.button("Delete##tp", imgui.ImVec2(100, 0)):
|
||||||
if self._editing_tool_preset_name: self.controller._cb_delete_tool_preset(self._editing_tool_preset_name, self._editing_tool_preset_scope); self._editing_tool_preset_name = ""; self._selected_tool_preset_idx = -1
|
if self._editing_tool_preset_name: self.controller._cb_delete_tool_preset(self._editing_tool_preset_name, self._editing_tool_preset_scope); self._editing_tool_preset_name = ""; self._selected_tool_preset_idx = -1
|
||||||
imgui.same_line()
|
imgui.same_line()
|
||||||
if not is_embedded:
|
if not is_embedded:
|
||||||
if imgui.button("Close", imgui.ImVec2(100, 0)): self.show_tool_preset_manager_window = False
|
if imgui.button("Close##tp", imgui.ImVec2(100, 0)): self.show_tool_preset_manager_window = False
|
||||||
imgui.end_table()
|
imgui.end_table()
|
||||||
|
|
||||||
def _render_tool_preset_manager_window(self, is_embedded: bool = False) -> None:
|
def _render_tool_preset_manager_window(self, is_embedded: bool = False) -> None:
|
||||||
if not self.show_tool_preset_manager_window and not is_embedded: return
|
if not self.show_tool_preset_manager_window and not is_embedded: return
|
||||||
|
|
||||||
if not is_embedded:
|
if not is_embedded:
|
||||||
imgui.set_next_window_size(imgui.ImVec2(1000, 800), imgui.Cond_.first_use_ever)
|
imgui.set_next_window_size(imgui.ImVec2(1000, 800), imgui.Cond_.first_use_ever)
|
||||||
opened, self.show_tool_preset_manager_window = imgui.begin("Tool Preset Manager", self.show_tool_preset_manager_window)
|
opened, self.show_tool_preset_manager_window = imgui.begin("Tool Preset Manager", self.show_tool_preset_manager_window)
|
||||||
if not opened:
|
if not opened:
|
||||||
imgui.end()
|
imgui.end(); return
|
||||||
return
|
self._render_tool_preset_manager_content(is_embedded=is_embedded)
|
||||||
|
if not is_embedded: imgui.end()
|
||||||
|
|
||||||
try:
|
|
||||||
self._render_tool_preset_manager_content(is_embedded=is_embedded)
|
|
||||||
except Exception as e:
|
|
||||||
import traceback
|
|
||||||
traceback.print_exc()
|
|
||||||
imgui.text_colored(vec4(255, 0, 0), f"Error in Tool Preset Manager: {e}")
|
|
||||||
finally:
|
|
||||||
if not is_embedded:
|
|
||||||
imgui.end()
|
|
||||||
def _render_persona_editor_window(self, is_embedded: bool = False) -> None:
|
def _render_persona_editor_window(self, is_embedded: bool = False) -> None:
|
||||||
if not self.show_persona_editor_window and not is_embedded: return
|
if not self.show_persona_editor_window and not is_embedded: return
|
||||||
if not is_embedded:
|
if not is_embedded:
|
||||||
@@ -1281,8 +1266,7 @@ class App:
|
|||||||
imgui.end_table()
|
imgui.end_table()
|
||||||
|
|
||||||
rem_y = imgui.get_content_region_avail().y - 100
|
rem_y = imgui.get_content_region_avail().y - 100
|
||||||
if self._persona_models_open and self._persona_prompt_open:
|
if self._persona_models_open and self._persona_prompt_open: h1, h2 = rem_y * self._persona_split_v, rem_y - (rem_y * self._persona_split_v) - 10
|
||||||
h1 = rem_y * self._persona_split_v; h2 = rem_y - h1 - 10
|
|
||||||
elif self._persona_models_open: h1, h2 = rem_y, 0
|
elif self._persona_models_open: h1, h2 = rem_y, 0
|
||||||
elif self._persona_prompt_open: h1, h2 = 0, rem_y
|
elif self._persona_prompt_open: h1, h2 = 0, rem_y
|
||||||
else: h1, h2 = 0, 0
|
else: h1, h2 = 0, 0
|
||||||
@@ -1370,7 +1354,7 @@ class App:
|
|||||||
|
|
||||||
# --- Footer Buttons ---
|
# --- Footer Buttons ---
|
||||||
imgui.separator()
|
imgui.separator()
|
||||||
if imgui.button("Save", imgui.ImVec2(100, 0)):
|
if imgui.button("Save##pers", imgui.ImVec2(100, 0)):
|
||||||
if self._editing_persona_name.strip():
|
if self._editing_persona_name.strip():
|
||||||
try:
|
try:
|
||||||
import copy; persona = models.Persona(name=self._editing_persona_name.strip(), system_prompt=self._editing_persona_system_prompt, tool_preset=self._editing_persona_tool_preset_id or None, bias_profile=self._editing_persona_bias_profile_id or None, preferred_models=copy.deepcopy(self._editing_persona_preferred_models_list))
|
import copy; persona = models.Persona(name=self._editing_persona_name.strip(), system_prompt=self._editing_persona_system_prompt, tool_preset=self._editing_persona_tool_preset_id or None, bias_profile=self._editing_persona_bias_profile_id or None, preferred_models=copy.deepcopy(self._editing_persona_preferred_models_list))
|
||||||
@@ -1378,15 +1362,17 @@ class App:
|
|||||||
except Exception as e: self.ai_status = f"Error: {e}"
|
except Exception as e: self.ai_status = f"Error: {e}"
|
||||||
else: self.ai_status = "Name required"
|
else: self.ai_status = "Name required"
|
||||||
imgui.same_line();
|
imgui.same_line();
|
||||||
if imgui.button("Delete", imgui.ImVec2(100, 0)):
|
if imgui.button("Delete##pers", imgui.ImVec2(100, 0)):
|
||||||
if not getattr(self, '_editing_persona_is_new', True) and self._editing_persona_name:
|
if not getattr(self, '_editing_persona_is_new', True) and self._editing_persona_name:
|
||||||
self.controller._cb_delete_persona(self._editing_persona_name, getattr(self, '_editing_persona_scope', 'project'))
|
self.controller._cb_delete_persona(self._editing_persona_name, getattr(self, '_editing_persona_scope', 'project'))
|
||||||
self._editing_persona_name = ""; self._editing_persona_is_new = True
|
self._editing_persona_name = ""; self._editing_persona_is_new = True
|
||||||
if not is_embedded:
|
if not is_embedded:
|
||||||
imgui.same_line();
|
imgui.same_line()
|
||||||
if imgui.button("Close", imgui.ImVec2(100, 0)): self.show_persona_editor_window = False
|
if imgui.button("Close##pers", imgui.ImVec2(100, 0)):
|
||||||
|
self.show_persona_editor_window = False
|
||||||
imgui.end_table()
|
imgui.end_table()
|
||||||
if not is_embedded: imgui.end()
|
if not is_embedded: imgui.end()
|
||||||
|
|
||||||
def _render_projects_panel(self) -> None:
|
def _render_projects_panel(self) -> None:
|
||||||
if self.perf_profiling_enabled: self.perf_monitor.start_component("_render_projects_panel")
|
if self.perf_profiling_enabled: self.perf_monitor.start_component("_render_projects_panel")
|
||||||
proj_name = self.project.get("project", {}).get("name", Path(self.active_project_path).stem)
|
proj_name = self.project.get("project", {}).get("name", Path(self.active_project_path).stem)
|
||||||
|
|||||||
@@ -55,19 +55,32 @@ class PresetManager:
|
|||||||
data["presets"][preset.name] = preset.to_dict()
|
data["presets"][preset.name] = preset.to_dict()
|
||||||
self._save_file(path, data)
|
self._save_file(path, data)
|
||||||
|
|
||||||
def delete_preset(self, name: str, scope: str = "project") -> None:
|
def delete_preset(self, name: str, scope: str) -> None:
|
||||||
"""Deletes a preset by name from the specified scope."""
|
if scope == "project" and self.project_root:
|
||||||
path = self.global_path if scope == "global" else self.project_path
|
path = get_project_presets_path(self.project_root)
|
||||||
if not path:
|
else:
|
||||||
if scope == "project":
|
path = get_global_presets_path()
|
||||||
raise ValueError("Project scope requested but no project_root provided.")
|
|
||||||
path = self.global_path
|
|
||||||
|
|
||||||
data = self._load_file(path)
|
data = self._load_file(path)
|
||||||
if "presets" in data and name in data["presets"]:
|
if name in data.get("presets", {}):
|
||||||
del data["presets"][name]
|
del data["presets"][name]
|
||||||
self._save_file(path, data)
|
self._save_file(path, data)
|
||||||
|
|
||||||
|
def get_preset_scope(self, name: str) -> str:
|
||||||
|
"""Returns the scope ('global' or 'project') of a preset by name."""
|
||||||
|
if self.project_root:
|
||||||
|
project_p = get_project_presets_path(self.project_root)
|
||||||
|
project_data = self._load_file(project_p)
|
||||||
|
if name in project_data.get("presets", {}):
|
||||||
|
return "project"
|
||||||
|
|
||||||
|
global_p = get_global_presets_path()
|
||||||
|
global_data = self._load_file(global_p)
|
||||||
|
if name in global_data.get("presets", {}):
|
||||||
|
return "global"
|
||||||
|
|
||||||
|
return "project"
|
||||||
|
|
||||||
def _load_file(self, path: Path) -> Dict[str, Any]:
|
def _load_file(self, path: Path) -> Dict[str, Any]:
|
||||||
if not path.exists():
|
if not path.exists():
|
||||||
return {"presets": {}}
|
return {"presets": {}}
|
||||||
@@ -85,8 +98,7 @@ class PresetManager:
|
|||||||
|
|
||||||
def _save_file(self, path: Path, data: Dict[str, Any]) -> None:
|
def _save_file(self, path: Path, data: Dict[str, Any]) -> None:
|
||||||
if path.parent.exists() and path.parent.is_file():
|
if path.parent.exists() and path.parent.is_file():
|
||||||
raise ValueError(f"Cannot save to {path}: Parent directory {path.parent} is a file. The project root seems to be a file.")
|
raise ValueError(f"Cannot save to {path}: Parent directory {path.parent} is a file.")
|
||||||
path.parent.mkdir(parents=True, exist_ok=True)
|
path.parent.mkdir(parents=True, exist_ok=True)
|
||||||
with open(path, "wb") as f:
|
with open(path, "wb") as f:
|
||||||
f.write(tomli_w.dumps(data).encode("utf-8"))
|
f.write(tomli_w.dumps(data).encode("utf-8"))
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user