Skip to content

Commit

Permalink
Merge branch 'main' into harshbhat/defaultByte-Number
Browse files Browse the repository at this point in the history
  • Loading branch information
harshsbhat authored Oct 30, 2024
2 parents 8d101ac + 7322cef commit fe71f58
Show file tree
Hide file tree
Showing 41 changed files with 200 additions and 374 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/pr-alerts-campsite.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ jobs:

steps:
- name: Checkout repository
uses: actions/checkout@v2
uses: actions/checkout@v4

- name: Set up Node.js
uses: actions/setup-node@v4
Expand Down
2 changes: 1 addition & 1 deletion apps/api/src/pkg/metrics/axiom.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
// idfk https://twitter.com/chronark_/status/1790061863918604666
// idfk https://x.com/chronark_/status/1790061863918604666
// @ts-ignore
import "@axiomhq/js";
3 changes: 3 additions & 0 deletions apps/dashboard/app/(app)/desktop-sidebar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@ type Props = {
id: string;
name: string;
}[];
llmGateways: {
id: string;
}[];
};
className?: string;
};
Expand Down
3 changes: 3 additions & 0 deletions apps/dashboard/app/(app)/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@ export default async function Layout({ children, breadcrumb }: LayoutProps) {
apis: {
where: (table, { isNull }) => isNull(table.deletedAt),
},
llmGateways: {
columns: { id: true },
},
},
});
if (!workspace) {
Expand Down
1 change: 1 addition & 0 deletions apps/dashboard/app/(app)/mobile-sidebar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ type Props = {
id: string;
name: string;
}[];
llmGateways: { id: string }[];
};
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,10 @@ export default async function OverridePage(props: Props) {

const namespace = await db.query.ratelimitNamespaces.findFirst({
where: (table, { eq, and, isNull }) =>
and(eq(table.id, props.params.namespaceId), isNull(table.deletedAt)),
and(
eq(table.id, props.params.namespaceId),
isNull(table.deletedAt)
),
with: {
overrides: {
columns: {
Expand All @@ -33,8 +36,9 @@ export default async function OverridePage(props: Props) {
duration: true,
async: true,
},
where: (table, { isNull }) =>
isNull(table.deletedAt)
},

workspace: {
columns: {
id: true,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ export const DeleteGateway: React.FC<Props> = ({ gateway }) => {

await revalidate();

router.push("/semantic-cache");
router.push("/");
},
onError(err) {
console.error(err);
Expand Down
121 changes: 0 additions & 121 deletions apps/dashboard/app/(app)/semantic-cache/form.tsx

This file was deleted.

30 changes: 0 additions & 30 deletions apps/dashboard/app/(app)/semantic-cache/new/page.tsx

This file was deleted.

This file was deleted.

2 changes: 1 addition & 1 deletion apps/dashboard/app/(app)/semantic-cache/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ export default async function SemanticCachePage() {
}

if (!workspace.llmGateways.length) {
return redirect("/semantic-cache/new");
return redirect("/");
}

return redirect(`/semantic-cache/${workspace.llmGateways[0].id}/logs`);
Expand Down
4 changes: 3 additions & 1 deletion apps/dashboard/app/(app)/workspace-navigations.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,8 @@ const Tag: React.FC<{ label: string; className?: string }> = ({ label, className
);

export const createWorkspaceNavigation = (
workspace: Pick<Workspace, "features"> & Pick<Workspace, "betaFeatures">,
workspace: Pick<Workspace, "features"> &
Pick<Workspace, "betaFeatures"> & { llmGateways: { id: string }[] },
segments: string[],
) => {
return [
Expand Down Expand Up @@ -104,6 +105,7 @@ export const createWorkspaceNavigation = (
href: "/semantic-cache",
label: "Semantic Cache",
active: segments.at(0) === "semantic-cache",
hidden: workspace.llmGateways.length === 0,
},
{
icon: Fingerprint,
Expand Down
4 changes: 2 additions & 2 deletions apps/dashboard/app/auth/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ const quotes: {
},
{
text: "Just used Unkey, by far the easiest and cheapest ( its free ) solution I have used so far for saas to manage their api keys. Its amazing how easy it is use.",
source: "https://twitter.com/tkejr_/status/1731613302378164440",
source: "https://x.com/tkejr_/status/1731613302378164440",
author: {
name: "Tanmay",
image: "/images/quoteImages/tanmay.jpg",
Expand All @@ -50,7 +50,7 @@ const quotes: {
},
{
text: "Diving into Unkey for a project, and I'm impressed! Love the straightforward setup for managing API keys.",
source: "https://twitter.com/ojabowalola/status/1724134790670999919",
source: "https://x.com/ojabowalola/status/1724134790670999919",
author: {
name: "Lola",
image: "/images/quoteImages/lola.jpg",
Expand Down
36 changes: 0 additions & 36 deletions apps/dashboard/app/new/create-semantic-cache.tsx

This file was deleted.

23 changes: 2 additions & 21 deletions apps/dashboard/app/new/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,12 @@ import { insertAuditLogs } from "@/lib/audit";
import { db, schema } from "@/lib/db";
import { auth } from "@clerk/nextjs";
import { newId } from "@unkey/id";
import { ArrowRight, DatabaseZap, GlobeLock, KeySquare } from "lucide-react";
import { ArrowRight, GlobeLock, KeySquare } from "lucide-react";
import { headers } from "next/headers";
import Link from "next/link";
import { notFound, redirect } from "next/navigation";
import { CreateApi } from "./create-api";
import { CreateRatelimit } from "./create-ratelimit";
import { CreateSemanticCacheButton } from "./create-semantic-cache";
import { CreateWorkspace } from "./create-workspace";
import { Keys } from "./keys";

Expand Down Expand Up @@ -80,7 +79,7 @@ export default async function (props: Props) {
]}
/>
<Separator className="my-8" />
<div className="grid grid-cols-1 gap-8 lg:grid-cols-3">
<div className="grid grid-cols-1 gap-8 md::grid-cols-2">
<div className="flex flex-col gap-4 lg:gap-10 p-8 duration-200 border rounded-lg border-border hover:border-primary justify-between">
<div className="flex flex-col gap-4">
<div className="flex items-center justify-center p-4 border rounded-lg bg-primary/5">
Expand Down Expand Up @@ -124,24 +123,6 @@ export default async function (props: Props) {
</Button>
</Link>
</div>
<div className="flex flex-col gap-4 lg:gap-10 p-8 duration-200 border rounded-lg border-border hover:border-primary justify-between">
<div className="flex flex-col gap-4">
<div className="flex items-center justify-center p-4 border rounded-lg bg-primary/5">
<DatabaseZap className="w-6 h-6 text-primary" />
</div>
<h4 className="text-lg font-medium">I want to cache an LLM</h4>
<p className="text-sm text-content-subtle">
Faster, cheaper LLM API calls through re-using semantically similar previous
responses.
</p>
<ol className="ml-2 space-y-1 text-sm list-decimal list-outside text-content-subtle">
<li>You switch out the baseUrl in your requests to OpenAI with your gateway URL</li>
<li>Unkey will automatically start caching your responses</li>
<li>Monitor and track your cache usage here</li>
</ol>
</div>
<CreateSemanticCacheButton />
</div>
</div>
</div>
);
Expand Down
2 changes: 1 addition & 1 deletion apps/dashboard/components/array-input.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ type Props = {
setSelected: (v: string[]) => void;
};

export const ArrayInput: React.FC<Props> = ({ title, placeholder, selected, setSelected }) => {
export const ArrayInput: React.FC<Props> = ({ title, placeholder, selected = [], setSelected }) => {
const inputRef = React.useRef<HTMLInputElement>(null);
const [inputValue, setInputValue] = React.useState("");

Expand Down
2 changes: 0 additions & 2 deletions apps/dashboard/lib/trpc/routers/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ import { updateKeyOwnerId } from "./key/updateOwnerId";
import { updateKeyRatelimit } from "./key/updateRatelimit";
import { updateKeyRemaining } from "./key/updateRemaining";
import { updateRootKeyName } from "./key/updateRootKeyName";
import { createLlmGateway } from "./llmGateway/create";
import { deleteLlmGateway } from "./llmGateway/delete";
import { createPlainIssue } from "./plain";
import { createNamespace } from "./ratelimit/createNamespace";
Expand Down Expand Up @@ -61,7 +60,6 @@ export const router = t.router({
}),

llmGateway: t.router({
create: createLlmGateway,
delete: deleteLlmGateway,
}),
rootKey: t.router({
Expand Down
Loading

0 comments on commit fe71f58

Please sign in to comment.