Skip to content

Commit

Permalink
Merge pull request #249 from microsoft/package-upgrade
Browse files Browse the repository at this point in the history
Fix console warnings
  • Loading branch information
davidxw authored Nov 2, 2023
2 parents 1708a4a + 587b3b4 commit d05cda2
Show file tree
Hide file tree
Showing 12 changed files with 43 additions and 32 deletions.
2 changes: 1 addition & 1 deletion src/app/change-log/page.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Markdown } from "@/components/chat/markdown";
import { Markdown } from "@/components/markdown/markdown";
import { Card } from "@/components/ui/card";
import { VersionDisplay } from "@/features/change-log/version-display";
import { promises as fs } from "fs";
Expand Down
2 changes: 1 addition & 1 deletion src/app/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ export default function RootLayout({
children: React.ReactNode;
}) {
return (
<html lang="en" className="h-full overflow-hidden light">
<html lang="en" className="h-full overflow-hidden">
<body className={cn(inter.className, "flex w-full h-full")}>
<Providers>
<ThemeProvider attribute="class" defaultTheme="system" enableSystem>
Expand Down
2 changes: 1 addition & 1 deletion src/components/chat/chat-row.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ import { isNotNullOrEmpty } from "@/features/chat/chat-services/utils";
import { cn } from "@/lib/utils";
import { CheckIcon, ClipboardIcon, UserCircle } from "lucide-react";
import { FC, useState } from "react";
import { Markdown } from "../markdown/markdown";
import Typography from "../typography";
import { Avatar, AvatarImage } from "../ui/avatar";
import { Button } from "../ui/button";
import { Markdown } from "./markdown";

interface ChatRowProps {
name: string;
Expand Down
12 changes: 12 additions & 0 deletions src/components/markdown/config.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import { citation } from "@/features/chat/chat-ui/markdown/citation";
import { Config } from "@markdoc/markdoc";
import { paragraph } from "./paragraph";

export const citationConfig: Config = {
nodes: {
paragraph: paragraph,
},
tags: {
citation,
},
};
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
import Markdoc from "@markdoc/markdoc";
import React, { FC } from "react";
import {
Citation,
citationConfig,
} from "../../features/chat/chat-ui/markdown/citation";
import { Citation } from "../../features/chat/chat-ui/markdown/citation";
import { citationConfig } from "./config";
import { Paragraph } from "./paragraph";

interface Props {
content: string;
Expand All @@ -15,7 +14,8 @@ export const Markdown: FC<Props> = (props) => {
const content = Markdoc.transform(ast, {
...citationConfig,
});

return Markdoc.renderers.react(content, React, {
components: { Citation },
components: { Citation, Paragraph },
});
};
7 changes: 7 additions & 0 deletions src/components/markdown/paragraph.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
export const Paragraph = ({ children, className }: any) => {
return <div className={...className}>{children}</div>;
};

export const paragraph = {
render: "Paragraph",
};
9 changes: 4 additions & 5 deletions src/features/chat/chat-ui/chat-file/chat-file-slider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import { Button } from "@/components/ui/button";
import {
Sheet,
SheetContent,
SheetDescription,
SheetHeader,
SheetTitle,
SheetTrigger,
Expand All @@ -14,18 +13,18 @@ export const ChatFileSlider = () => {
return (
<div>
<Sheet>
<SheetTrigger>
<SheetTrigger asChild>
<Button size="icon" variant={"ghost"}>
<FileText size={16} />
</Button>
</SheetTrigger>
<SheetContent>
<SheetHeader>
<SheetTitle>Upload File</SheetTitle>
<SheetDescription>
<ChatFileUI />
</SheetDescription>
</SheetHeader>
<div className="py-4">
<ChatFileUI />
</div>
</SheetContent>
</Sheet>
</div>
Expand Down
2 changes: 1 addition & 1 deletion src/features/chat/chat-ui/chat-input/chat-input.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ const ChatInput: FC<Props> = (props) => {
onSubmit={submit}
className="absolute bottom-0 w-full flex items-center"
>
<div className="container mx-auto max-w-4xl relative py-2 flex gap-2 items-end items-center">
<div className="container mx-auto max-w-4xl relative py-2 flex gap-2 items-center">
{fileCHatVisible && <ChatFileSlider />}
<Textarea
rows={rows}
Expand Down
2 changes: 1 addition & 1 deletion src/features/chat/chat-ui/markdown/citation-action.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
"use server";

import { simpleSearch } from "../../chat-services/azure-cog-search/azure-cog-vector-store";
import { simpleSearch } from "@/features/chat/chat-services/azure-cog-search/azure-cog-vector-store";

export const CitationAction = async (
previousState: any,
Expand Down
8 changes: 4 additions & 4 deletions src/features/chat/chat-ui/markdown/citation-slider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import { Button } from "@/components/ui/button";
import {
Sheet,
SheetContent,
SheetDescription,
SheetHeader,
SheetTitle,
SheetTrigger,
Expand All @@ -21,13 +20,14 @@ export const CitationSlider: FC<SliderProps> = (props) => {
const [node, formAction] = useFormState(CitationAction, null);
return (
<form>
<input type="hidden" name="id" value={props.id} />
<Sheet>
<SheetTrigger>
<input type="hidden" name="id" value={props.id} />
<SheetTrigger asChild>
<Button
variant="outline"
size="sm"
formAction={formAction}
type="submit"
value={22}
>
{props.index}
Expand All @@ -36,8 +36,8 @@ export const CitationSlider: FC<SliderProps> = (props) => {
<SheetContent>
<SheetHeader>
<SheetTitle>Citation</SheetTitle>
<SheetDescription>{node}</SheetDescription>
</SheetHeader>
<div className="text-sm text-muted-foreground">{node}</div>
</SheetContent>
</Sheet>
</form>
Expand Down
17 changes: 6 additions & 11 deletions src/features/chat/chat-ui/markdown/citation.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
"use client";
import { Config } from "@markdoc/markdoc";
import { FC } from "react";
import { CitationSlider } from "./citation-slider";

Expand All @@ -12,16 +11,12 @@ interface Props {
items: Citation[];
}

export const citationConfig: Config = {
tags: {
citation: {
render: "Citation",
selfClosing: true,
attributes: {
items: {
type: Array,
},
},
export const citation = {
render: "Citation",
selfClosing: true,
attributes: {
items: {
type: Array,
},
},
};
Expand Down
2 changes: 0 additions & 2 deletions src/next.config.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
/** @type {import('next').NextConfig} */
const nextConfig = {
output: "standalone",
experimental: {
},
};

module.exports = nextConfig;

0 comments on commit d05cda2

Please sign in to comment.