Skip to content

Commit

Permalink
feat: reverse agent sort
Browse files Browse the repository at this point in the history
  • Loading branch information
awtkns committed Apr 19, 2023
1 parent 838e9df commit 25ab9a2
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 2 deletions.
9 changes: 8 additions & 1 deletion prisma/schema.prisma
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,13 @@ model User {
subscriptionId String? @db.Text
customerId String? @db.Text
createDate DateTime @default(now())
accounts Account[]
sessions Session[]
Agent Agent[]
@@index([email])
}

model VerificationToken {
Expand All @@ -71,7 +75,7 @@ model Agent {
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
tasks AgentTask[]
@@index([userId])
@@index([userId, deleteDate, createDate])
}

model AgentTask {
Expand All @@ -82,6 +86,9 @@ model AgentTask {
info String? @db.Text
sort Int
deleteDate DateTime?
createDate DateTime @default(now())
agent Agent @relation(fields: [agentId], references: [id], onDelete: Cascade)
@@index([agentId])
Expand Down
2 changes: 1 addition & 1 deletion src/hooks/useAgent.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ export function useAgent() {
const saveMutation = api.agent.create.useMutation({
onSuccess: (data) => {
utils.agent.getAll.setData(voidFunc(), (oldData) => [
...(oldData ?? []),
data,
...(oldData ?? []),
]);
},
});
Expand Down
2 changes: 2 additions & 0 deletions src/pages/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,8 @@ const Home: NextPage = () => {
session ?? undefined
);
setAgent(agent);
setHasSaved(false);
setMessages([]);
agent.run().then(console.log).catch(console.error);
};

Expand Down

0 comments on commit 25ab9a2

Please sign in to comment.