This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"use client"; | |
import { Button } from "@midday/ui/button"; | |
import { Dialog, DialogContent, DialogTrigger } from "@midday/ui/dialog"; | |
import { Icons } from "@midday/ui/icons"; | |
import { Skeleton } from "@midday/ui/skeleton"; | |
import { cn } from "@midday/ui/utils"; | |
import { AnimatePresence, motion } from "framer-motion"; | |
import { useEffect, useState } from "react"; | |
import { Document, Page, pdfjs } from "react-pdf"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import crypto from "node:crypto"; | |
import { ChatPromptTemplate } from "@langchain/core/prompts"; | |
import { ChatOpenAI } from "@langchain/openai"; | |
import { eventTrigger } from "@trigger.dev/sdk"; | |
import { capitalCase } from "change-case"; | |
import * as d3 from "d3-dsv"; | |
import { CSVLoader } from "langchain/document_loaders/fs/csv"; | |
import { TokenTextSplitter } from "langchain/text_splitter"; | |
import { z } from "zod"; | |
import { client, supabase } from "../client"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { ChatPromptTemplate } from "@langchain/core/prompts"; | |
import { ChatOpenAI } from "@langchain/openai"; | |
import { eventTrigger } from "@trigger.dev/sdk"; | |
import { capitalCase } from "change-case"; | |
import * as d3 from "d3-dsv"; | |
import { CSVLoader } from "langchain/document_loaders/fs/csv"; | |
import { TokenTextSplitter } from "langchain/text_splitter"; | |
import { z } from "zod"; | |
import { client, supabase } from "../client"; | |
import { Events, Jobs } from "../constants"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const completion = await io.openai.chat.completions.create("completion", { | |
model: "gpt-3.5-turbo", | |
messages: [ | |
{ | |
role: "system", | |
content: | |
"You are a invoice parser. From this invoice extract total amount, due date, issuer name, currency and transform currency value to currency code and return it as currency. Return the response in JSON format", | |
}, | |
{ | |
role: "user", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export const getMetrics = async (params) => { | |
const supabase = createClient(); | |
const user = await getUser(); | |
const teamId = user?.data?.team_id; | |
if (!teamId) { | |
return null; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { Novu } from "@novu/node"; | |
const novu = new Novu(process.env.NOVU_API_KEY!); | |
const API_ENDPOINT = "https://api.novu.co/v1"; | |
export enum TriggerEvents { | |
TransactionNew = "transaction_new", | |
} | |
type TriggerUser = { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"use client"; | |
import { useNotifications } from "@/hooks/use-notifications"; | |
import { Button } from "@midday/ui/button"; | |
import { Icons } from "@midday/ui/icons"; | |
import { Popover, PopoverContent, PopoverTrigger } from "@midday/ui/popover"; | |
import { ScrollArea } from "@midday/ui/scroll-area"; | |
import { Tabs, TabsContent, TabsList, TabsTrigger } from "@midday/ui/tabs"; | |
import { formatDistanceToNow } from "date-fns"; | |
import Link from "next/link"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { createClient } from "@midday/supabase/client"; | |
import { getUserQuery } from "@midday/supabase/queries"; | |
import { HeadlessService } from "@novu/headless"; | |
import { useCallback, useEffect, useRef, useState } from "react"; | |
export function useNotifications() { | |
const supabase = createClient(); | |
const [notifications, setNotifications] = useState([]); | |
const [subscriberId, setSubscriberId] = useState(); | |
const headlessServiceRef = useRef<HeadlessService>(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { getSupabaseBrowserClient } from "@midday/supabase/browser-client"; | |
import { getUserDetails } from "@midday/supabase/queries"; | |
import { upload } from "@midday/supabase/storage"; | |
import { useState } from "react"; | |
export function useUpload() { | |
const supabase = getSupabaseBrowserClient(); | |
const [isLoading, setLoading] = useState(false); | |
const uploadFile = async ({ bucketName, file, path }) => { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { SupabaseClient } from "@supabase/auth-helpers-nextjs"; | |
type UploadParams = { | |
file: File; | |
path: string; | |
}; | |
export async function upload( | |
client: SupabaseClient, | |
{ file, path }: UploadParams, |
NewerOlder