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 { useRouter } from "next/navigation"; | |
import type { ReactNode } from "react"; | |
import { useCallback, useEffect, useState } from "react"; | |
interface ProximityPrefetchProps { | |
children: ReactNode; | |
threshold?: number; | |
predictionInterval?: number; |
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
-- This SQL code defines functions for calculating similarity scores optimized for reconciliation | |
-- between transactions and inbox items (e.g., invoices). It focuses on high precision to avoid incorrect matches. | |
-- Function: calculate_name_similarity_score | |
-- Purpose: Calculates similarity score between transaction and inbox item names | |
-- Input: transaction_name (text), inbox_name (text) | |
-- Output: numeric (0 to 0.6) | |
create or replace function calculate_name_similarity_score( | |
transaction_name text, | |
inbox_name text |
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
create or replace function get_profit ( | |
team_id uuid, | |
date_from date, | |
date_to date, | |
currency text | |
) returns table ( | |
date timestamp with time zone, | |
value numeric | |
) language plpgsql as $$ | |
begin |
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"; |
NewerOlder