Skip to content

Commit

Permalink
Merge main and update to use inngest instead of client.ts
Browse files Browse the repository at this point in the history
  • Loading branch information
stefl committed Oct 29, 2024
1 parent 5782d72 commit e37190a
Show file tree
Hide file tree
Showing 7 changed files with 10 additions and 61 deletions.
4 changes: 2 additions & 2 deletions apps/nextjs/src/app/api/chat/user.test.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { posthogAiBetaServerClient } from "@oakai/core/src/analytics/posthogAiBetaServerClient";
import { inngest } from "@oakai/core/src/client";
import { inngest } from "@oakai/core/src/inngest";
import { RateLimitExceededError } from "@oakai/core/src/utils/rateLimiting/userBasedRateLimiter";

import { reportRateLimitError } from "./user";

jest.mock("@oakai/core/src/client", () => ({
jest.mock("@oakai/core/src/inngest", () => ({
inngest: {
createFunction: jest.fn(),
send: jest.fn(),
Expand Down
3 changes: 2 additions & 1 deletion apps/nextjs/src/app/api/chat/webActionsPlugin.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,11 @@ import type { Moderation } from "@prisma/client";

import { createWebActionsPlugin } from "./webActionsPlugin";

jest.mock("@oakai/core/src/client", () => ({
jest.mock("@oakai/core/src/inngest", () => ({
__esModule: true,

inngest: {
createFunction: jest.fn(),
send: jest.fn(),
},
}));
Expand Down
2 changes: 1 addition & 1 deletion apps/nextjs/src/app/api/chat/webActionsPlugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import type { AilaPlugin } from "@oakai/aila/src/core/plugins";
import { AilaThreatDetectionError } from "@oakai/aila/src/features/threatDetection";
import { handleHeliconeError } from "@oakai/aila/src/utils/moderation/moderationErrorHandling";
import { SafetyViolations as defaultSafetyViolations } from "@oakai/core";
import { inngest } from "@oakai/core/src/client";
import { inngest } from "@oakai/core/src/inngest";
import { UserBannedError } from "@oakai/core/src/models/userBannedError";
import type { PrismaClientWithAccelerate } from "@oakai/db";
import { aiLogger } from "@oakai/logger";
Expand Down
9 changes: 3 additions & 6 deletions packages/api/src/middleware/rateLimiter.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
import { inngest } from "@oakai/core";
import { inngest } from "@oakai/core/src/inngest";
import { rateLimits } from "@oakai/core/src/utils/rateLimiting/rateLimit";
import type {
RateLimiter} from "@oakai/core/src/utils/rateLimiting/userBasedRateLimiter";
import {
RateLimitExceededError
} from "@oakai/core/src/utils/rateLimiting/userBasedRateLimiter";
import type { RateLimiter } from "@oakai/core/src/utils/rateLimiting/userBasedRateLimiter";
import { RateLimitExceededError } from "@oakai/core/src/utils/rateLimiting/userBasedRateLimiter";
import { TRPCError } from "@trpc/server";

import { t } from "../trpc";
Expand Down
49 changes: 0 additions & 49 deletions packages/core/src/client.ts

This file was deleted.

2 changes: 1 addition & 1 deletion packages/core/src/models/lessons.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import { PromptTemplate } from "langchain/prompts";
import { RunnableSequence } from "langchain/schema/runnable";
import { z } from "zod";

import { inngest } from "../client";
import { inngest } from "../inngest";
import { createOpenAILangchainClient } from "../llm/langchain";
import type { SnippetWithLesson } from "./snippets";
import { Snippets } from "./snippets";
Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/models/snippets.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import { formatDocumentsAsString } from "langchain/util/document";
import { PrismaVectorStore } from "langchain/vectorstores/prisma";
import { difference } from "remeda";

import { inngest } from "../client";
import { inngest } from "../inngest";
import { createOpenAILangchainClient } from "../llm/langchain";
import { embedWithCache } from "../utils/embeddings";

Expand Down

0 comments on commit e37190a

Please sign in to comment.