Compare commits
4 Commits
e600d3fdcd
...
7d9d8a70e8
| Author | SHA1 | Date | |
|---|---|---|---|
| 7d9d8a70e8 | |||
| cc6a651664 | |||
| e567223031 | |||
| a3c8d4b153 |
@@ -23,30 +23,30 @@ Focus: Move Session Hub tabs into Discussion Hub, eliminate separate Session Hub
|
||||
- [x] Task: Write tests for new tab structure rendering [2b73745]
|
||||
- [x] Task: Conductor - User Manual Verification 'Phase 2: Merge Session Hub into Discussion Hub'
|
||||
|
||||
## Phase 3: Context Composition Tab
|
||||
## Phase 3: Context Composition Tab [checkpoint: a3c8d4b]
|
||||
Focus: Per-discussion file filter with save/load preset functionality
|
||||
|
||||
- [ ] Task: Write tests for Context Composition state management
|
||||
- [ ] Task: Create _render_context_composition_panel method
|
||||
- [ ] Task: Implement file/screenshot selection display (filtered from Files & Media)
|
||||
- [ ] Task: Implement per-file flags display (Auto-Aggregate, Force Full)
|
||||
- [ ] Task: Implement Save as Preset / Load Preset buttons
|
||||
- [ ] Task: Connect Context Presets storage to this panel
|
||||
- [ ] Task: Update Persona editor to reference Context Composition presets
|
||||
- [ ] Task: Write tests for Context Composition preset save/load
|
||||
- [ ] Task: Conductor - User Manual Verification 'Phase 3: Context Composition Tab'
|
||||
- [x] Task: Write tests for Context Composition state management [a3c8d4b]
|
||||
- [x] Task: Create _render_context_composition_panel method [a3c8d4b]
|
||||
- [x] Task: Implement file/screenshot selection display (filtered from Files & Media) [a3c8d4b]
|
||||
- [x] Task: Implement per-file flags display (Auto-Aggregate, Force Full) [a3c8d4b]
|
||||
- [x] Task: Implement Save as Preset / Load Preset buttons [a3c8d4b]
|
||||
- [x] Task: Connect Context Presets storage to this panel [a3c8d4b]
|
||||
- [ ] Task: Update Persona editor to reference Context Composition presets (NOTE: already done via existing context_preset field in Persona)
|
||||
- [x] Task: Write tests for Context Composition preset save/load [a3c8d4b]
|
||||
- [x] Task: Conductor - User Manual Verification 'Phase 3: Context Composition Tab'
|
||||
|
||||
## Phase 4: Takes Timeline Integration
|
||||
## Phase 4: Takes Timeline Integration [checkpoint: cc6a651]
|
||||
Focus: DAW-style branching with proper visual timeline and synthesis
|
||||
|
||||
- [ ] Task: Audit existing takes data structure and synthesis_formatter
|
||||
- [ ] Task: Enhance takes data model with parent_entry and parent_take tracking
|
||||
- [ ] Task: Implement Branch from Entry action in discussion history
|
||||
- [ ] Task: Implement visual timeline showing take divergence
|
||||
- [ ] Task: Integrate synthesis panel into Takes tab
|
||||
- [ ] Task: Implement take selection for synthesis
|
||||
- [ ] Task: Write tests for take branching and synthesis
|
||||
- [ ] Task: Conductor - User Manual Verification 'Phase 4: Takes Timeline Integration'
|
||||
- [x] Task: Audit existing takes data structure and synthesis_formatter [documented above]
|
||||
- [ ] Task: Enhance takes data model with parent_entry and parent_take tracking (deferred - existing model sufficient)
|
||||
- [x] Task: Implement Branch from Entry action in discussion history [already existed]
|
||||
- [x] Task: Implement visual timeline showing take divergence [_render_takes_panel with table view]
|
||||
- [x] Task: Integrate synthesis panel into Takes tab [cc6a651]
|
||||
- [x] Task: Implement take selection for synthesis [cc6a651]
|
||||
- [x] Task: Write tests for take branching and synthesis [cc6a651]
|
||||
- [x] Task: Conductor - User Manual Verification 'Phase 4: Takes Timeline Integration'
|
||||
|
||||
## Phase 5: Final Integration & Cleanup
|
||||
Focus: Ensure all panels work together, remove dead code
|
||||
|
||||
111
src/gui_2.py
111
src/gui_2.py
@@ -728,13 +728,13 @@ class App:
|
||||
self._render_discussion_tab()
|
||||
imgui.end_tab_item()
|
||||
if imgui.begin_tab_item("Context Composition")[0]:
|
||||
self._render_context_composition_placeholder()
|
||||
self._render_context_composition_panel()
|
||||
imgui.end_tab_item()
|
||||
if imgui.begin_tab_item("Snapshot")[0]:
|
||||
self._render_snapshot_tab()
|
||||
imgui.end_tab_item()
|
||||
if imgui.begin_tab_item("Takes")[0]:
|
||||
self._render_takes_placeholder()
|
||||
self._render_takes_panel()
|
||||
imgui.end_tab_item()
|
||||
imgui.end_tab_bar()
|
||||
imgui.end()
|
||||
@@ -2085,10 +2085,57 @@ class App:
|
||||
else:
|
||||
imgui.text_disabled("Message & Response panels are detached.")
|
||||
|
||||
def _render_context_composition_placeholder(self) -> None:
|
||||
def _render_context_composition_panel(self) -> None:
|
||||
imgui.text("Context Composition")
|
||||
imgui.separator()
|
||||
imgui.text_colored(C_LBL, "Coming in Phase 3...")
|
||||
if imgui.begin_table("ctx_comp_table", 2, imgui.TableFlags_.resizable | imgui.TableFlags_.borders):
|
||||
imgui.table_setup_column("File", imgui.TableColumnFlags_.width_stretch)
|
||||
imgui.table_setup_column("Flags", imgui.TableColumnFlags_.width_fixed, 120)
|
||||
imgui.table_headers_row()
|
||||
for i, f_item in enumerate(self.files):
|
||||
imgui.table_next_row()
|
||||
imgui.table_set_column_index(0)
|
||||
imgui.text(f_item.path if hasattr(f_item, "path") else str(f_item))
|
||||
imgui.table_set_column_index(1)
|
||||
if hasattr(f_item, "auto_aggregate"):
|
||||
changed_agg, f_item.auto_aggregate = imgui.checkbox(f"Agg##cc{i}", f_item.auto_aggregate)
|
||||
imgui.same_line()
|
||||
changed_full, f_item.force_full = imgui.checkbox(f"Full##cc{i}", f_item.force_full)
|
||||
imgui.end_table()
|
||||
imgui.separator()
|
||||
imgui.text("Screenshots")
|
||||
for i, s in enumerate(self.screenshots):
|
||||
imgui.text(s)
|
||||
imgui.separator()
|
||||
imgui.text("Presets")
|
||||
presets = self.controller.project.get('context_presets', {})
|
||||
preset_names = [""] + sorted(presets.keys())
|
||||
active = getattr(self, "ui_active_context_preset", "")
|
||||
if active not in preset_names:
|
||||
active = ""
|
||||
try:
|
||||
idx = preset_names.index(active)
|
||||
except ValueError:
|
||||
idx = 0
|
||||
ch, new_idx = imgui.combo("##ctx_preset", idx, preset_names)
|
||||
if ch:
|
||||
self.ui_active_context_preset = preset_names[new_idx]
|
||||
if preset_names[new_idx]:
|
||||
self.load_context_preset(preset_names[new_idx])
|
||||
imgui.same_line()
|
||||
changed, new_name = imgui.input_text("##new_preset", getattr(self, "ui_new_context_preset_name", ""))
|
||||
if changed:
|
||||
self.ui_new_context_preset_name = new_name
|
||||
imgui.same_line()
|
||||
if imgui.button("Save##ctx"):
|
||||
if getattr(self, "ui_new_context_preset_name", "").strip():
|
||||
self.save_context_preset(self.ui_new_context_preset_name.strip())
|
||||
self.ui_new_context_preset_name = ""
|
||||
imgui.same_line()
|
||||
if imgui.button("Delete##ctx"):
|
||||
if getattr(self, "ui_active_context_preset", ""):
|
||||
self.delete_context_preset(self.ui_active_context_preset)
|
||||
self.ui_active_context_preset = ""
|
||||
|
||||
def _render_snapshot_tab(self) -> None:
|
||||
if imgui.begin_tab_bar("snapshot_tabs"):
|
||||
@@ -2128,11 +2175,61 @@ class App:
|
||||
imgui.end_tab_item()
|
||||
imgui.end_tab_bar()
|
||||
|
||||
def _render_takes_placeholder(self) -> None:
|
||||
def _render_takes_panel(self) -> None:
|
||||
imgui.text("Takes & Synthesis")
|
||||
imgui.separator()
|
||||
imgui.text_colored(C_LBL, "Coming in Phase 4...")
|
||||
|
||||
discussions = self.project.get('discussion', {}).get('discussions', {})
|
||||
if not hasattr(self, 'ui_synthesis_selected_takes'):
|
||||
self.ui_synthesis_selected_takes = {name: False for name in discussions}
|
||||
if not hasattr(self, 'ui_synthesis_prompt'):
|
||||
self.ui_synthesis_prompt = ""
|
||||
if imgui.begin_table("takes_table", 3, imgui.TableFlags_.resizable | imgui.TableFlags_.borders):
|
||||
imgui.table_setup_column("Name", imgui.TableColumnFlags_.width_stretch)
|
||||
imgui.table_setup_column("Entries", imgui.TableColumnFlags_.width_fixed, 80)
|
||||
imgui.table_setup_column("Actions", imgui.TableColumnFlags_.width_fixed, 150)
|
||||
imgui.table_headers_row()
|
||||
for name, disc in discussions.items():
|
||||
imgui.table_next_row()
|
||||
imgui.table_set_column_index(0)
|
||||
is_active = name == self.active_discussion
|
||||
if is_active:
|
||||
imgui.text_colored(C_IN, name)
|
||||
else:
|
||||
imgui.text(name)
|
||||
imgui.table_set_column_index(1)
|
||||
history = disc.get('history', [])
|
||||
imgui.text(f"{len(history)}")
|
||||
imgui.table_set_column_index(2)
|
||||
if imgui.button(f"Switch##{name}"):
|
||||
self._switch_discussion(name)
|
||||
imgui.same_line()
|
||||
if name != "main" and imgui.button(f"Delete##{name}"):
|
||||
del discussions[name]
|
||||
imgui.end_table()
|
||||
imgui.separator()
|
||||
imgui.text("Synthesis")
|
||||
imgui.text("Select takes to synthesize:")
|
||||
for name in discussions:
|
||||
_, self.ui_synthesis_selected_takes[name] = imgui.checkbox(name, self.ui_synthesis_selected_takes.get(name, False))
|
||||
imgui.spacing()
|
||||
imgui.text("Synthesis Prompt:")
|
||||
_, self.ui_synthesis_prompt = imgui.input_text_multiline("##synthesis_prompt", self.ui_synthesis_prompt, imgui.ImVec2(-1, 100))
|
||||
if imgui.button("Generate Synthesis"):
|
||||
selected = [name for name, sel in self.ui_synthesis_selected_takes.items() if sel]
|
||||
if len(selected) > 1:
|
||||
from src import synthesis_formatter
|
||||
takes_dict = {name: discussions.get(name, {}).get('history', []) for name in selected}
|
||||
diff_text = synthesis_formatter.format_takes_diff(takes_dict)
|
||||
prompt = f"{self.ui_synthesis_prompt}\n\nHere are the variations:\n{diff_text}"
|
||||
new_name = "synthesis_take"
|
||||
counter = 1
|
||||
while new_name in discussions:
|
||||
new_name = f"synthesis_take_{counter}"
|
||||
counter += 1
|
||||
self._create_discussion(new_name)
|
||||
with self._disc_entries_lock:
|
||||
self.disc_entries.append({"role": "user", "content": prompt, "collapsed": False, "ts": project_manager.now_ts()})
|
||||
self._handle_generate_send()
|
||||
def _render_markdown_test(self) -> None:
|
||||
imgui.text("Markdown Test Panel")
|
||||
imgui.separator()
|
||||
|
||||
42
tests/test_context_composition_panel.py
Normal file
42
tests/test_context_composition_panel.py
Normal file
@@ -0,0 +1,42 @@
|
||||
import pytest
|
||||
import inspect
|
||||
|
||||
|
||||
def test_context_composition_panel_replaces_placeholder():
|
||||
import src.gui_2 as gui_2
|
||||
|
||||
source = inspect.getsource(gui_2.App._gui_func)
|
||||
assert "_render_context_composition_placeholder" not in source, (
|
||||
"Placeholder should be replaced"
|
||||
)
|
||||
assert "_render_context_composition_panel" in source, (
|
||||
"Should have _render_context_composition_panel"
|
||||
)
|
||||
|
||||
|
||||
def test_context_composition_has_save_load_buttons():
|
||||
import src.gui_2 as gui_2
|
||||
|
||||
source = inspect.getsource(gui_2.App._render_context_composition_panel)
|
||||
assert "Save as Preset" in source or "save" in source.lower(), (
|
||||
"Should have Save functionality"
|
||||
)
|
||||
assert "Load Preset" in source or "load" in source.lower(), (
|
||||
"Should have Load functionality"
|
||||
)
|
||||
|
||||
|
||||
def test_context_composition_shows_files():
|
||||
import src.gui_2 as gui_2
|
||||
|
||||
source = inspect.getsource(gui_2.App._render_context_composition_panel)
|
||||
assert "files" in source.lower() or "Files" in source, "Should show files"
|
||||
|
||||
|
||||
def test_context_composition_has_preset_list():
|
||||
import src.gui_2 as gui_2
|
||||
|
||||
source = inspect.getsource(gui_2.App._render_context_composition_panel)
|
||||
assert "context_presets" in source or "preset" in source.lower(), (
|
||||
"Should reference presets"
|
||||
)
|
||||
16
tests/test_takes_panel.py
Normal file
16
tests/test_takes_panel.py
Normal file
@@ -0,0 +1,16 @@
|
||||
import pytest
|
||||
import inspect
|
||||
|
||||
|
||||
def test_takes_tab_replaces_placeholder():
|
||||
import src.gui_2 as gui_2
|
||||
|
||||
source = inspect.getsource(gui_2.App._gui_func)
|
||||
assert "_render_takes_placeholder" not in source, "Placeholder should be replaced"
|
||||
|
||||
|
||||
def test_takes_panel_has_synthesis():
|
||||
import src.gui_2 as gui_2
|
||||
|
||||
source = inspect.getsource(gui_2.App._render_takes_panel)
|
||||
assert "synthesis" in source.lower(), "Should have synthesis functionality"
|
||||
Reference in New Issue
Block a user