mirror of
https://github.com/simstudioai/sim.git
synced 2026-04-06 03:00:16 -04:00
impovement(slides): add missing properties definitions (#2877)
This commit is contained in:
committed by
GitHub
parent
7c0f43305b
commit
5e2468cfd3
@@ -200,6 +200,24 @@ export const addImageTool: ToolConfig<AddImageParams, AddImageResponse> = {
|
||||
metadata: {
|
||||
type: 'json',
|
||||
description: 'Operation metadata including presentation ID and image URL',
|
||||
properties: {
|
||||
presentationId: {
|
||||
type: 'string',
|
||||
description: 'The presentation ID',
|
||||
},
|
||||
pageObjectId: {
|
||||
type: 'string',
|
||||
description: 'The page object ID where the image was inserted',
|
||||
},
|
||||
imageUrl: {
|
||||
type: 'string',
|
||||
description: 'The source image URL',
|
||||
},
|
||||
url: {
|
||||
type: 'string',
|
||||
description: 'URL to open the presentation',
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
@@ -186,6 +186,25 @@ export const addSlideTool: ToolConfig<AddSlideParams, AddSlideResponse> = {
|
||||
metadata: {
|
||||
type: 'json',
|
||||
description: 'Operation metadata including presentation ID, layout, and URL',
|
||||
properties: {
|
||||
presentationId: {
|
||||
type: 'string',
|
||||
description: 'The presentation ID',
|
||||
},
|
||||
layout: {
|
||||
type: 'string',
|
||||
description: 'The layout used for the new slide',
|
||||
},
|
||||
insertionIndex: {
|
||||
type: 'number',
|
||||
description: 'The zero-based index where the slide was inserted',
|
||||
optional: true,
|
||||
},
|
||||
url: {
|
||||
type: 'string',
|
||||
description: 'URL to open the presentation',
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
@@ -153,6 +153,24 @@ export const createTool: ToolConfig<GoogleSlidesToolParams, GoogleSlidesCreateRe
|
||||
metadata: {
|
||||
type: 'json',
|
||||
description: 'Created presentation metadata including ID, title, and URL',
|
||||
properties: {
|
||||
presentationId: {
|
||||
type: 'string',
|
||||
description: 'The presentation ID',
|
||||
},
|
||||
title: {
|
||||
type: 'string',
|
||||
description: 'The presentation title',
|
||||
},
|
||||
mimeType: {
|
||||
type: 'string',
|
||||
description: 'The mime type of the presentation',
|
||||
},
|
||||
url: {
|
||||
type: 'string',
|
||||
description: 'URL to open the presentation',
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
@@ -353,6 +353,20 @@ export const createShapeTool: ToolConfig<CreateShapeParams, CreateShapeResponse>
|
||||
metadata: {
|
||||
type: 'json',
|
||||
description: 'Operation metadata including presentation ID and page object ID',
|
||||
properties: {
|
||||
presentationId: {
|
||||
type: 'string',
|
||||
description: 'The presentation ID',
|
||||
},
|
||||
pageObjectId: {
|
||||
type: 'string',
|
||||
description: 'The page object ID where the shape was created',
|
||||
},
|
||||
url: {
|
||||
type: 'string',
|
||||
description: 'URL to open the presentation',
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
@@ -222,6 +222,20 @@ export const createTableTool: ToolConfig<CreateTableParams, CreateTableResponse>
|
||||
metadata: {
|
||||
type: 'json',
|
||||
description: 'Operation metadata including presentation ID and page object ID',
|
||||
properties: {
|
||||
presentationId: {
|
||||
type: 'string',
|
||||
description: 'The presentation ID',
|
||||
},
|
||||
pageObjectId: {
|
||||
type: 'string',
|
||||
description: 'The page object ID where the table was created',
|
||||
},
|
||||
url: {
|
||||
type: 'string',
|
||||
description: 'URL to open the presentation',
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
@@ -126,6 +126,16 @@ export const deleteObjectTool: ToolConfig<DeleteObjectParams, DeleteObjectRespon
|
||||
metadata: {
|
||||
type: 'json',
|
||||
description: 'Operation metadata including presentation ID and URL',
|
||||
properties: {
|
||||
presentationId: {
|
||||
type: 'string',
|
||||
description: 'The presentation ID',
|
||||
},
|
||||
url: {
|
||||
type: 'string',
|
||||
description: 'URL to open the presentation',
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
@@ -147,6 +147,20 @@ export const duplicateObjectTool: ToolConfig<DuplicateObjectParams, DuplicateObj
|
||||
metadata: {
|
||||
type: 'json',
|
||||
description: 'Operation metadata including presentation ID and source object ID',
|
||||
properties: {
|
||||
presentationId: {
|
||||
type: 'string',
|
||||
description: 'The presentation ID',
|
||||
},
|
||||
sourceObjectId: {
|
||||
type: 'string',
|
||||
description: 'The object ID that was duplicated',
|
||||
},
|
||||
url: {
|
||||
type: 'string',
|
||||
description: 'URL to open the presentation',
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
@@ -137,6 +137,16 @@ export const getPageTool: ToolConfig<GetPageParams, GetPageResponse> = {
|
||||
metadata: {
|
||||
type: 'json',
|
||||
description: 'Operation metadata including presentation ID and URL',
|
||||
properties: {
|
||||
presentationId: {
|
||||
type: 'string',
|
||||
description: 'The presentation ID',
|
||||
},
|
||||
url: {
|
||||
type: 'string',
|
||||
description: 'URL to open the presentation',
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
@@ -167,6 +167,24 @@ export const getThumbnailTool: ToolConfig<GetThumbnailParams, GetThumbnailRespon
|
||||
metadata: {
|
||||
type: 'json',
|
||||
description: 'Operation metadata including presentation ID and page object ID',
|
||||
properties: {
|
||||
presentationId: {
|
||||
type: 'string',
|
||||
description: 'The presentation ID',
|
||||
},
|
||||
pageObjectId: {
|
||||
type: 'string',
|
||||
description: 'The page object ID for the thumbnail',
|
||||
},
|
||||
thumbnailSize: {
|
||||
type: 'string',
|
||||
description: 'The requested thumbnail size',
|
||||
},
|
||||
mimeType: {
|
||||
type: 'string',
|
||||
description: 'The thumbnail MIME type',
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
@@ -154,6 +154,16 @@ export const insertTextTool: ToolConfig<InsertTextParams, InsertTextResponse> =
|
||||
metadata: {
|
||||
type: 'json',
|
||||
description: 'Operation metadata including presentation ID and URL',
|
||||
properties: {
|
||||
presentationId: {
|
||||
type: 'string',
|
||||
description: 'The presentation ID',
|
||||
},
|
||||
url: {
|
||||
type: 'string',
|
||||
description: 'URL to open the presentation',
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
@@ -79,6 +79,39 @@ export const readTool: ToolConfig<GoogleSlidesToolParams, GoogleSlidesReadRespon
|
||||
metadata: {
|
||||
type: 'json',
|
||||
description: 'Presentation metadata including ID, title, and URL',
|
||||
properties: {
|
||||
presentationId: {
|
||||
type: 'string',
|
||||
description: 'The presentation ID',
|
||||
},
|
||||
title: {
|
||||
type: 'string',
|
||||
description: 'The presentation title',
|
||||
},
|
||||
pageSize: {
|
||||
type: 'object',
|
||||
description: 'Presentation page size',
|
||||
optional: true,
|
||||
properties: {
|
||||
width: {
|
||||
type: 'json',
|
||||
description: 'Page width as a Dimension object',
|
||||
},
|
||||
height: {
|
||||
type: 'json',
|
||||
description: 'Page height as a Dimension object',
|
||||
},
|
||||
},
|
||||
},
|
||||
mimeType: {
|
||||
type: 'string',
|
||||
description: 'The mime type of the presentation',
|
||||
},
|
||||
url: {
|
||||
type: 'string',
|
||||
description: 'URL to open the presentation',
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
@@ -164,6 +164,24 @@ export const replaceAllTextTool: ToolConfig<ReplaceAllTextParams, ReplaceAllText
|
||||
metadata: {
|
||||
type: 'json',
|
||||
description: 'Operation metadata including presentation ID and URL',
|
||||
properties: {
|
||||
presentationId: {
|
||||
type: 'string',
|
||||
description: 'The presentation ID',
|
||||
},
|
||||
findText: {
|
||||
type: 'string',
|
||||
description: 'The text that was searched for',
|
||||
},
|
||||
replaceText: {
|
||||
type: 'string',
|
||||
description: 'The text that replaced the matches',
|
||||
},
|
||||
url: {
|
||||
type: 'string',
|
||||
description: 'URL to open the presentation',
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
@@ -162,6 +162,16 @@ export const updateSlidesPositionTool: ToolConfig<
|
||||
metadata: {
|
||||
type: 'json',
|
||||
description: 'Operation metadata including presentation ID and URL',
|
||||
properties: {
|
||||
presentationId: {
|
||||
type: 'string',
|
||||
description: 'The presentation ID',
|
||||
},
|
||||
url: {
|
||||
type: 'string',
|
||||
description: 'URL to open the presentation',
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
@@ -92,11 +92,39 @@ export const writeTool: ToolConfig<GoogleSlidesToolParams, GoogleSlidesWriteResp
|
||||
}
|
||||
).then((res) => res.json())
|
||||
|
||||
const slideIndex = params.slideIndex || 0
|
||||
const metadata = {
|
||||
presentationId,
|
||||
title: presentationData.title || 'Updated Presentation',
|
||||
mimeType: 'application/vnd.google-apps.presentation',
|
||||
url: `https://docs.google.com/presentation/d/${presentationId}/edit`,
|
||||
}
|
||||
|
||||
const slideIndex =
|
||||
typeof params.slideIndex === 'string'
|
||||
? Number.parseInt(params.slideIndex, 10)
|
||||
: (params.slideIndex ?? 0)
|
||||
const slide = presentationData.slides?.[slideIndex]
|
||||
|
||||
if (Number.isNaN(slideIndex) || slideIndex < 0) {
|
||||
return {
|
||||
success: false,
|
||||
error: 'Slide index must be a non-negative number',
|
||||
output: {
|
||||
updatedContent: false,
|
||||
metadata,
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
if (!slide) {
|
||||
throw new Error(`Slide at index ${slideIndex} not found`)
|
||||
return {
|
||||
success: false,
|
||||
error: `Slide at index ${slideIndex} not found`,
|
||||
output: {
|
||||
updatedContent: false,
|
||||
metadata,
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
// Create requests to add content to the slide
|
||||
@@ -153,15 +181,14 @@ export const writeTool: ToolConfig<GoogleSlidesToolParams, GoogleSlidesWriteResp
|
||||
if (!updateResponse.ok) {
|
||||
const errorText = await updateResponse.text()
|
||||
logger.error('Failed to update presentation:', { errorText })
|
||||
throw new Error('Failed to update presentation')
|
||||
}
|
||||
|
||||
// Create presentation metadata
|
||||
const metadata = {
|
||||
presentationId,
|
||||
title: presentationData.title || 'Updated Presentation',
|
||||
mimeType: 'application/vnd.google-apps.presentation',
|
||||
url: `https://docs.google.com/presentation/d/${presentationId}/edit`,
|
||||
return {
|
||||
success: false,
|
||||
error: 'Failed to update presentation',
|
||||
output: {
|
||||
updatedContent: false,
|
||||
metadata,
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
return {
|
||||
@@ -185,6 +212,24 @@ export const writeTool: ToolConfig<GoogleSlidesToolParams, GoogleSlidesWriteResp
|
||||
metadata: {
|
||||
type: 'json',
|
||||
description: 'Updated presentation metadata including ID, title, and URL',
|
||||
properties: {
|
||||
presentationId: {
|
||||
type: 'string',
|
||||
description: 'The presentation ID',
|
||||
},
|
||||
title: {
|
||||
type: 'string',
|
||||
description: 'The presentation title',
|
||||
},
|
||||
mimeType: {
|
||||
type: 'string',
|
||||
description: 'The mime type of the presentation',
|
||||
},
|
||||
url: {
|
||||
type: 'string',
|
||||
description: 'URL to open the presentation',
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
|
||||
Reference in New Issue
Block a user