Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions apps/web/utils/actions/assess.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@ export const analyzeWritingStyleAction = actionClient
email: true,
about: true,
user: { select: { aiProvider: true, aiModel: true, aiApiKey: true } },
account: { select: { provider: true } },
},
});

Expand All @@ -66,7 +65,7 @@ export const analyzeWritingStyleAction = actionClient
emails: sentMessages.map((email) =>
getEmailForLLM(email, { extractReply: true }),
),
emailAccount,
emailAccount: { ...emailAccount, account: { provider } },
});

if (!style) return;
Expand Down
5 changes: 2 additions & 3 deletions apps/web/utils/actions/rule.ts
Original file line number Diff line number Diff line change
Expand Up @@ -392,7 +392,7 @@ export const enableDraftRepliesAction = actionClient
export const deleteRuleAction = actionClient
.metadata({ name: "deleteRule" })
.schema(deleteRuleBody)
.action(async ({ ctx: { emailAccountId }, parsedInput: { id } }) => {
.action(async ({ ctx: { emailAccountId, provider }, parsedInput: { id } }) => {
const rule = await prisma.rule.findUnique({
where: { id, emailAccountId },
include: { actions: true, categoryFilters: true, group: true },
Expand Down Expand Up @@ -426,15 +426,14 @@ export const deleteRuleAction = actionClient
aiApiKey: true,
},
},
account: { select: { provider: true } },
},
});
if (!emailAccount) throw new SafeError("User not found");

if (!emailAccount.rulesPrompt) return;

const updatedPrompt = await generatePromptOnDeleteRule({
emailAccount,
emailAccount: { ...emailAccount, account: { provider } },
existingPrompt: emailAccount.rulesPrompt,
deletedRule: rule,
});
Expand Down
12 changes: 7 additions & 5 deletions apps/web/utils/ai/rule/create-rule-schema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -82,11 +82,13 @@ const actionSchema = (provider: string) =>
.nullish()
.transform((v) => v ?? null)
.describe("The webhook URL to call"),
folderName: z
.string()
.nullish()
.transform((v) => v ?? null)
.describe("The folder to move the email to"),
...(provider === "microsoft" && {
folderName: z
.string()
.nullish()
.transform((v) => v ?? null)
.describe("The folder to move the email to"),
}),
})
.nullish()
.describe(
Expand Down
Loading