Skip to content

Commit

Permalink
Add reindex GitHub action
Browse files Browse the repository at this point in the history
  • Loading branch information
lucas-janon committed Jul 30, 2024
1 parent 1834795 commit c9e0bfa
Show file tree
Hide file tree
Showing 5 changed files with 60 additions and 31 deletions.
37 changes: 37 additions & 0 deletions .github/workflows/reindex-embeddings.yaml
Original file line number Diff line number Diff line change
@@ -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
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
1 change: 1 addition & 0 deletions src/app/api/chat/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
31 changes: 1 addition & 30 deletions src/components/Cmdk/components/Cmdk.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -176,7 +166,6 @@ export const Cmdk: React.FC<CmdkProps> = ({ isOpen, setIsCmdkOpen }) => {
const isHome = activePage === "home";

const onValueChange = React.useCallback((value: string) => {
console.log(value);
setInputValue(value);
}, []);

Expand Down Expand Up @@ -405,21 +394,3 @@ function Item({
</Command.Item>
);
}

function FeedbackIcon() {
return (
<svg
fill="none"
height="24"
shapeRendering="geometricPrecision"
stroke="currentColor"
strokeLinecap="round"
strokeLinejoin="round"
strokeWidth="1.5"
viewBox="0 0 24 24"
width="24"
>
<path d="M21 11.5a8.38 8.38 0 01-.9 3.8 8.5 8.5 0 01-7.6 4.7 8.38 8.38 0 01-3.8-.9L3 21l1.9-5.7a8.38 8.38 0 01-.9-3.8 8.5 8.5 0 014.7-7.6 8.38 8.38 0 013.8-.9h.5a8.48 8.48 0 018 8v.5z"></path>
</svg>
);
}
19 changes: 19 additions & 0 deletions src/components/Cmdk/components/FeedbackIcon.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import React from "react";

export function FeedbackIcon() {
return (
<svg
fill="none"
height="24"
shapeRendering="geometricPrecision"
stroke="currentColor"
strokeLinecap="round"
strokeLinejoin="round"
strokeWidth="1.5"
viewBox="0 0 24 24"
width="24"
>
<path d="M21 11.5a8.38 8.38 0 01-.9 3.8 8.5 8.5 0 01-7.6 4.7 8.38 8.38 0 01-3.8-.9L3 21l1.9-5.7a8.38 8.38 0 01-.9-3.8 8.5 8.5 0 014.7-7.6 8.38 8.38 0 013.8-.9h.5a8.48 8.48 0 018 8v.5z"></path>
</svg>
);
}

0 comments on commit c9e0bfa

Please sign in to comment.