Skip to content

Commit 3ef75d4

Browse files
committed
fix(integrations): resolve referenced files in the legacy slides image source and keep empty trello descriptions on tool calls
1 parent abcb2d4 commit 3ef75d4

4 files changed

Lines changed: 31 additions & 10 deletions

File tree

‎apps/sim/blocks/blocks/google_slides.test.ts‎

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,4 +83,14 @@ describe('Google Slides canvas', () => {
8383
})
8484
expect(mapped.imageUrl).toBe('https://example.com/a.png')
8585
})
86+
87+
it('extracts the URL from a referenced file serialized into the legacy image source', () => {
88+
const mapped = mapParams(GoogleSlidesBlock, {
89+
operation: 'add_image',
90+
presentationId: 'p1',
91+
pageObjectId: 's1',
92+
imageSource: JSON.stringify({ name: 'a.png', url: 'https://files.example.com/a.png' }),
93+
})
94+
expect(mapped.imageUrl).toBe('https://files.example.com/a.png')
95+
})
8696
})

‎apps/sim/blocks/blocks/google_slides.ts‎

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2744,14 +2744,14 @@ Return ONLY the text content - no explanations, no markdown formatting markers,
27442744
}
27452745

27462746
if (operation === 'add_image') {
2747-
if (!params.imageUrl && params.imageSource) {
2748-
const source = params.imageSource
2749-
if (typeof source === 'string') {
2750-
result.imageUrl = source.trim()
2751-
} else {
2752-
const fileObject = normalizeFileInput(source, { single: true })
2753-
const fileUrl = fileObject ? resolveHttpsUrlFromFileInput(fileObject) : null
2747+
const source = params.imageSource
2748+
if (source) {
2749+
const fileObject = normalizeFileInput(source, { single: true })
2750+
if (fileObject) {
2751+
const fileUrl = resolveHttpsUrlFromFileInput(fileObject)
27542752
if (fileUrl) result.imageUrl = fileUrl
2753+
} else if (typeof source === 'string') {
2754+
result.imageUrl = source.trim()
27552755
}
27562756
}
27572757
if (imageWidth) {
@@ -2910,7 +2910,7 @@ Return ONLY the text content - no explanations, no markdown formatting markers,
29102910
}
29112911

29122912
if (operation === 'replace_all_shapes_with_image') {
2913-
result.imageUrl = orModelArg(params.replaceShapesImageUrl, params.imageUrl)
2913+
result.imageUrl = orModelArg(params.replaceShapesImageUrl, rest.imageUrl)
29142914
result.findText = orModelArg(params.replaceShapesFindText, params.findText)
29152915
if (params.replaceShapesMatchCase !== undefined)
29162916
result.matchCase = params.replaceShapesMatchCase
@@ -2922,7 +2922,7 @@ Return ONLY the text content - no explanations, no markdown formatting markers,
29222922

29232923
if (operation === 'replace_image') {
29242924
result.imageObjectId = orModelArg(params.replaceImageObjectId, params.imageObjectId)
2925-
result.imageUrl = orModelArg(params.replaceImageUrl, params.imageUrl)
2925+
result.imageUrl = orModelArg(params.replaceImageUrl, rest.imageUrl)
29262926
if (params.replaceImageMethod) result.imageReplaceMethod = params.replaceImageMethod
29272927
}
29282928

‎apps/sim/blocks/blocks/trello.test.ts‎

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,4 +25,15 @@ describe('Trello mapper on agent tool calls', () => {
2525
)
2626
).toMatchObject({ query: 'bug', idBoards: ['b1', 'b2'], cardsLimit: 5 })
2727
})
28+
29+
it('keeps a model-supplied empty description so update_card can clear it', () => {
30+
if (!mapParams) throw new Error('Trello block has no params mapper')
31+
32+
expect(
33+
mapParams(
34+
{ oauthCredential: 'cred', cardId: 'c1', desc: '' },
35+
{ operation: 'trello_update_card' }
36+
).desc
37+
).toBe('')
38+
})
2839
})

‎apps/sim/blocks/blocks/trello.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1190,7 +1190,7 @@ Return ONLY the date/timestamp string - no explanations, no extra text.`,
11901190
...baseParams,
11911191
cardId,
11921192
name: getTrimmedString(params.name),
1193-
desc: getTrimmedString(params.desc),
1193+
desc: getTrimmedString(params.desc) ?? (toolArg('desc') === '' ? '' : undefined),
11941194
closed: parseOptionalBooleanInput(params.closed),
11951195
idList: getTrimmedString(params.idList),
11961196
due: getTrimmedString(params.due),

0 commit comments

Comments
 (0)