feat(ui): Enhanced context control with per-file flags and Gemini cache awareness
This commit is contained in:
52
src/gui_2.py
52
src/gui_2.py
@@ -774,7 +774,14 @@ class App:
|
||||
imgui.separator()
|
||||
if imgui.button("Inject", imgui.ImVec2(120, 0)):
|
||||
formatted = f"## File: {self._inject_file_path}\n```python\n{self._inject_preview}\n```\n"
|
||||
self.ui_ai_input += formatted
|
||||
with self._disc_entries_lock:
|
||||
self.disc_entries.append({
|
||||
"role": "Context",
|
||||
"content": formatted,
|
||||
"collapsed": True,
|
||||
"ts": project_manager.now_ts()
|
||||
})
|
||||
self._scroll_disc_to_bottom = True
|
||||
imgui.close_current_popup()
|
||||
imgui.same_line()
|
||||
if imgui.button("Cancel", imgui.ImVec2(120, 0)):
|
||||
@@ -1075,25 +1082,52 @@ class App:
|
||||
imgui.separator()
|
||||
imgui.text("Paths")
|
||||
imgui.begin_child("f_paths", imgui.ImVec2(0, -40), True)
|
||||
for i, f in enumerate(self.files):
|
||||
if imgui.button(f"x##f{i}"):
|
||||
self.files.pop(i)
|
||||
break
|
||||
imgui.same_line()
|
||||
imgui.text(f)
|
||||
if imgui.begin_table("files_table", 4, imgui.TableFlags_.resizable | imgui.TableFlags_.borders):
|
||||
imgui.table_setup_column("Actions", imgui.TableColumnFlags_.width_fixed, 40)
|
||||
imgui.table_setup_column("File Path", imgui.TableColumnFlags_.width_stretch)
|
||||
imgui.table_setup_column("Flags", imgui.TableColumnFlags_.width_fixed, 150)
|
||||
imgui.table_setup_column("Cache", imgui.TableColumnFlags_.width_fixed, 40)
|
||||
imgui.table_headers_row()
|
||||
|
||||
for i, f_item in enumerate(self.files):
|
||||
imgui.table_next_row()
|
||||
# Actions
|
||||
imgui.table_set_column_index(0)
|
||||
if imgui.button(f"x##f{i}"):
|
||||
self.files.pop(i)
|
||||
break
|
||||
# File Path
|
||||
imgui.table_set_column_index(1)
|
||||
imgui.text(f_item.path if hasattr(f_item, "path") else str(f_item))
|
||||
# Flags
|
||||
imgui.table_set_column_index(2)
|
||||
if hasattr(f_item, "auto_aggregate"):
|
||||
changed_agg, f_item.auto_aggregate = imgui.checkbox(f"Agg##a{i}", f_item.auto_aggregate)
|
||||
imgui.same_line()
|
||||
changed_full, f_item.force_full = imgui.checkbox(f"Full##f{i}", f_item.force_full)
|
||||
# Cache
|
||||
imgui.table_set_column_index(3)
|
||||
path = f_item.path if hasattr(f_item, "path") else str(f_item)
|
||||
is_cached = any(path in c for c in getattr(self, "_cached_files", []))
|
||||
if is_cached:
|
||||
imgui.text_colored("●", imgui.ImVec4(0, 1, 0, 1)) # Green dot
|
||||
else:
|
||||
imgui.text_disabled("○")
|
||||
imgui.end_table()
|
||||
imgui.end_child()
|
||||
if imgui.button("Add File(s)"):
|
||||
r = hide_tk_root()
|
||||
paths = filedialog.askopenfilenames()
|
||||
r.destroy()
|
||||
for p in paths:
|
||||
if p not in self.files: self.files.append(p)
|
||||
if p not in [f.path if hasattr(f, "path") else f for f in self.files]:
|
||||
self.files.append(models.FileItem(path=p))
|
||||
imgui.same_line()
|
||||
if imgui.button("Add Wildcard"):
|
||||
r = hide_tk_root()
|
||||
d = filedialog.askdirectory()
|
||||
r.destroy()
|
||||
if d: self.files.append(str(Path(d) / "**" / "*"))
|
||||
if d: self.files.append(models.FileItem(path=str(Path(d) / "**" / "*")))
|
||||
|
||||
def _render_screenshots_panel(self) -> None:
|
||||
imgui.text("Base Dir")
|
||||
|
||||
Reference in New Issue
Block a user