Skip to content

Commit

Permalink
尝试修复下
Browse files Browse the repository at this point in the history
  • Loading branch information
fatwang2 committed Mar 30, 2024
1 parent d0530d4 commit f503915
Show file tree
Hide file tree
Showing 7 changed files with 14 additions and 12 deletions.
4 changes: 2 additions & 2 deletions web/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions web/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"lint": "next lint"
},
"dependencies": {
"@next/third-parties": "^14.1.4",
"@next/third-parties": "^14.0.4",
"@radix-ui/react-popover": "^1.0.7",
"@tailwindcss/forms": "^0.5.7",
"@upstash/ratelimit": "^1.0.0",
Expand All @@ -21,7 +21,7 @@
"lucide-react": "^0.309.0",
"mdast-util-from-markdown": "^2.0.0",
"nanoid": "^5.0.4",
"next": "^14.1.4",
"next": "^14.0.4",
"react": "^18",
"react-dom": "^18",
"react-markdown": "^9.0.1",
Expand Down
6 changes: 4 additions & 2 deletions web/src/app/components/answer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import { Source } from "@/app/interfaces/source";
import { BookOpenText } from "lucide-react";
import { FC } from "react";
import Markdown from "react-markdown";
import Image from "next/image";

export const Answer: FC<{ markdown: string; sources: Source[] }> = ({
markdown,
Expand Down Expand Up @@ -51,11 +52,12 @@ export const Answer: FC<{ markdown: string; sources: Source[] }> = ({
<div className="flex gap-4">
{source.primaryImageOfPage?.thumbnailUrl && (
<div className="flex-none">
<img
<Image
className="rounded h-16 w-16"
width={source.primaryImageOfPage?.width}
height={source.primaryImageOfPage?.height}
src={source.primaryImageOfPage?.thumbnailUrl}
alt={source.url}
/>
</div>
)}
Expand All @@ -79,7 +81,7 @@ export const Answer: FC<{ markdown: string; sources: Source[] }> = ({
</div>
</div>
<div className="flex-none flex items-center relative">
<img
<Image
className="h-3 w-3"
alt={source.url}
src={`https://www.google.com/s2/favicons?domain=${source.url}&sz=${16}`}
Expand Down
3 changes: 1 addition & 2 deletions web/src/app/components/preset-query.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@ import Link from "next/link";
import React, { FC, useMemo } from "react";

export const PresetQuery: FC<{ query: string }> = ({ query }) => {
const rid = useMemo(() => nanoid(), [query]);

const rid = useMemo(() => nanoid(), []);
return (
<Link
prefetch={false}
Expand Down
2 changes: 1 addition & 1 deletion web/src/app/components/result.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ export const Result: FC<{ query: string; rid: string }> = ({ query, rid }) => {
return () => {
controller.abort();
};
}, [query]);
}, [query, rid]);
return (
<div className="flex flex-col gap-8">
<Answer markdown={markdown} sources={sources}></Answer>
Expand Down
3 changes: 2 additions & 1 deletion web/src/app/components/sources.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { Wrapper } from "@/app/components/wrapper";
import { Source } from "@/app/interfaces/source";
import { BookText } from "lucide-react";
import { FC } from "react";
import Image from "next/image";

const SourceItem: FC<{ source: Source; index: number }> = ({
source,
Expand All @@ -26,7 +27,7 @@ const SourceItem: FC<{ source: Source; index: number }> = ({
</div>
</div>
<div className="flex-none flex items-center">
<img
<Image
className="h-3 w-3"
alt={domain}
src={`https://www.google.com/s2/favicons?domain=${domain}&sz=${16}`}
Expand Down
4 changes: 2 additions & 2 deletions web/src/app/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import type { Metadata } from "next";
import { Inter } from "next/font/google";
import "./globals.css";
import { ReactNode } from "react";
import { GoogleAnalytics } from '@next/third-parties/google';
import { GoogleAnalytics } from "@next/third-parties/google";

const inter = Inter({ subsets: ["latin"] });

Expand All @@ -16,7 +16,7 @@ export default function RootLayout({ children }: { children: ReactNode }) {
return (
<html lang="en">
<body className={inter.className}>{children}</body>
<GoogleAnalytics gaId={process.env.NEXT_PUBLIC_GOOGLE_ANALYTICS || ''} />
<GoogleAnalytics gaId={process.env.NEXT_PUBLIC_GOOGLE_ANALYTICS || ""} />
</html>
);
}

0 comments on commit f503915

Please sign in to comment.