mirror of
https://github.com/samsonjs/Peekaboo.git
synced 2026-03-25 09:25:47 +00:00
style: Fix linting errors
- Removed trailing spaces
- Added curly braces for if statement
🤖 Generated with Claude Code
Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
parent
14749414b0
commit
a10cbb59d5
3 changed files with 10 additions and 8 deletions
|
|
@ -31,7 +31,7 @@ export async function imageToolHandler(
|
|||
// Check if this is a screen capture
|
||||
const isScreenCapture = !input.app_target || input.app_target.startsWith("screen:");
|
||||
let formatWarning: string | undefined;
|
||||
|
||||
|
||||
// Validate format - if invalid, fall back to PNG
|
||||
const validFormats = ["png", "jpg", "data"];
|
||||
let effectiveFormat = input.format;
|
||||
|
|
@ -39,7 +39,7 @@ export async function imageToolHandler(
|
|||
logger.warn(`Invalid format '${effectiveFormat}' provided, falling back to PNG`);
|
||||
effectiveFormat = "png";
|
||||
}
|
||||
|
||||
|
||||
// Auto-fallback to PNG for screen captures with format 'data'
|
||||
if (isScreenCapture && effectiveFormat === "data") {
|
||||
logger.warn("Screen capture with format 'data' auto-fallback to PNG due to size constraints");
|
||||
|
|
@ -65,10 +65,10 @@ export async function imageToolHandler(
|
|||
);
|
||||
const errorMessage = swiftResponse.error?.message || "Unknown error";
|
||||
const errorDetails = swiftResponse.error?.details;
|
||||
const fullErrorMessage = errorDetails
|
||||
const fullErrorMessage = errorDetails
|
||||
? `${errorMessage}\n${errorDetails}`
|
||||
: errorMessage;
|
||||
|
||||
|
||||
return {
|
||||
content: [
|
||||
{
|
||||
|
|
@ -204,7 +204,7 @@ export async function imageToolHandler(
|
|||
summary += `\nAnalysis ${analysisSucceeded ? "succeeded" : "failed/skipped"}.`;
|
||||
}
|
||||
content.push({ type: "text", text: summary });
|
||||
|
||||
|
||||
// Add format warning if applicable
|
||||
if (formatWarning) {
|
||||
content.push({ type: "text", text: formatWarning });
|
||||
|
|
|
|||
|
|
@ -121,10 +121,10 @@ export async function listToolHandler(
|
|||
logger.error({ error: swiftResponse.error }, "Swift CLI returned error");
|
||||
const errorMessage = swiftResponse.error?.message || "Unknown error";
|
||||
const errorDetails = swiftResponse.error?.details;
|
||||
const fullErrorMessage = errorDetails
|
||||
const fullErrorMessage = errorDetails
|
||||
? `${errorMessage}\n${errorDetails}`
|
||||
: errorMessage;
|
||||
|
||||
|
||||
return {
|
||||
content: [
|
||||
{
|
||||
|
|
|
|||
|
|
@ -138,7 +138,9 @@ export const imageToolSchema = z.object({
|
|||
format: z.preprocess(
|
||||
(val) => {
|
||||
// Handle null, undefined, or empty string by returning undefined (will use default)
|
||||
if (val === null || val === undefined || val === "") return undefined;
|
||||
if (val === null || val === undefined || val === "") {
|
||||
return undefined;
|
||||
}
|
||||
// If the value is not a valid format, fall back to 'png'
|
||||
const validFormats = ["png", "jpg", "data"];
|
||||
return validFormats.includes(val as string) ? val : "png";
|
||||
|
|
|
|||
Loading…
Reference in a new issue