Skip to content

Open source CapCut alternative.

TypeScript

fix(chatgpt): list cloud projects most recently edited first

David Lec3137d606895
diff --git a/site/src/clients/chatgpt/server/mcp.ts b/site/src/clients/chatgpt/server/mcp.ts
index b2b9ef7e..25c1356b 100644
--- a/site/src/clients/chatgpt/server/mcp.ts
+++ b/site/src/clients/chatgpt/server/mcp.ts
@@ -160,7 +160,7 @@ export function createChatgptServer(
{
title: "List Donkey Cut cloud projects",
description:
- "List the connected user's saved cloud projects. Browser and Mac projects become available after being saved to the cloud. Follow nextCursor for more results.",
+ "List the connected user's saved cloud projects, most recently edited first. Browser and Mac projects become available after being saved to the cloud. Follow nextCursor for more results.",
inputSchema: z.object({ cursor: idSchema.optional() }),
outputSchema: viewSchema,
annotations: readOnlyAnnotations,
diff --git a/site/src/clients/chatgpt/server/projects.test.ts b/site/src/clients/chatgpt/server/projects.test.ts
index af7cfead..fc0586a8 100644
--- a/site/src/clients/chatgpt/server/projects.test.ts
+++ b/site/src/clients/chatgpt/server/projects.test.ts
@@ -105,6 +105,7 @@ describe("ChatGPT cloud projects", () => {
]);
expect(db.cutProject.findMany.mock.calls[0][0]).toMatchObject({
where: { userId: "owner" },
+ orderBy: [{ updatedAt: "desc" }, { id: "desc" }],
take: 21,
select: { id: true, name: true, version: true },
});
diff --git a/site/src/clients/chatgpt/server/projects.ts b/site/src/clients/chatgpt/server/projects.ts
index fa748496..096b8da1 100644
--- a/site/src/clients/chatgpt/server/projects.ts
+++ b/site/src/clients/chatgpt/server/projects.ts
@@ -258,7 +258,7 @@ export function projectTools(
const rows = await db.cutProject.findMany({
where: { userId: identity.userId },
select: { id: true, name: true, version: true },
- orderBy: { id: "asc" },
+ orderBy: [{ updatedAt: "desc" }, { id: "desc" }],
take: 21,
...(cursor ? { cursor: { id: cursor }, skip: 1 } : {}),
});