🛠 fix: show matching prompts when typing commands in the slash menu (#17046)
Some checks are pending
Backend Unit Tests / Build packages (push) Waiting to run
Backend Unit Tests / Codegraph select (push) Waiting to run
Backend Unit Tests / TypeScript type checks (push) Blocked by required conditions
Backend Unit Tests / Circular dependency checks (push) Waiting to run
Backend Unit Tests / Tests: api (shard 1/3) (push) Blocked by required conditions
Backend Unit Tests / Tests: api (shard 2/3) (push) Blocked by required conditions
Backend Unit Tests / Tests: api (shard 3/3) (push) Blocked by required conditions
Backend Unit Tests / Tests: data-provider (push) Blocked by required conditions
Backend Unit Tests / Tests: data-schemas (push) Blocked by required conditions
Backend Unit Tests / Tests: @librechat/api (shard 1/4) (push) Blocked by required conditions
Backend Unit Tests / Tests: @librechat/api (shard 2/4) (push) Blocked by required conditions
Backend Unit Tests / Tests: @librechat/api (shard 3/4) (push) Blocked by required conditions
Backend Unit Tests / Tests: @librechat/api (shard 4/4) (push) Blocked by required conditions
Codegraph E2E Votes / vote (full suite) (push) Waiting to run
Docker Dev Branch Images Build / publish (push) Waiting to run
Frontend Unit Tests / Client build recovery regression (push) Waiting to run
Frontend Unit Tests / Codegraph select (push) Waiting to run
Frontend Unit Tests / Build packages (push) Waiting to run
Frontend Unit Tests / TypeScript type checks (client) (push) Blocked by required conditions
Frontend Unit Tests / Tests: @librechat/chat (push) Blocked by required conditions
Frontend Unit Tests / Tests: @librechat/client (push) Blocked by required conditions
Frontend Unit Tests / Tests: Ubuntu (shard 1/2) (push) Blocked by required conditions
Frontend Unit Tests / Tests: Ubuntu (shard 2/2) (push) Blocked by required conditions
Frontend Unit Tests / Vite build verification (push) Blocked by required conditions

* fix(prompts): include command in prompt group list projections

* test(prompts): add regression tests for command in list projections

* test(prompts): add required production ID to list fixture

---------

Co-authored-by: Atef Bellaaj <atef.bellaaj@clickhouse.com>
This commit is contained in:
Aniket Kumar 2026-10-13 17:49:47 +05:30 • committed by GitHub
parent e216f08289
commit f8a0d13d70
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 44 additions and 2 deletions

View file

@ -767,3 +767,45 @@ describe('Prompt method failure contracts', () => {
expect(all.data).toHaveLength(2);
});
});
describe('Prompt group list projections include `command`', () => {
let commandGroupId: string;
beforeEach(async () => {
const group = (
await PromptGroup.create({
name: 'Command Projection Group',
command: 'mytest-cmd',
productionId: new ObjectId(),
author: testUsers.owner._id,
authorName: testUsers.owner.name,
})
).toObject() as unknown as LeanPromptGroup;
commandGroupId = String(group._id);
});
afterEach(async () => {
await PromptGroup.deleteMany({});
});
it('getPromptGroups includes command in the list projection', async () => {
const result = await methods.getPromptGroups({
pageNumber: 1,
pageSize: 10,
name: 'Command Projection',
});
if (!('promptGroups' in result)) {
throw new Error(`Expected prompt groups, received: ${JSON.stringify(result)}`);
}
expect(result.promptGroups).toHaveLength(1);
expect(result.promptGroups[0].command).toBe('mytest-cmd');
});
it('getListPromptGroupsByAccess includes command in the list projection', async () => {
const result = await methods.getListPromptGroupsByAccess({
accessibleIds: [commandGroupId],
});
expect(result.data).toHaveLength(1);
expect(result.data[0].command).toBe('mytest-cmd');
});
});

View file

@ -310,7 +310,7 @@ export function createPromptMethods(
.skip(skip)
.limit(limit)
.select(
'name numberOfGenerations oneliner category productionId author authorName createdAt updatedAt',
'name numberOfGenerations oneliner category productionId author authorName createdAt updatedAt command',
)
.lean(),
PromptGroup.countDocuments(query),
@ -450,7 +450,7 @@ export function createPromptMethods(
const findQuery = PromptGroup.find(matchQuery)
.sort({ numberOfGenerations: -1, updatedAt: -1, _id: 1 })
.select(
'name numberOfGenerations oneliner category productionId author authorName createdAt updatedAt',
'name numberOfGenerations oneliner category productionId author authorName createdAt updatedAt command',
);
if (isPaginated && normalizedLimit) {