Spaces:
Paused
Paused
AI: Added metadata generation for implicitly created folders by AI tools
Browse files- index.html +1 -1
- src/ai/tools/filesystem-tool.js +16 -0
- test-folder.js +10 -0
index.html
CHANGED
|
@@ -51,7 +51,7 @@
|
|
| 51 |
</head>
|
| 52 |
<body class="dark-theme in-chat-view">
|
| 53 |
|
| 54 |
-
<div id="live-version-badge" style="position: fixed; top: 50px; left: 50%; transform: translateX(-50%); font-size: 10px; color: var(--text-secondary); opacity: 0.6; z-index: 99999; pointer-events: none; font-weight: 500; font-family: monospace; letter-spacing: 1px; background: rgba(0,0,0,0.2); padding: 2px 8px; border-radius: 10px; border: 1px solid rgba(255,255,255,0.05);">BUILD 1.3.
|
| 55 |
|
| 56 |
<!-- SVG Filters for Liquid Glass Refraction -->
|
| 57 |
<svg width="0" height="0" style="position: absolute; pointer-events: none;">
|
|
|
|
| 51 |
</head>
|
| 52 |
<body class="dark-theme in-chat-view">
|
| 53 |
|
| 54 |
+
<div id="live-version-badge" style="position: fixed; top: 50px; left: 50%; transform: translateX(-50%); font-size: 10px; color: var(--text-secondary); opacity: 0.6; z-index: 99999; pointer-events: none; font-weight: 500; font-family: monospace; letter-spacing: 1px; background: rgba(0,0,0,0.2); padding: 2px 8px; border-radius: 10px; border: 1px solid rgba(255,255,255,0.05);">BUILD 1.3.40</div>
|
| 55 |
|
| 56 |
<!-- SVG Filters for Liquid Glass Refraction -->
|
| 57 |
<svg width="0" height="0" style="position: absolute; pointer-events: none;">
|
src/ai/tools/filesystem-tool.js
CHANGED
|
@@ -132,6 +132,22 @@ export async function executeWriteLocalFile(args) {
|
|
| 132 |
const isPdf = args.path.toLowerCase().endsWith('.pdf');
|
| 133 |
let success = false;
|
| 134 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 135 |
if (isPdf) {
|
| 136 |
// Auto-convert Markdown to PDF
|
| 137 |
const html2pdf = await loadHtml2Pdf();
|
|
|
|
| 132 |
const isPdf = args.path.toLowerCase().endsWith('.pdf');
|
| 133 |
let success = false;
|
| 134 |
|
| 135 |
+
// Check if this involves a folder and generate metadata if it's new
|
| 136 |
+
const pathParts = args.path.split('/');
|
| 137 |
+
if (pathParts.length > 1) {
|
| 138 |
+
const folderPath = pathParts.slice(0, -1).join('/');
|
| 139 |
+
try {
|
| 140 |
+
const { db } = await import('../../db/database.js');
|
| 141 |
+
if (!db.getFolderMetadata(folderPath)) {
|
| 142 |
+
const { folderAgent } = await import('../folder-agent.js?v=2');
|
| 143 |
+
const visuals = await folderAgent.generateVisualsForFolder(folderPath);
|
| 144 |
+
db.saveFolderMetadata(folderPath, visuals.emoji, visuals.color);
|
| 145 |
+
}
|
| 146 |
+
} catch (err) {
|
| 147 |
+
console.error('Failed to generate metadata for AI created folder:', err);
|
| 148 |
+
}
|
| 149 |
+
}
|
| 150 |
+
|
| 151 |
if (isPdf) {
|
| 152 |
// Auto-convert Markdown to PDF
|
| 153 |
const html2pdf = await loadHtml2Pdf();
|
test-folder.js
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import { folderAgent } from './src/ai/folder-agent.js';
|
| 2 |
+
import { db } from './src/db/database.js';
|
| 3 |
+
|
| 4 |
+
async function test() {
|
| 5 |
+
await db.init();
|
| 6 |
+
const res = await folderAgent.generateVisualsForFolder('Astronomie');
|
| 7 |
+
console.log(res);
|
| 8 |
+
}
|
| 9 |
+
|
| 10 |
+
test();
|