Skip to content

Commit 9daeafa

Browse files
CopilotMte90
andcommitted
Fix project deletion and remove confusing prompt from FileWatcher
Co-authored-by: Mte90 <[email protected]>
1 parent a0f9678 commit 9daeafa

File tree

2 files changed

+28
-22
lines changed

2 files changed

+28
-22
lines changed

templates/index.html

Lines changed: 28 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -72,10 +72,7 @@ <h5 class="card-title">Projects</h5>
7272
</small>
7373
</div>
7474
<div>
75-
<form action="/projects/{{ p.id }}" method="post" style="display:inline;" onsubmit="return confirm('Delete this project and its database?');">
76-
<input type="hidden" name="_method" value="DELETE">
77-
<button type="submit" class="btn btn-sm btn-outline-danger">×</button>
78-
</form>
75+
<button type="button" class="btn btn-sm btn-outline-danger delete-project-btn" data-project-id="{{ p.id }}" title="Delete project">×</button>
7976
</div>
8077
</li>
8178
{% endfor %}
@@ -316,6 +313,33 @@ <h5 class="card-title">Chat</h5>
316313
}
317314
}, 3000);
318315

316+
// Handle project deletion
317+
document.addEventListener('click', async (e) => {
318+
if (e.target.classList.contains('delete-project-btn')) {
319+
const projectId = e.target.getAttribute('data-project-id');
320+
321+
if (!confirm('Delete this project and its database?')) {
322+
return;
323+
}
324+
325+
try {
326+
const response = await fetch(`/projects/${projectId}`, {
327+
method: 'DELETE'
328+
});
329+
330+
if (response.ok) {
331+
// Reload page to show updated project list
332+
window.location.reload();
333+
} else {
334+
const data = await response.json();
335+
alert(`Failed to delete project: ${data.error || 'Unknown error'}`);
336+
}
337+
} catch (err) {
338+
alert(`Error deleting project: ${err.message}`);
339+
}
340+
}
341+
});
342+
319343
// Initial render
320344
renderChat();
321345
</script>

utils/file_watcher.py

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -4,24 +4,6 @@
44
This module provides a background file watcher that monitors registered projects
55
for file system changes (new files, modifications, deletions) and can trigger
66
automatic re-indexing when changes are detected.
7-
8-
English Prompt for the File Watcher:
9-
You are a File System Monitor for PicoCode projects.
10-
11-
Your responsibilities:
12-
1. Watch all registered project directories for file system changes
13-
2. Detect new files, modified files, and deleted files
14-
3. Filter changes to only include relevant code files (exclude build artifacts, dependencies)
15-
4. Trigger incremental re-indexing when significant changes are detected
16-
5. Maintain a queue of pending changes to process efficiently
17-
6. Handle errors gracefully without crashing the watcher
18-
19-
Guidelines:
20-
- Use efficient file system monitoring (inotify on Linux, FSEvents on macOS, etc.)
21-
- Debounce rapid changes to avoid excessive indexing
22-
- Respect .gitignore patterns when monitoring
23-
- Run in a background thread without blocking the main application
24-
- Provide status information about monitored projects
257
"""
268

279
import os

0 commit comments

Comments
 (0)