Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions apps/dash/.next/dev/types/link.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,10 @@ declare namespace __next_route_internal_types__ {
| `/projects` // ../../../src/app/(workspace)/projects/page.tsx
| `/projects/api-key` // ../../../src/app/(workspace)/projects/api-key/page.tsx
| `/projects/create` // ../../../src/app/(workspace)/projects/create/page.tsx
| `/rag` // ../../../src/app/(workspace)/rag/page.tsx
| `/rag/chunks` // ../../../src/app/(workspace)/rag/chunks/page.tsx
| `/rag/maintenance` // ../../../src/app/(workspace)/rag/maintenance/page.tsx
| `/rag/runs` // ../../../src/app/(workspace)/rag/runs/page.tsx
| `/settings` // ../../../src/app/(workspace)/settings/page.tsx
| `/settings/spotify` // ../../../src/app/(workspace)/settings/spotify/page.tsx
type DynamicRoutes<T extends string = string> =
Expand Down
9 changes: 7 additions & 2 deletions apps/dash/.next/dev/types/routes.d.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
// This file is generated automatically by Next.js
// Do not edit this file manually

type AppRoutes = "/" | "/agent" | "/assets" | "/auth/callback/sent-success" | "/auth/login" | "/feed" | "/feed/create" | "/feed/drafts" | "/feed/edit/[id]" | "/feed/notes" | "/feed/posts" | "/onboarding" | "/onboarding/create" | "/projects" | "/projects/[slug]" | "/projects/api-key" | "/projects/create" | "/settings" | "/settings/spotify"
type AppRoutes = "/" | "/agent" | "/assets" | "/auth/callback/sent-success" | "/auth/login" | "/feed" | "/feed/create" | "/feed/drafts" | "/feed/edit/[id]" | "/feed/notes" | "/feed/posts" | "/onboarding" | "/onboarding/create" | "/projects" | "/projects/[slug]" | "/projects/api-key" | "/projects/create" | "/rag" | "/rag/chunks" | "/rag/maintenance" | "/rag/runs" | "/settings" | "/settings/spotify"
type AppRouteHandlerRoutes = "/api/v1/health"
type PageRoutes = never
type LayoutRoutes = "/" | "/auth" | "/feed" | "/onboarding" | "/settings"
type LayoutRoutes = "/" | "/auth" | "/feed" | "/onboarding" | "/rag" | "/settings"
type RedirectRoutes = never
type RewriteRoutes = never
type Routes = AppRoutes | PageRoutes | LayoutRoutes | RedirectRoutes | RewriteRoutes | AppRouteHandlerRoutes
Expand All @@ -30,6 +30,10 @@ interface ParamMap {
"/projects/[slug]": { "slug": string; }
"/projects/api-key": {}
"/projects/create": {}
"/rag": {}
"/rag/chunks": {}
"/rag/maintenance": {}
"/rag/runs": {}
"/settings": {}
"/settings/spotify": {}
}
Expand All @@ -42,6 +46,7 @@ interface LayoutSlotMap {
"/auth": never
"/feed": never
"/onboarding": never
"/rag": never
"/settings": never
}

Expand Down
6 changes: 6 additions & 0 deletions apps/dash/src/app/(workspace)/feed/(edit)/edit/[id]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,12 @@ const Page = async ({
<EditView
feedId={feed.id}
defaultValues={defaultValues}
// the drawer indexes by translation id, so it needs the ids the
// form itself has no use for
resources={feed.translations.map((t) => ({
locale: t.locale,
sourceId: t.id,
}))}
meta={{
embedding: Object.fromEntries(
feed.translations.map((t) => [t.locale, t.hasEmbedding])
Expand Down
24 changes: 24 additions & 0 deletions apps/dash/src/app/(workspace)/rag/chunks/page.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import "server-only";
import { Suspense } from "react";

import { Spinner } from "@heroui/react";

import { RagChunkExplorer } from "@/components/rag/rag-chunk-explorer";

export const dynamic = "force-dynamic";

const RagChunksPage = () => (
<section className="flex w-full flex-col gap-6">
<h1 className="text-2xl font-semibold">Chunks</h1>
<Suspense
fallback={
<div className="flex justify-center py-12">
<Spinner size="sm" />
</div>
}>
<RagChunkExplorer />
</Suspense>
</section>
);

export default RagChunksPage;
16 changes: 16 additions & 0 deletions apps/dash/src/app/(workspace)/rag/layout.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import type { ReactNode } from "react";
import { ViewTransition } from "react";

const Layout = ({ children }: { children: ReactNode }) => {
return (
<ViewTransition>
<article className="flex w-full justify-center">
<div className="w-full max-w-6xl px-4 py-8 md:px-6 lg:px-8">
{children}
</div>
</article>
</ViewTransition>
);
};

export default Layout;
13 changes: 13 additions & 0 deletions apps/dash/src/app/(workspace)/rag/maintenance/page.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import "server-only";
import { RagMaintenance } from "@/components/rag/rag-maintenance";

export const dynamic = "force-dynamic";

const RagMaintenancePage = () => (
<section className="flex w-full flex-col gap-6">
<h1 className="text-2xl font-semibold">Maintenance</h1>
<RagMaintenance />
</section>
);

export default RagMaintenancePage;
13 changes: 13 additions & 0 deletions apps/dash/src/app/(workspace)/rag/page.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import "server-only";
import { RagOverview } from "@/components/rag/rag-overview";

export const dynamic = "force-dynamic";

const RagPage = () => (
<section className="flex w-full flex-col gap-6">
<h1 className="text-2xl font-semibold">RAG</h1>
<RagOverview />
</section>
);

export default RagPage;
13 changes: 13 additions & 0 deletions apps/dash/src/app/(workspace)/rag/runs/page.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import "server-only";
import { RagRunsTable } from "@/components/rag/rag-runs-table";

export const dynamic = "force-dynamic";

const RagRunsPage = () => (
<section className="flex w-full flex-col gap-6">
<h1 className="text-2xl font-semibold">Index runs</h1>
<RagRunsTable />
</section>
);

export default RagRunsPage;
1 change: 1 addition & 0 deletions apps/dash/src/components/commons/app-sidebar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ export function AppSidebar({
<NavMain title="Overview" items={routeItems.overview} />
<NavMain title="Projects" items={routeItems.project} />
<NavMain title="Content" items={routeItems.content} />
<NavMain title="RAG" items={routeItems.rag} />
<NavMain title="Settings" items={routeItems.settings} />
</SidebarContent>
<SidebarFooter className="pb-4">
Expand Down
11 changes: 7 additions & 4 deletions apps/dash/src/components/commons/root-provider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { useState } from "react";

import { QueryClientProvider } from "@tanstack/react-query";
import { ThemeProvider } from "next-themes";
import { NuqsAdapter } from "nuqs/adapters/next/app";
import { Toaster as ST } from "sonner";

import type { Theme } from "@chia/ui/theme";
Expand All @@ -24,10 +25,12 @@ const RootProvider = ({ children }: Props) => {
const [queryClient] = useState(() => getQueryClient());
return (
<QueryClientProvider client={queryClient}>
<ThemeProvider defaultTheme="system" enableSystem attribute="class">
<Toaster />
{children}
</ThemeProvider>
<NuqsAdapter>
<ThemeProvider defaultTheme="system" enableSystem attribute="class">
<Toaster />
{children}
</ThemeProvider>
</NuqsAdapter>
</QueryClientProvider>
);
};
Expand Down
9 changes: 8 additions & 1 deletion apps/dash/src/components/feed/edit-fields.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
import { ErrorBoundary } from "@chia/ui/error-boundary";
import { cn } from "@chia/ui/utils/cn.util";

import type { EmbeddingResource } from "@/components/rag/embedding-drawer";

import type { MetaChipProps } from "./meta-chip";
import { MetadataFields } from "./metadata-fields";
import { SwitchEditor } from "./switch-editor";
Expand All @@ -15,12 +17,17 @@ interface Props {
token?: string;
feedId?: number;
meta?: MetaChipProps;
resources?: EmbeddingResource[];
}

export const EditFields = (props: Props) => {
return (
<div className={cn("flex flex-col gap-10", props.className)}>
<MetadataFields feedId={props.feedId} meta={props.meta} />
<MetadataFields
feedId={props.feedId}
meta={props.meta}
resources={props.resources}
/>
<ErrorBoundary>
<SwitchEditor />
</ErrorBoundary>
Expand Down
11 changes: 10 additions & 1 deletion apps/dash/src/components/feed/edit-form.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import { Locale } from "@chia/db/types";
import SubmitForm from "@chia/ui/submit-form";
import dayjs from "@chia/utils/day";

import type { EmbeddingResource } from "@/components/rag/embedding-drawer";
import { orpc } from "@/libs/orpc/client";
import { DraftProvider } from "@/store/draft";
import { formSchema } from "@/store/draft/slices/edit-fields";
Expand All @@ -25,9 +26,16 @@ export interface EditFormProps {
defaultValues: Partial<FormSchema>;
feedId: number;
meta?: MetaChipProps;
/** Translation ids, which the embedding drawer indexes by. */
resources?: EmbeddingResource[];
}

const EditForm = ({ defaultValues, feedId, meta }: EditFormProps) => {
const EditForm = ({
defaultValues,
feedId,
meta,
resources,
}: EditFormProps) => {
const queryClient = useQueryClient();
const router = useRouter();

Expand Down Expand Up @@ -81,6 +89,7 @@ const EditForm = ({ defaultValues, feedId, meta }: EditFormProps) => {
mode="edit"
feedId={feedId}
meta={meta}
resources={resources}
/>
<SubmitForm
className="w-full max-w-[150px]"
Expand Down
13 changes: 12 additions & 1 deletion apps/dash/src/components/feed/metadata-fields.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ import { Controller, useFormContext } from "react-hook-form";

import dayjs from "@chia/utils/day";

import { EmbeddingDrawer } from "@/components/rag/embedding-drawer";
import type { EmbeddingResource } from "@/components/rag/embedding-drawer";
import { useEditFields } from "@/store/draft";
import type { FormSchema } from "@/store/draft/slices/edit-fields";

Expand All @@ -31,7 +33,15 @@ import { SlugField } from "./slug-field";
import { TitleField } from "./title-field";

export const MetadataFields = memo(
({ feedId, meta }: { feedId?: number; meta?: MetaChipProps }) => {
({
feedId,
meta,
resources,
}: {
feedId?: number;
meta?: MetaChipProps;
resources?: EmbeddingResource[];
}) => {
const id = useId();
const form = useFormContext<FormSchema>();
const { disabled, mode } = useEditFields();
Expand All @@ -46,6 +56,7 @@ export const MetadataFields = memo(
{showMetaInfo && feedId && (
<div className="flex items-center gap-2">
<MetaChip {...meta} />
<EmbeddingDrawer feedId={feedId} resources={resources ?? []} />
<DeleteButton
feedId={feedId}
type={form.watch("type")}
Expand Down
Loading
Loading