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/Jetbrains-Mono" 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>
</head>
<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 (
<Dialog>
<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`} />
</ChatAction>
</DialogTrigger>

View File

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

View File

@ -43,7 +43,8 @@ function ChatInterface({ setTarget, setWorking }: ChatInterfaceProps) {
const offset = el.scrollTop - position;
setPosition(el.scrollTop);
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(
el,

View File

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

View File

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

View File

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

View File

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