From c9e0bfa38fb248ae78a1d7e214789e19c6d06ec6 Mon Sep 17 00:00:00 2001 From: Lucas Janon Date: Tue, 30 Jul 2024 16:21:50 -0300 Subject: [PATCH] Add reindex GitHub action --- .github/workflows/reindex-embeddings.yaml | 37 +++++++++++++++++++ package.json | 3 +- src/app/api/chat/route.ts | 1 + src/components/Cmdk/components/Cmdk.tsx | 31 +--------------- .../Cmdk/components/FeedbackIcon.tsx | 19 ++++++++++ 5 files changed, 60 insertions(+), 31 deletions(-) create mode 100644 .github/workflows/reindex-embeddings.yaml create mode 100644 src/components/Cmdk/components/FeedbackIcon.tsx diff --git a/.github/workflows/reindex-embeddings.yaml b/.github/workflows/reindex-embeddings.yaml new file mode 100644 index 00000000..981d3edd --- /dev/null +++ b/.github/workflows/reindex-embeddings.yaml @@ -0,0 +1,37 @@ +name: Reindex embeddings +env: + VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }} + VERCEL_PROJECT_ID: ${{ secrets.VERCEL_PROJECT_ID }} +on: + push: +jobs: + reindex-embeddings: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - name: Set up Node.js 20 + uses: actions/setup-node@v3 + with: + node-version: 20 + + - name: Install Yarn + run: npm install --global yarn + + - uses: actions/cache@v3 + id: yarn-cache + with: + path: "**/node_modules" + key: ${{ runner.os }}-yarn-${{ hashFiles('yarn.lock') }} + + - name: Install yarn packages + if: steps.yarn-cache.outputs.cache-hit != 'true' + run: yarn install + + - name: Install Vercel CLI + run: npm install --global vercel@latest + + - name: Pull Vercel Environment Information + run: vercel pull --yes --environment=production --token=${{ secrets.VERCEL_TOKEN }} + + - name: Generate embeddings + run: yarn generate-embeddings diff --git a/package.json b/package.json index 7e81dc33..9f23e3c9 100644 --- a/package.json +++ b/package.json @@ -15,7 +15,8 @@ "tsc:watch": "tsc --watch", "typecheck": "tsc --project ./tsconfig.json --noEmit", "analyze": "ANALYZE=true next build", - "supabase:generate": "npx supabase gen types typescript --project-id gkamfbosmcsrnzhsxufs > ./src/lib/supabase/__generated__/supabase.types.ts" + "supabase:generate": "npx supabase gen types typescript --project-id gkamfbosmcsrnzhsxufs > ./src/lib/supabase/__generated__/supabase.types.ts", + "generate-embeddings": "npx tsx src/lib/generate-embeddings.ts" }, "dependencies": { "@ai-sdk/openai": "0.0.36", diff --git a/src/app/api/chat/route.ts b/src/app/api/chat/route.ts index 727c0548..8e10c545 100644 --- a/src/app/api/chat/route.ts +++ b/src/app/api/chat/route.ts @@ -20,6 +20,7 @@ const getPrompt = (userPrompt: string, pageSections: any[] | null) => { // Allow streaming responses up to 45 seconds export const maxDuration = 45; +export const runtime = "edge"; export async function POST(req: Request) { try { diff --git a/src/components/Cmdk/components/Cmdk.tsx b/src/components/Cmdk/components/Cmdk.tsx index 71d01b2c..744a162e 100644 --- a/src/components/Cmdk/components/Cmdk.tsx +++ b/src/components/Cmdk/components/Cmdk.tsx @@ -14,20 +14,10 @@ import { IconClaim, IconCode, IconServer } from "~/components/shared"; import { ArrowIcon } from "./ArrowIcon"; import { CmdkBreadcrumb } from "./CmdkBreadcrumb"; import { CmdkChat } from "./CmdkChat"; +import { FeedbackIcon } from "./FeedbackIcon"; import { ZetaAiIcon } from "./ZetaAiIcon"; const Container = styled(Paper)` - /* [cmdk-root] { - max-width: 640px; - width: 100%; - border-radius: 12px; - font-family: var(--font-sans); - border: 1px solid var(--gray6); - box-shadow: var(--cmdk-shadow); - transition: transform 100ms ease; - outline: none; - } */ - [cmdk-input] { font-family: var(--font-sans); border: none; @@ -176,7 +166,6 @@ export const Cmdk: React.FC = ({ isOpen, setIsCmdkOpen }) => { const isHome = activePage === "home"; const onValueChange = React.useCallback((value: string) => { - console.log(value); setInputValue(value); }, []); @@ -405,21 +394,3 @@ function Item({ ); } - -function FeedbackIcon() { - return ( - - - - ); -} diff --git a/src/components/Cmdk/components/FeedbackIcon.tsx b/src/components/Cmdk/components/FeedbackIcon.tsx new file mode 100644 index 00000000..4c277d58 --- /dev/null +++ b/src/components/Cmdk/components/FeedbackIcon.tsx @@ -0,0 +1,19 @@ +import React from "react"; + +export function FeedbackIcon() { + return ( + + + + ); +}