Skip to content

Commit ff38d48

Browse files
committed
Fix: Attributes from ContentTags not being scanned
1 parent 80c9c12 commit ff38d48

File tree

2 files changed

+21
-5
lines changed

2 files changed

+21
-5
lines changed

src/compiler/scan.test.ts

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -615,6 +615,22 @@ describe('parameters', async () => {
615615
"Cannot assign to builtin variable: '$now'",
616616
)
617617
})
618+
619+
it('includes parameters from content tags', async () => {
620+
const prompt = `
621+
<user>
622+
<content-file mime={{mimeParam}}>
623+
{{fileContent}}
624+
</content-file>
625+
</user>
626+
`
627+
628+
const metadata = await scan({
629+
prompt: removeCommonIndent(prompt),
630+
})
631+
632+
expect(metadata.parameters).toEqual(new Set(['mimeParam', 'fileContent']))
633+
})
618634
})
619635

620636
describe('referenced prompts', async () => {

src/compiler/scan.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -452,14 +452,14 @@ export class Scan {
452452
this.baseNodeError(errors.contentTagInsideContent, node)
453453
}
454454

455+
const attributes = await this.listTagAttributes({
456+
tagNode: node,
457+
scopeContext,
458+
})
459+
455460
if (node.name === ContentTypeTagName.toolCall) {
456461
this.accumulatedToolCalls.push(node)
457462

458-
const attributes = await this.listTagAttributes({
459-
tagNode: node,
460-
scopeContext,
461-
})
462-
463463
if (!attributes.has('id')) {
464464
this.baseNodeError(errors.toolCallTagWithoutId, node)
465465
}

0 commit comments

Comments
 (0)