This commit is contained in:
kim committed 2026-04-29 22:23:08 +09:00
1 parent 10eb7405bc
commit d89d7213f6
92 files changed
+380 -173

No files matched your search

+9 -1
View File
@@ -17,7 +17,15 @@
"Bash(unzip -l 양_갤러리_프레젠테이션.pptx)",
"Bash(cd /d D:\\\\smallclaw\\\\workspace\\\\양_갤러리_프레젠테이션)",
"Bash(powershell -Command \"Expand-Archive -Path '양_갤러리_프레젠테이션.pptx' -DestinationPath 'pptx_extracted' -Force\")",
"Bash(powershell *)"
"Bash(powershell *)",
"Bash(unzip -l 강아지_사진.pptx)",
"Bash(unzip -l \"workspace/강아지_사진/강아지_사진.pptx\")",
"Bash(unzip -l \"./강아지_사진.pptx\")",
"Bash(python3 *)",
"Bash(unzip -l \"./workspace/고양이_사진/고양이_사진.pptx\")",
"Bash(pip list *)",
"Bash(/c/Users/kimsg/anaconda3/python scripts/pptx_gen.py --help)",
"Bash(npm run *)"
]
}
}
+7
View File
@@ -41,3 +41,10 @@ OPENAI_API_KEY=
# No key needed – SmallClaw handles the OAuth flow.
# Mount your .smallclaw dir (see docker-compose.yml) so tokens persist.
# CODEX_MODEL=gpt-5.3-codex
# ── Image search for PPTX creation ──────────────────────────
# At least one of these is needed for image_search on slides.
# Unsplash: https://unsplash.com/developers (free: 50 req/hour)
# UNSPLASH_ACCESS_KEY=
# Pexels: https://www.pexels.com/api/ (free: 200 req/hour)
# PEXELS_API_KEY=
Binary file not shown.
Binary file not shown.
+62 -20
View File
@@ -96,6 +96,12 @@ DEFAULT_FONT_SIZES = {
SLIDE_W = Inches(13.333)
SLIDE_H = Inches(7.5)
# Layout constants for two-column slides (text + image)
L_MARGIN = Inches(0.6) # left margin (aligns with title)
R_MARGIN = Inches(0.3) # right margin
COL_GAP = Inches(0.3) # gap between text and image columns
CONTENT_W = SLIDE_W - L_MARGIN - R_MARGIN # ~12.43"
# Dark skin names — slides with these backgrounds use light text
DARK_SKINS = {
'Cave', 'Deep Sea', 'Dream', 'Galaxy', 'Imagination', 'Metal', 'Space', 'Universe',
@@ -221,13 +227,12 @@ def is_dark_skin(name):
# ─── Helpers ────────────────────────────────────────────────────────────────────
def slugify(text: str) -> str:
"""Convert a title to a safe folder name."""
"""Convert a title to a safe folder name (matches TypeScript projectSlug logic)."""
s = str(text or "presentation").strip()
s = re.sub(r"\.pptx$", "", s, flags=re.IGNORECASE)
s = re.sub(r'[\(\)<>:"/\\|?*]+', "_", s)
s = re.sub(r"\s+", "_", s)
s = re.sub(r'[^a-zA-Z0-9ㄱ-힣_\-]', "_", s)
s = re.sub(r"_+", "_", s)
s = s.strip("_")
s = s.strip("_").lower()
return s[:60] or "presentation"
@@ -327,6 +332,9 @@ def fit_dimensions(img_w, img_h, max_w, max_h, mode="contain"):
mode='contain': fit entirely within max_w × max_h (default, no cropping)
mode='cover': fill max_w × max_h completely, cropping if necessary
"""
# Leave a small breathing margin inside the bounding box
max_w = int(max_w * 0.95)
max_h = int(max_h * 0.95)
if img_w <= 0 or img_h <= 0:
return max_w, max_h
ratio = img_w / img_h
@@ -471,6 +479,33 @@ def resolve_image_path(image_path: str, project_dir: str, workspace_path: str) -
return candidates[0] # return first even if missing (placeholder will show)
# ─── Auto Layout Helpers ────────────────────────────────────────────────────────
def _text_weight(slide_spec: dict):
"""Return (bullet_count, total_chars) for the text content of a slide."""
bullets = slide_spec.get("bullets") or slide_spec.get("bullet_points") or []
body = slide_spec.get("body") or slide_spec.get("content") or ""
if bullets:
return len(bullets), sum(len(str(b)) for b in bullets)
return (1 if body else 0), len(body)
def _auto_text_ratio(slide_spec: dict) -> float:
"""Compute text column share (0–1) based on content volume.
≤2 bullets / ≤120 chars → 0.38 image-dominant
3–4 bullets / ≤280 chars → 0.50 balanced
5+ bullets / >280 chars → 0.62 text-dominant
"""
n_bullets, n_chars = _text_weight(slide_spec)
if n_bullets <= 2 and n_chars <= 120:
return 0.38
elif n_bullets <= 4 and n_chars <= 280:
return 0.50
else:
return 0.62
# ─── Slide Generators ──────────────────────────────────────────────────────────
def make_title_slide(prs, slide_spec, spec, colors, is_dark, fs, bg_image=None):
@@ -520,42 +555,49 @@ def make_content_slide(prs, slide_spec, project_dir, workspace_path, colors, is_
set_slide_bg(slide, colors["background"])
has_title = bool(slide_spec.get("title"))
has_image = bool(slide_spec.get("image_path"))
content_y = Inches(1.5) if has_title else Inches(0.5)
content_h = SLIDE_H - content_y - Inches(0.3)
if has_title:
add_text_box(slide, Inches(0.6), Inches(0.4), Inches(12.1), Inches(0.8),
add_text_box(slide, L_MARGIN, Inches(0.4), SLIDE_W - L_MARGIN - R_MARGIN, Inches(0.8),
slide_spec["title"], font_size=Pt(fs["slide_title"]),
color_hex=colors["title"], bold=True)
# Accent underline
add_shape_rect(slide, Inches(0.6), Inches(1.15), Inches(2), Inches(0.04),
add_shape_rect(slide, L_MARGIN, Inches(1.15), Inches(2), Inches(0.04),
colors["accent"])
# Get bullet items (check aliases)
# ── Two-column layout when image present ──────────────────────────────────
if has_image:
text_ratio = _auto_text_ratio(slide_spec)
text_col_w = CONTENT_W * text_ratio - COL_GAP / 2
img_col_x = L_MARGIN + text_col_w + COL_GAP
img_col_w = CONTENT_W * (1 - text_ratio) - COL_GAP / 2
else:
text_col_w = CONTENT_W
img_col_x = None
img_col_w = None
# ── Text content ──────────────────────────────────────────────────────────
bullet_items = slide_spec.get("bullets") or slide_spec.get("bullet_points")
body_text = slide_spec.get("body") or slide_spec.get("content")
# Per-slide font_size override
override = slide_spec.get("font_size")
body_fs = Pt(override) if override else Pt(fs["body"])
body_fs = Pt(override) if override else Pt(fs["body"])
bullet_fs = Pt(override) if override else Pt(fs["bullets"])
if bullet_items and len(bullet_items) > 0:
add_bullet_list(slide, Inches(0.8), content_y, Inches(11.7), Inches(5),
add_bullet_list(slide, L_MARGIN, content_y, text_col_w, content_h,
bullet_items, font_size=bullet_fs,
color_hex=colors["body"],
bullet_color_hex=colors["accent"])
elif body_text:
add_text_box(slide, Inches(0.8), content_y, Inches(11.7), Inches(5),
add_text_box(slide, L_MARGIN, content_y, text_col_w, content_h,
body_text, font_size=body_fs, color_hex=colors["body"])
# Image on content slide (right side)
image_path = slide_spec.get("image_path")
if image_path:
resolved = resolve_image_path(image_path, project_dir, workspace_path)
img_y = Inches(1.5) if has_title else Inches(0.5)
img_max_h = Inches(5) if has_title else Inches(6)
# ── Image column ──────────────────────────────────────────────────────────
if has_image:
resolved = resolve_image_path(slide_spec["image_path"], project_dir, workspace_path)
add_image_or_placeholder(slide, resolved,
Inches(7), img_y, Inches(5.5), img_max_h,
img_col_x, content_y, img_col_w, content_h,
warnings, color_hex=colors["body"])
return slide
+6
View File
@@ -267,6 +267,8 @@ def generate_card_preview(pptx_path: str, output_dir: str) -> list:
is_section = "section" in layout_name
# Extract text and images from slide
slide_w = prs.slide_width or 1
slide_h = prs.slide_height or 1
texts = []
slide_images = []
for shape in slide.shapes:
@@ -276,7 +278,11 @@ def generate_card_preview(pptx_path: str, output_dir: str) -> list:
if text:
texts.append(text)
# Extract embedded images (PICTURE shape_type == 13)
# Skip full-slide background images (skin/wallpaper covers ≥90% of slide)
if shape.shape_type == 13:
is_bg = (shape.width >= slide_w * 0.9 and shape.height >= slide_h * 0.9)
if is_bg:
continue
try:
image = shape.image
pil_img = PILImage.open(io.BytesIO(image.blob))
+1
View File
@@ -1,5 +1,6 @@
#!/usr/bin/env node
import 'dotenv/config';
import { Command } from 'commander';
import fs from 'fs';
import path from 'path';
+4
View File
@@ -160,6 +160,8 @@ export const DEFAULT_CONFIG: SmallClawConfig = {
engine: 'python',
template: 'business',
skin: '',
unsplash_key: process.env.UNSPLASH_ACCESS_KEY ? `env:UNSPLASH_ACCESS_KEY` : '',
pexels_key: process.env.PEXELS_API_KEY ? `env:PEXELS_API_KEY` : '',
},
heartbeat: {
enabled: true,
@@ -293,6 +295,8 @@ const SECRET_FIELD_MAP: Array<[string[], string]> = [
[['llm', 'providers', 'openai', 'api_key'], 'llm.openai.api_key'],
[['llm', 'providers', 'lm_studio', 'api_key'], 'llm.lm_studio.api_key'],
[['hooks', 'token'], 'hooks.token'],
[['ppt', 'unsplash_key'], 'ppt.unsplash_key'],
[['ppt', 'pexels_key'], 'ppt.pexels_key'],
];
function deepGet(obj: any, keys: string[]): string | undefined {
+1
View File
@@ -7,6 +7,7 @@
* Logging: Daily session logs in memory/
*/
import 'dotenv/config';
import express from 'express';
import cors from 'cors';
import http from 'http';
+98 -152
View File
@@ -272,172 +272,108 @@ async function downloadImageByUrl(url: string, dest: string): Promise<boolean> {
}
}
async function browserSearchImage(query: string, sendSSE?: SSESender): Promise<string | null> {
// Use Playwright to search Google Images and extract the first good image URL
sendSSE?.('info', { message: `🔍 Browser: searching Google Images for "${query}"...` });
let pw: any = null;
let browser: any = null;
let context: any = null;
let page: any = null;
async function searchUnsplash(query: string, accessKey: string): Promise<string | null> {
const url = `https://api.unsplash.com/search/photos?query=${encodeURIComponent(query)}&per_page=3&orientation=landscape`;
try {
pw = await (Function('return import("playwright")')() as Promise<any>);
const chromePaths: (string | undefined)[] = [
process.env.CHROME_PATH,
process.platform === 'win32' ? 'C:\\Program Files\\Google\\Chrome\\Application\\chrome.exe' : undefined,
process.platform === 'win32' ? 'C:\\Program Files (x86)\\Google\\Chrome\\Application\\chrome.exe' : undefined,
process.platform === 'darwin' ? '/Applications/Google Chrome.app/Contents/MacOS/Google Chrome' : undefined,
process.platform === 'linux' ? '/usr/bin/google-chrome' : undefined,
];
const fsSync = await import('fs');
const chromePath = chromePaths.find((p): p is string => !!p && fsSync.existsSync(p));
if (chromePath) {
browser = await pw.chromium.launch({
executablePath: chromePath,
headless: true,
args: ['--no-sandbox', '--disable-gpu', '--disable-dev-shm-usage', '--disable-extensions'],
});
} else {
browser = await pw.chromium.launch({ headless: true });
}
context = await browser.newContext({
userAgent: 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/131.0.0.0 Safari/537.36',
viewport: { width: 1280, height: 800 },
const controller = new AbortController();
const timeout = setTimeout(() => controller.abort(), 10000);
const resp = await fetch(url, {
headers: { 'Authorization': `Client-ID ${accessKey}` },
signal: controller.signal,
});
page = await context.newPage();
const searchUrl = `https://www.google.com/search?q=${encodeURIComponent(query)}&tbm=isch&udm=2`;
await page.goto(searchUrl, { waitUntil: 'domcontentloaded', timeout: 15000 });
await page.waitForTimeout(2000);
// Extract image URLs from Google Images results
const imageUrls: string[] = await page.evaluate(() => {
const results: string[] = [];
const doc = (globalThis as any).document;
const imgs: any[] = Array.from(doc.querySelectorAll('img[src], img[data-src]'));
for (const img of imgs) {
const src: string = img.getAttribute('data-src') || img.getAttribute('src') || '';
if (!src || src.startsWith('data:') || src.startsWith('about:')) continue;
const w = Number(img.getAttribute('width') || img.naturalWidth || 0);
const h = Number(img.getAttribute('height') || img.naturalHeight || 0);
if (w > 0 && w < 80 && h > 0 && h < 80) continue;
results.push(src);
if (results.length >= 5) break;
}
return results;
});
if (imageUrls.length > 0) {
console.log(`[pptx] Browser found ${imageUrls.length} image(s) for "${query}"`);
sendSSE?.('info', { message: `🔍 Browser: found ${imageUrls.length} image(s) for "${query}"` });
return imageUrls[0];
clearTimeout(timeout);
if (!resp.ok) {
console.log(`[pptx] Unsplash: HTTP ${resp.status} for "${query}"`);
return null;
}
sendSSE?.('info', { message: `🔍 Browser: no images found for "${query}"` });
return null;
const data = await resp.json() as any;
const photo = data?.results?.[0];
const imageUrl = photo?.urls?.regular || photo?.urls?.full || null;
console.log(`[pptx] Unsplash: ${data?.results?.length ?? 0} results for "${query}", url=${imageUrl?.slice(0, 80) ?? 'none'}`);
return imageUrl;
} catch (e: any) {
console.log(`[pptx] Browser image search failed: ${e.message}`);
sendSSE?.('info', { message: `🔍 Browser search failed: ${e.message}` });
console.log(`[pptx] Unsplash error for "${query}": ${e.message}`);
return null;
} finally {
try { await page?.close(); } catch {}
try { await context?.close(); } catch {}
try { await browser?.close(); } catch {}
}
}
const FREE_IMAGE_APIS = [
{
name: 'pixabay',
buildUrl: (q: string) => `https://pixabay.com/api/?key=46657496-7b3b3b3b3b3b3b3b3b3b3b3b&q=${encodeURIComponent(q)}&image_type=photo&per_page=3&safesearch=true`,
extractUrl: (data: any) => data?.hits?.[0]?.largeImageURL || data?.hits?.[0]?.webformatURL || '',
},
{
name: 'picsum',
buildUrl: (q: string) => `https://picsum.photos/1200/800`,
extractUrl: (_data: any) => 'https://picsum.photos/1200/800',
},
];
async function searchPexels(query: string, apiKey: string): Promise<string | null> {
const url = `https://api.pexels.com/v1/search?query=${encodeURIComponent(query)}&per_page=3&orientation=landscape`;
try {
const controller = new AbortController();
const timeout = setTimeout(() => controller.abort(), 10000);
const resp = await fetch(url, {
headers: { 'Authorization': apiKey },
signal: controller.signal,
});
clearTimeout(timeout);
if (!resp.ok) {
console.log(`[pptx] Pexels: HTTP ${resp.status} for "${query}"`);
return null;
}
const data = await resp.json() as any;
const photo = data?.photos?.[0];
const imageUrl = photo?.src?.large2x || photo?.src?.large || photo?.src?.original || null;
console.log(`[pptx] Pexels: ${data?.photos?.length ?? 0} results for "${query}", url=${imageUrl?.slice(0, 80) ?? 'none'}`);
return imageUrl;
} catch (e: any) {
console.log(`[pptx] Pexels error for "${query}": ${e.message}`);
return null;
}
}
async function searchAndDownloadImage(query: string, projectDir: string, slideIndex: number, sendSSE?: SSESender): Promise<string | null> {
console.log(`[pptx] searchAndDownloadImage: slide ${slideIndex + 1}, query="${query}", dir=${projectDir}`);
async function searchAndDownloadImage(
query: string,
projectDir: string,
slideIndex: number,
sendSSE?: SSESender,
unsplashKey?: string,
pexelsKey?: string,
): Promise<string | null> {
console.log(`[pptx] searchAndDownloadImage: slide ${slideIndex + 1}, query="${query}"`);
sendSSE?.('info', { message: `🖼 Slide ${slideIndex + 1}: searching for "${query}"...` });
// Strategy 1: Browser search (most reliable — handles JS, anti-bot, etc.)
const browserUrl = await browserSearchImage(query, sendSSE);
if (browserUrl) {
const ext = browserUrl.match(/\.(png|webp|gif)/i) ? '.png' : '.jpg';
const fname = `slide${slideIndex + 1}_image${ext}`;
const dest = path.join(projectDir, fname);
sendSSE?.('info', { message: `📥 Slide ${slideIndex + 1}: downloading from browser result...` });
if (await downloadImageByUrl(browserUrl, dest)) {
console.log(`[pptx] searchAndDownloadImage: slide ${slideIndex + 1} browser OK, fname=${fname}`);
sendSSE?.('info', { message: `✅ Slide ${slideIndex + 1}: image downloaded (browser)` });
return fname;
}
console.log(`[pptx] searchAndDownloadImage: slide ${slideIndex + 1} browser download failed`);
sendSSE?.('info', { message: `⚠️ Slide ${slideIndex + 1}: browser download failed, trying API...` });
}
const fname = `slide${slideIndex + 1}_image.jpg`;
const dest = path.join(projectDir, fname);
// Strategy 2: Free image APIs (Pixabay, Picsum)
for (const api of FREE_IMAGE_APIS) {
try {
if (api.name === 'picsum') {
sendSSE?.('info', { message: `📥 Slide ${slideIndex + 1}: trying random image (picsum)...` });
const url = api.buildUrl(query);
const fname = `slide${slideIndex + 1}_image.jpg`;
const dest = path.join(projectDir, fname);
if (await downloadImageByUrl(url, dest)) {
console.log(`[pptx] searchAndDownloadImage: slide ${slideIndex + 1} picsum OK`);
sendSSE?.('info', { message: `✅ Slide ${slideIndex + 1}: image downloaded (picsum)` });
return fname;
}
console.log(`[pptx] searchAndDownloadImage: slide ${slideIndex + 1} picsum failed`);
sendSSE?.('info', { message: `⚠️ Slide ${slideIndex + 1}: picsum download failed` });
continue;
}
sendSSE?.('info', { message: `🔍 Slide ${slideIndex + 1}: searching ${api.name}...` });
const url = api.buildUrl(query);
const controller = new AbortController();
const timeout = setTimeout(() => controller.abort(), 10000);
const resp = await fetch(url, {
headers: { 'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36' },
signal: controller.signal,
});
clearTimeout(timeout);
if (!resp.ok) {
sendSSE?.('info', { message: `⚠️ ${api.name}: HTTP ${resp.status}` });
continue;
}
const data = await resp.json();
const imageUrl = api.extractUrl(data);
if (!imageUrl) {
sendSSE?.('info', { message: `⚠️ ${api.name}: no results for "${query}"` });
continue;
}
const ext = imageUrl.match(/\.(png|webp|gif)/i) ? '.png' : '.jpg';
const fname = `slide${slideIndex + 1}_image${ext}`;
const dest = path.join(projectDir, fname);
sendSSE?.('info', { message: `📥 Slide ${slideIndex + 1}: downloading from ${api.name}...` });
// Strategy 1: Pexels (200 req/hour — primary)
if (pexelsKey) {
sendSSE?.('info', { message: `🔍 Slide ${slideIndex + 1}: searching Pexels...` });
const imageUrl = await searchPexels(query, pexelsKey);
if (imageUrl) {
sendSSE?.('info', { message: `📥 Slide ${slideIndex + 1}: downloading from Pexels...` });
if (await downloadImageByUrl(imageUrl, dest)) {
console.log(`[pptx] searchAndDownloadImage: slide ${slideIndex + 1} ${api.name} OK, fname=${fname}`);
sendSSE?.('info', { message: `✅ Slide ${slideIndex + 1}: image downloaded (${api.name})` });
console.log(`[pptx] slide ${slideIndex + 1}: Pexels OK`);
sendSSE?.('info', { message: `✅ Slide ${slideIndex + 1}: image ready (Pexels)` });
return fname;
}
console.log(`[pptx] searchAndDownloadImage: slide ${slideIndex + 1} ${api.name} download failed`);
sendSSE?.('info', { message: `⚠️ Slide ${slideIndex + 1}: ${api.name} download failed` });
} catch (e: any) {
console.log(`[pptx] ${api.name} search failed for "${query}": ${e.message}`);
sendSSE?.('info', { message: `⚠️ ${api.name} error: ${e.message.slice(0, 60)}` });
continue;
}
console.log(`[pptx] slide ${slideIndex + 1}: Pexels failed for "${query}"`);
sendSSE?.('info', { message: `⚠️ Slide ${slideIndex + 1}: Pexels failed` });
}
sendSSE?.('info', { message: `❌ Slide ${slideIndex + 1}: all sources failed for "${query}"` });
console.log(`[pptx] All image sources failed for "${query}" on slide ${slideIndex + 1}`);
// Strategy 2: Unsplash (50 req/hour — fallback)
if (unsplashKey) {
sendSSE?.('info', { message: `🔍 Slide ${slideIndex + 1}: searching Unsplash...` });
const imageUrl = await searchUnsplash(query, unsplashKey);
if (imageUrl) {
sendSSE?.('info', { message: `📥 Slide ${slideIndex + 1}: downloading from Unsplash...` });
if (await downloadImageByUrl(imageUrl, dest)) {
console.log(`[pptx] slide ${slideIndex + 1}: Unsplash OK`);
sendSSE?.('info', { message: `✅ Slide ${slideIndex + 1}: image ready (Unsplash)` });
return fname;
}
}
console.log(`[pptx] slide ${slideIndex + 1}: Unsplash failed for "${query}"`);
sendSSE?.('info', { message: `⚠️ Slide ${slideIndex + 1}: Unsplash failed` });
}
if (!unsplashKey && !pexelsKey) {
sendSSE?.('info', { message: `⚠️ Slide ${slideIndex + 1}: no image API keys configured (set UNSPLASH_ACCESS_KEY or PEXELS_API_KEY)` });
console.log(`[pptx] slide ${slideIndex + 1}: no API keys for image search`);
} else {
sendSSE?.('info', { message: `❌ Slide ${slideIndex + 1}: all image sources failed for "${query}"` });
}
return null;
}
@@ -522,13 +458,18 @@ export const pptxTool: import('./registry.js').Tool = {
return { success: false, error: 'spec.slides must be a non-empty array' };
}
const config = getConfig().getConfig() as any;
const configMgr = getConfig();
const config = configMgr.getConfig() as any;
const workspacePath = args._workspacePath || config.workspace?.path || process.cwd();
// Inject config defaults into spec so Python engine can use them
if (!spec.template && config.ppt?.template) spec.template = config.ppt.template;
if (!spec.default_skin && config.ppt?.skin) spec.default_skin = config.ppt.skin;
// Resolve image API keys: env var > config (vault-resolved)
const unsplashKey = process.env.UNSPLASH_ACCESS_KEY || configMgr.resolveSecret(config.ppt?.unsplash_key) || '';
const pexelsKey = process.env.PEXELS_API_KEY || configMgr.resolveSecret(config.ppt?.pexels_key) || '';
// Fix deprecated/defunct image URLs before downloading
for (const slide of spec.slides) {
if (slide.image_url) {
@@ -552,7 +493,7 @@ export const pptxTool: import('./registry.js').Tool = {
// image_search takes priority
if (slide.image_search && !slide.image_path) {
const localPath = await searchAndDownloadImage(slide.image_search, projectDir, i, sendSSE);
const localPath = await searchAndDownloadImage(slide.image_search, projectDir, i, sendSSE, unsplashKey, pexelsKey);
console.log(`[pptx] slide ${i + 1} image_search="${slide.image_search}" -> "${localPath}"`);
if (localPath) {
slide.image_path = localPath;
@@ -645,7 +586,8 @@ export const editPptxTool: import('./registry.js').Tool = {
return { success: false, error: 'path is required — provide the existing .pptx file path' };
}
const config = getConfig().getConfig() as any;
const configMgr = getConfig();
const config = configMgr.getConfig() as any;
const workspacePath = args._workspacePath || config.workspace?.path || process.cwd();
// Resolve absolute path
@@ -667,6 +609,10 @@ export const editPptxTool: import('./registry.js').Tool = {
return { success: false, error: 'spec.slides must be a non-empty array' };
}
// Resolve image API keys
const unsplashKey = process.env.UNSPLASH_ACCESS_KEY || configMgr.resolveSecret(config.ppt?.unsplash_key) || '';
const pexelsKey = process.env.PEXELS_API_KEY || configMgr.resolveSecret(config.ppt?.pexels_key) || '';
// Fix deprecated/defunct image URLs before downloading
for (const slide of spec.slides) {
if (slide.image_url) {
@@ -683,7 +629,7 @@ export const editPptxTool: import('./registry.js').Tool = {
// image_search takes priority
if (slide.image_search && !slide.image_path) {
const localPath = await searchAndDownloadImage(slide.image_search, editProjectDir, i, sendSSE);
const localPath = await searchAndDownloadImage(slide.image_search, editProjectDir, i, sendSSE, unsplashKey, pexelsKey);
if (localPath) {
slide.image_path = localPath;
}
+2
View File
@@ -287,6 +287,8 @@ export interface SmallClawConfig {
engine?: 'python';
template?: string;
skin?: string;
unsplash_key?: string;
pexels_key?: string;
};
heartbeat: {
enabled: boolean;
+7
View File
@@ -0,0 +1,7 @@
cgg70EFDE5B23YA0-IkfDVKef4FcKQJzkDVwp2QhnY0 -- acess key
ymuGrXh-pntJmXeRYGzZda7LvTqeCDlrGpF-27f5FrE -- secret key
938436 -- id
+15
View File
@@ -0,0 +1,15 @@
cgg70EFDE5B23YA0-IkfDVKef4FcKQJzkDVwp2QhnY0 -- acess key
ymuGrXh-pntJmXeRYGzZda7LvTqeCDlrGpF-27f5FrE -- secret key
938436 -- id
y7Fm3aGM9MlS9nq8ttsMEowcaCFRibFvxpp6ABg97ZupAoYNHWKSU5Z7 -- pexels
Binary file not shown.

After

Width:  |  Height:  |  Size: 141 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 258 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 267 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 91 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 269 KiB

@@ -0,0 +1,24 @@
<!DOCTYPE html>
<html lang="ko">
<head>
<meta charset="UTF-8">
<title>강아지 품종 가이드 (수정본) - 다운로드</title>
<style>
body { font-family: 'Malgun Gothic', sans-serif; max-width: 600px; margin: 60px auto; padding: 20px; text-align: center; background: #f8f9fa; }
.card { background: white; border-radius: 12px; padding: 40px 30px; box-shadow: 0 4px 20px rgba(0,0,0,0.08); }
h1 { color: #1a1a2e; font-size: 24px; margin-bottom: 10px; }
p { color: #5f6f86; margin-bottom: 30px; }
.btn { display: inline-block; background: #1668e3; color: white; text-decoration: none; padding: 14px 36px; border-radius: 8px; font-size: 16px; font-weight: bold; transition: background 0.2s; }
.btn:hover { background: #1255bb; }
.meta { margin-top: 20px; font-size: 12px; color: #888; }
</style>
</head>
<body>
<div class="card">
<h1>강아지 품종 가이드 (수정본)</h1>
<p>슬라이드 6장이 준비되었습니다.</p>
<a class="btn" href="강아지_품종_가이드_수정본.pptx" download>프레젠테이션 다운로드</a>
<div class="meta">D:\homeclaw\workspace\강아지_품종_가이드_수정본\강아지_품종_가이드_수정본.pptx</div>
</div>
</body>
</html>
Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 122 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 149 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 170 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 99 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 164 KiB

@@ -0,0 +1,24 @@
<!DOCTYPE html>
<html lang="ko">
<head>
<meta charset="UTF-8">
<title>강아지 품종 소개 - 다운로드</title>
<style>
body { font-family: 'Malgun Gothic', sans-serif; max-width: 600px; margin: 60px auto; padding: 20px; text-align: center; background: #f8f9fa; }
.card { background: white; border-radius: 12px; padding: 40px 30px; box-shadow: 0 4px 20px rgba(0,0,0,0.08); }
h1 { color: #1a1a2e; font-size: 24px; margin-bottom: 10px; }
p { color: #5f6f86; margin-bottom: 30px; }
.btn { display: inline-block; background: #1668e3; color: white; text-decoration: none; padding: 14px 36px; border-radius: 8px; font-size: 16px; font-weight: bold; transition: background 0.2s; }
.btn:hover { background: #1255bb; }
.meta { margin-top: 20px; font-size: 12px; color: #888; }
</style>
</head>
<body>
<div class="card">
<h1>강아지 품종 소개</h1>
<p>슬라이드 6장이 준비되었습니다.</p>
<a class="btn" href="강아지_품종_소개_v2.pptx" download>프레젠테이션 다운로드</a>
<div class="meta">D:\homeclaw\workspace\강아지_품종_소개\강아지_품종_소개_v2.pptx</div>
</div>
</body>
</html>
Binary file not shown.

After

Width:  |  Height:  |  Size: 9.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 113 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 140 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 159 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 90 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 141 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 258 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 267 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 91 KiB

@@ -0,0 +1,24 @@
<!DOCTYPE html>
<html lang="ko">
<head>
<meta charset="UTF-8">
<title>강아지 품종 소개 v4 - 다운로드</title>
<style>
body { font-family: 'Malgun Gothic', sans-serif; max-width: 600px; margin: 60px auto; padding: 20px; text-align: center; background: #f8f9fa; }
.card { background: white; border-radius: 12px; padding: 40px 30px; box-shadow: 0 4px 20px rgba(0,0,0,0.08); }
h1 { color: #1a1a2e; font-size: 24px; margin-bottom: 10px; }
p { color: #5f6f86; margin-bottom: 30px; }
.btn { display: inline-block; background: #1668e3; color: white; text-decoration: none; padding: 14px 36px; border-radius: 8px; font-size: 16px; font-weight: bold; transition: background 0.2s; }
.btn:hover { background: #1255bb; }
.meta { margin-top: 20px; font-size: 12px; color: #888; }
</style>
</head>
<body>
<div class="card">
<h1>강아지 품종 소개 v4</h1>
<p>슬라이드 6장이 준비되었습니다.</p>
<a class="btn" href="강아지_품종_소개_v4.pptx" download>프레젠테이션 다운로드</a>
<div class="meta">D:\homeclaw\workspace\강아지_품종_소개_v4\강아지_품종_소개_v4.pptx</div>
</div>
</body>
</html>
Binary file not shown.

After

Width:  |  Height:  |  Size: 142 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 258 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 257 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 265 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 185 KiB

@@ -0,0 +1,24 @@
<!DOCTYPE html>
<html lang="ko">
<head>
<meta charset="UTF-8">
<title>고양이 품종 소개 - 다운로드</title>
<style>
body { font-family: 'Malgun Gothic', sans-serif; max-width: 600px; margin: 60px auto; padding: 20px; text-align: center; background: #f8f9fa; }
.card { background: white; border-radius: 12px; padding: 40px 30px; box-shadow: 0 4px 20px rgba(0,0,0,0.08); }
h1 { color: #1a1a2e; font-size: 24px; margin-bottom: 10px; }
p { color: #5f6f86; margin-bottom: 30px; }
.btn { display: inline-block; background: #1668e3; color: white; text-decoration: none; padding: 14px 36px; border-radius: 8px; font-size: 16px; font-weight: bold; transition: background 0.2s; }
.btn:hover { background: #1255bb; }
.meta { margin-top: 20px; font-size: 12px; color: #888; }
</style>
</head>
<body>
<div class="card">
<h1>고양이 품종 소개</h1>
<p>슬라이드 6장이 준비되었습니다.</p>
<a class="btn" href="고양이_품종_소개.pptx" download>프레젠테이션 다운로드</a>
<div class="meta">D:\homeclaw\workspace\고양이_품종_소개\고양이_품종_소개.pptx</div>
</div>
</body>
</html>
Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 163 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 115 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 130 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 125 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 139 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 225 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 111 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 235 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 122 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 206 KiB

@@ -0,0 +1,24 @@
<!DOCTYPE html>
<html lang="ko">
<head>
<meta charset="UTF-8">
<title>고양이 품종 소개 확장판 - 다운로드</title>
<style>
body { font-family: 'Malgun Gothic', sans-serif; max-width: 600px; margin: 60px auto; padding: 20px; text-align: center; background: #f8f9fa; }
.card { background: white; border-radius: 12px; padding: 40px 30px; box-shadow: 0 4px 20px rgba(0,0,0,0.08); }
h1 { color: #1a1a2e; font-size: 24px; margin-bottom: 10px; }
p { color: #5f6f86; margin-bottom: 30px; }
.btn { display: inline-block; background: #1668e3; color: white; text-decoration: none; padding: 14px 36px; border-radius: 8px; font-size: 16px; font-weight: bold; transition: background 0.2s; }
.btn:hover { background: #1255bb; }
.meta { margin-top: 20px; font-size: 12px; color: #888; }
</style>
</head>
<body>
<div class="card">
<h1>고양이 품종 소개 확장판</h1>
<p>슬라이드 6장이 준비되었습니다.</p>
<a class="btn" href="고양이_품종_소개_확장판.pptx" download>프레젠테이션 다운로드</a>
<div class="meta">D:\homeclaw\workspace\고양이_품종_소개_확장판\고양이_품종_소개_확장판.pptx</div>
</div>
</body>
</html>
Binary file not shown.

After

Width:  |  Height:  |  Size: 221 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 109 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 232 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 120 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 216 KiB

@@ -0,0 +1,24 @@
<!DOCTYPE html>
<html lang="ko">
<head>
<meta charset="UTF-8">
<title>소나무 종류 소개 - 다운로드</title>
<style>
body { font-family: 'Malgun Gothic', sans-serif; max-width: 600px; margin: 60px auto; padding: 20px; text-align: center; background: #f8f9fa; }
.card { background: white; border-radius: 12px; padding: 40px 30px; box-shadow: 0 4px 20px rgba(0,0,0,0.08); }
h1 { color: #1a1a2e; font-size: 24px; margin-bottom: 10px; }
p { color: #5f6f86; margin-bottom: 30px; }
.btn { display: inline-block; background: #1668e3; color: white; text-decoration: none; padding: 14px 36px; border-radius: 8px; font-size: 16px; font-weight: bold; transition: background 0.2s; }
.btn:hover { background: #1255bb; }
.meta { margin-top: 20px; font-size: 12px; color: #888; }
</style>
</head>
<body>
<div class="card">
<h1>소나무 종류 소개</h1>
<p>슬라이드 6장이 준비되었습니다.</p>
<a class="btn" href="소나무_종류_소개.pptx" download>프레젠테이션 다운로드</a>
<div class="meta">D:\homeclaw\workspace\소나무_종류_소개\소나무_종류_소개.pptx</div>
</div>
</body>
</html>
Binary file not shown.

After

Width:  |  Height:  |  Size: 29 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 153 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 127 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 183 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 118 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 140 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 417 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 379 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 482 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 318 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 350 KiB

@@ -0,0 +1,24 @@
<!DOCTYPE html>
<html lang="ko">
<head>
<meta charset="UTF-8">
<title>양 품종 소개 presentation - 다운로드</title>
<style>
body { font-family: 'Malgun Gothic', sans-serif; max-width: 600px; margin: 60px auto; padding: 20px; text-align: center; background: #f8f9fa; }
.card { background: white; border-radius: 12px; padding: 40px 30px; box-shadow: 0 4px 20px rgba(0,0,0,0.08); }
h1 { color: #1a1a2e; font-size: 24px; margin-bottom: 10px; }
p { color: #5f6f86; margin-bottom: 30px; }
.btn { display: inline-block; background: #1668e3; color: white; text-decoration: none; padding: 14px 36px; border-radius: 8px; font-size: 16px; font-weight: bold; transition: background 0.2s; }
.btn:hover { background: #1255bb; }
.meta { margin-top: 20px; font-size: 12px; color: #888; }
</style>
</head>
<body>
<div class="card">
<h1>양 품종 소개 presentation</h1>
<p>슬라이드 6장이 준비되었습니다.</p>
<a class="btn" href="양_품종_소개_presentation.pptx" download>프레젠테이션 다운로드</a>
<div class="meta">D:\homeclaw\workspace\양_품종_소개_presentation\양_품종_소개_presentation.pptx</div>
</div>
</body>
</html>
Binary file not shown.

After

Width:  |  Height:  |  Size: 8.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 131 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 181 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 166 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 166 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 163 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 233 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 271 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 333 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 242 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 281 KiB