Skip to content

Commit daf2eb6

Browse files
committed
fix(mothership): tag an unlabeled file selection as a bare mention
1 parent 608a728 commit daf2eb6

2 files changed

Lines changed: 14 additions & 1 deletion

File tree

‎apps/sim/lib/mothership/chat/process-contents.test.ts‎

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1035,6 +1035,19 @@ describe('processContextsServer - file_selection contexts', () => {
10351035
expect(ctx.path).toBeTruthy()
10361036
})
10371037

1038+
it('tags an unlabeled selection as a bare mention, never as the active resource', async () => {
1039+
getWorkspaceFile.mockResolvedValue({ name: 'notes.md', folderPath: null })
1040+
1041+
const [ctx] = await processContextsServer(
1042+
[{ kind: 'file_selection', fileId: 'file-1', label: '', text: 'passage' } as ChatContext],
1043+
'user-1',
1044+
'explain this',
1045+
'ws-1'
1046+
)
1047+
1048+
expect(ctx.tag).toBe('@')
1049+
})
1050+
10381051
it('drops the selection when the file does not resolve', async () => {
10391052
getWorkspaceFile.mockResolvedValue(null)
10401053

‎apps/sim/lib/mothership/chat/process-contents.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1156,7 +1156,7 @@ export async function resolveOwnedFileContext(
11561156
}
11571157
return {
11581158
type: selected?.kind ?? 'active_resource',
1159-
tag: selected?.label ? `@${selected.label}` : '@active_resource',
1159+
tag: selected ? (selected.label ? `@${selected.label}` : '@') : '@active_resource',
11601160
content,
11611161
path: file.path,
11621162
resource: { type: 'file', id: file.id, title: file.name, path: file.path, owner: file.owner },

0 commit comments

Comments
 (0)