Skip to content

Commit

Permalink
Merge branch 'main' into category-actions
Browse files Browse the repository at this point in the history
  • Loading branch information
elie222 committed Dec 29, 2024
2 parents c9b8b12 + cf995ea commit aabdd8f
Show file tree
Hide file tree
Showing 50 changed files with 1,719 additions and 939 deletions.
10 changes: 5 additions & 5 deletions apps/unsubscriber/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,13 @@
"typescript": "5.7.2"
},
"dependencies": {
"@ai-sdk/amazon-bedrock": "^1.0.5",
"@ai-sdk/anthropic": "^1.0.5",
"@ai-sdk/google": "^1.0.10",
"@ai-sdk/openai": "^1.0.8",
"@ai-sdk/amazon-bedrock": "^1.0.6",
"@ai-sdk/anthropic": "^1.0.6",
"@ai-sdk/google": "^1.0.12",
"@ai-sdk/openai": "^1.0.11",
"@fastify/cors": "^10.0.1",
"@t3-oss/env-core": "^0.11.1",
"ai": "^4.0.18",
"ai": "^4.0.22",
"dotenv": "^16.4.7",
"fastify": "^5.2.0",
"zod": "^3.24.1"
Expand Down
26 changes: 13 additions & 13 deletions apps/web/__tests__/ai-rule-fix.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,16 +32,16 @@ describe.skipIf(!isAiTest)("aiRuleFix", () => {
});

const result = await aiRuleFix({
incorrectRule: rule,
correctRule: null,
actualRule: rule,
expectedRule: null,
email: salesEmail,
user: getUser(),
});

console.log(result);

expect(result).toBeDefined();
expect(result.rule).toBe("matched_rule");
expect(result.rule).toBe("actual_rule");
expect(result.fixedInstructions).toContain("sales");
expect(result.fixedInstructions).not.toBe(rule.instructions);
// The new instructions should be more specific to exclude sales pitches
Expand All @@ -51,10 +51,10 @@ describe.skipIf(!isAiTest)("aiRuleFix", () => {
});

test("should fix rules when email matched wrong rule instead of correct rule", async () => {
const incorrectRule = {
const actualRule = {
instructions: "Match emails about technical support and bug reports",
};
const correctRule = {
const expectedRule = {
instructions: "Match emails about product feedback and feature requests",
};

Expand All @@ -72,8 +72,8 @@ describe.skipIf(!isAiTest)("aiRuleFix", () => {
});

const result = await aiRuleFix({
incorrectRule,
correctRule,
actualRule,
expectedRule,
email: feedbackEmail,
user: getUser(),
});
Expand All @@ -90,7 +90,7 @@ describe.skipIf(!isAiTest)("aiRuleFix", () => {
});

test("should fix rule when email matched but shouldn't match any rules", async () => {
const incorrectRule = {
const actualRule = {
instructions: "Match emails about marketing collaborations",
};

Expand All @@ -108,16 +108,16 @@ describe.skipIf(!isAiTest)("aiRuleFix", () => {
});

const result = await aiRuleFix({
incorrectRule,
correctRule: null,
actualRule,
expectedRule: null,
email: newsletterEmail,
user: getUser(),
});

console.log(result);

expect(result).toBeDefined();
expect(result.rule).toBe("matched_rule");
expect(result.rule).toBe("actual_rule");
expect(result.fixedInstructions).toContain("collaboration");
// The fixed rule should exclude newsletters and automated updates
expect(result.fixedInstructions.toLowerCase()).toMatch(
Expand All @@ -144,8 +144,8 @@ describe.skipIf(!isAiTest)("aiRuleFix", () => {
});

const result = await aiRuleFix({
incorrectRule: null,
correctRule,
actualRule: null,
expectedRule: correctRule,
email: priceRequestEmail,
user: getUser(),
});
Expand Down
5 changes: 5 additions & 0 deletions apps/web/app/(app)/assess.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,16 @@
import { useEffect } from "react";
import type { AssessUserResponse } from "@/app/api/user/assess/route";
import { postRequest } from "@/utils/api";
import { whitelistInboxZeroAction } from "@/utils/actions/whitelist";

export function AssessUser() {
useEffect(() => {
postRequest<AssessUserResponse>("/api/user/assess", {});
}, []);

useEffect(() => {
whitelistInboxZeroAction();
}, []);

return null;
}
Loading

0 comments on commit aabdd8f

Please sign in to comment.