update pwa icons

This commit is contained in:
Zhang Minghan 2023-11-27 18:20:49 +08:00
parent 6a0bf4bebb
commit 94f714e25e
12 changed files with 52 additions and 47 deletions

View File

@ -14,6 +14,7 @@
<link href="https://open.lightxi.com/fonts/Andika" rel="stylesheet"> <link href="https://open.lightxi.com/fonts/Andika" rel="stylesheet">
<link href="https://open.lightxi.com/fonts/Jetbrains-Mono" rel="stylesheet"> <link href="https://open.lightxi.com/fonts/Jetbrains-Mono" rel="stylesheet">
<link href="https://open.lightxi.com/jsdelivr/npm/katex@0.16.0/dist/katex.min.css" rel="stylesheet"> <link href="https://open.lightxi.com/jsdelivr/npm/katex@0.16.0/dist/katex.min.css" rel="stylesheet">
<link rel="manifest" href="/site.webmanifest">
<script src="/workbox.js" defer></script> <script src="/workbox.js" defer></script>
</head> </head>
<body> <body>

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 37 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.5 KiB

View File

@ -0,0 +1,20 @@
{
"name": "Chat Nio",
"short_name": "ChatNio",
"icons": [
{
"src": "/service/android-chrome-192x192.png",
"sizes": "192x192",
"type": "image/png"
},
{
"src": "/service/android-chrome-512x512.png",
"sizes": "512x512",
"type": "image/png"
}
],
"start_url": "/",
"theme_color": "#000000",
"background_color": "#0000000",
"display": "standalone"
}

View File

@ -65,7 +65,10 @@ function FileProvider({ value, onChange }: FileProviderProps) {
return ( return (
<Dialog> <Dialog>
<DialogTrigger asChild> <DialogTrigger asChild>
<ChatAction text={t("file.upload")} className={value.length > 0 ? "active" : ""}> <ChatAction
text={t("file.upload")}
className={value.length > 0 ? "active" : ""}
>
<Plus className={`h-4 w-4`} /> <Plus className={`h-4 w-4`} />
</ChatAction> </ChatAction>
</DialogTrigger> </DialogTrigger>

View File

@ -1,22 +1,22 @@
import {LightAsync as SyntaxHighlighter} from "react-syntax-highlighter"; import { LightAsync as SyntaxHighlighter } from "react-syntax-highlighter";
import {atomOneDark as style} from "react-syntax-highlighter/dist/esm/styles/hljs"; import { atomOneDark as style } from "react-syntax-highlighter/dist/esm/styles/hljs";
import ReactMarkdown from "react-markdown"; import ReactMarkdown from "react-markdown";
import remarkGfm from "remark-gfm"; import remarkGfm from "remark-gfm";
import remarkMath from "remark-math"; import remarkMath from "remark-math";
import remarkBreaks from "remark-breaks"; import remarkBreaks from "remark-breaks";
import rehypeKatex from "rehype-katex"; import rehypeKatex from "rehype-katex";
import {parseFile} from "./plugins/file.tsx"; import { parseFile } from "./plugins/file.tsx";
import "@/assets/markdown/all.less"; import "@/assets/markdown/all.less";
import {useEffect, useMemo} from "react"; import { useEffect, useMemo } from "react";
import {useDispatch} from "react-redux"; import { useDispatch } from "react-redux";
import {openDialog as openQuotaDialog} from "@/store/quota.ts"; import { openDialog as openQuotaDialog } from "@/store/quota.ts";
import {openDialog as openSubscriptionDialog} from "@/store/subscription.ts"; import { openDialog as openSubscriptionDialog } from "@/store/subscription.ts";
import {AppDispatch} from "@/store"; import { AppDispatch } from "@/store";
import {Copy} from "lucide-react"; import { Copy } from "lucide-react";
import {copyClipboard} from "@/utils/dom.ts"; import { copyClipboard } from "@/utils/dom.ts";
import {useToast} from "./ui/use-toast.ts"; import { useToast } from "./ui/use-toast.ts";
import {useTranslation} from "react-i18next"; import { useTranslation } from "react-i18next";
import {parseProgressbar} from "@/components/plugins/progress.tsx"; import { parseProgressbar } from "@/components/plugins/progress.tsx";
type MarkdownProps = { type MarkdownProps = {
children: string; children: string;
@ -125,12 +125,10 @@ function MarkdownContent({ children, className }: MarkdownProps) {
function Markdown(props: MarkdownProps) { function Markdown(props: MarkdownProps) {
// memoize the component // memoize the component
const { children, className } = props; const { children, className } = props;
return useMemo(() => ( return useMemo(
<MarkdownContent className={className}>{children}</MarkdownContent> () => <MarkdownContent className={className}>{children}</MarkdownContent>,
), [ [props.children, props.className],
props.children, );
props.className,
]);
} }
export default Markdown; export default Markdown;

View File

@ -43,7 +43,8 @@ function ChatInterface({ setTarget, setWorking }: ChatInterfaceProps) {
const offset = el.scrollTop - position; const offset = el.scrollTop - position;
setPosition(el.scrollTop); setPosition(el.scrollTop);
if (offset < 0) setScrollable(false); if (offset < 0) setScrollable(false);
else setScrollable(el.scrollTop + el.clientHeight + 20 >= el.scrollHeight); else
setScrollable(el.scrollTop + el.clientHeight + 20 >= el.scrollHeight);
}; };
return addEventListeners( return addEventListeners(
el, el,

View File

@ -1,10 +1,5 @@
import SelectGroup, { SelectItemProps } from "@/components/SelectGroup.tsx"; import SelectGroup, { SelectItemProps } from "@/components/SelectGroup.tsx";
import { import { expensiveModels, login, supportModels } from "@/conf.ts";
expensiveModels,
login,
studentModels,
supportModels,
} from "@/conf.ts";
import { import {
getPlanModels, getPlanModels,
openMarket, openMarket,
@ -32,19 +27,13 @@ type ModelSelectorProps = {
side?: "left" | "right" | "top" | "bottom"; side?: "left" | "right" | "top" | "bottom";
}; };
function filterModel(model: Model, level: number, student: boolean) { function filterModel(model: Model, level: number) {
if (getPlanModels(level).includes(model.id)) { if (getPlanModels(level).includes(model.id)) {
return { return {
name: model.id, name: model.id,
value: model.name, value: model.name,
badge: { variant: "gold", name: "plus" }, badge: { variant: "gold", name: "plus" },
} as SelectItemProps; } as SelectItemProps;
} else if (student && studentModels.includes(model.id)) {
return {
name: model.id,
value: model.name,
badge: { variant: "gold", name: "student" },
} as SelectItemProps;
} else if (expensiveModels.includes(model.id)) { } else if (expensiveModels.includes(model.id)) {
return { return {
name: model.id, name: model.id,
@ -82,9 +71,7 @@ function ModelFinder(props: ModelSelectorProps) {
const models = useMemo(() => { const models = useMemo(() => {
const raw = supportModels.filter((model) => list.includes(model.id)); const raw = supportModels.filter((model) => list.includes(model.id));
return [ return [
...raw.map( ...raw.map((model: Model): SelectItemProps => filterModel(model, level)),
(model: Model): SelectItemProps => filterModel(model, level, student),
),
{ {
icon: <Sparkles size={16} />, icon: <Sparkles size={16} />,
name: "market", name: "market",

View File

@ -10,7 +10,7 @@ import {
X, X,
} from "lucide-react"; } from "lucide-react";
import React, { useMemo, useState } from "react"; import React, { useMemo, useState } from "react";
import { login, modelAvatars, studentModels, supportModels } from "@/conf.ts"; import { login, modelAvatars, supportModels } from "@/conf.ts";
import { splitList } from "@/utils/base.ts"; import { splitList } from "@/utils/base.ts";
import { Model } from "@/api/types.ts"; import { Model } from "@/api/types.ts";
import { useDispatch, useSelector } from "react-redux"; import { useDispatch, useSelector } from "react-redux";
@ -81,10 +81,7 @@ function ModelItem({ model, className, style }: ModelProps) {
}, [model, current, list]); }, [model, current, list]);
const pro = useMemo(() => { const pro = useMemo(() => {
return ( return getPlanModels(level).includes(model.id);
getPlanModels(level).includes(model.id) ||
(student && studentModels.includes(model.id))
);
}, [model, level, student]); }, [model, level, student]);
const avatar = useMemo(() => { const avatar = useMemo(() => {

View File

@ -4,9 +4,9 @@ import { chatEvent } from "@/events/chat.ts";
import { addEventListeners, scrollDown } from "@/utils/dom.ts"; import { addEventListeners, scrollDown } from "@/utils/dom.ts";
import { ChatAction } from "@/components/home/assemblies/ChatAction.tsx"; import { ChatAction } from "@/components/home/assemblies/ChatAction.tsx";
import { useTranslation } from "react-i18next"; import { useTranslation } from "react-i18next";
import {Message} from "@/api/types.ts"; import { Message } from "@/api/types.ts";
import {useSelector} from "react-redux"; import { useSelector } from "react-redux";
import {selectMessages} from "@/store/chat.ts"; import { selectMessages } from "@/store/chat.ts";
type ScrollActionProps = { type ScrollActionProps = {
visible: boolean; visible: boolean;

View File

@ -338,8 +338,6 @@ export const largeContextModels = [
"zhipu-chatglm-turbo", "zhipu-chatglm-turbo",
]; ];
export const studentModels = ["claude-2-100k", "claude-2"];
export const planModels: PlanModel[] = [ export const planModels: PlanModel[] = [
{ id: "gpt-4-0613", level: 1 }, { id: "gpt-4-0613", level: 1 },
{ id: "gpt-4-1106-preview", level: 1 }, { id: "gpt-4-1106-preview", level: 1 },