Skip to content

Enhanced ChatGPT Clone: Features Agents, MCP, Skills, DeepSeek, Anthropic, AWS, OpenAI, Responses API, Azure, Groq, o1, GPT-5, Mistral, OpenRouter, Vertex AI, Gemini, Artifacts, AI model switching, message search, Code Interpreter, langchain, DALL-E-3, OpenAPI Actions, Functions, Secure Multi-User Auth, Presets, open-source for self-hosting. Active

🛠 fix: show matching prompts when typing commands in the slash menu (#17046)

Aniket Kumarf8a0d13d707f
diff --git a/packages/data-schemas/src/methods/prompt.spec.ts b/packages/data-schemas/src/methods/prompt.spec.ts
index 60e7f36a26..6334e6b229 100644
--- a/packages/data-schemas/src/methods/prompt.spec.ts
+++ b/packages/data-schemas/src/methods/prompt.spec.ts
@@ -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');
+ });
+});
diff --git a/packages/data-schemas/src/methods/prompt.ts b/packages/data-schemas/src/methods/prompt.ts
index a7aba67d98..8848f76d5c 100644
--- a/packages/data-schemas/src/methods/prompt.ts
+++ b/packages/data-schemas/src/methods/prompt.ts
@@ -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) {