From e67a5be4ed49e4c20d345add7888307ebf8de8ed Mon Sep 17 00:00:00 2001 From: hibobmaster <32976627+hibobmaster@users.noreply.github.com> Date: Tue, 4 Apr 2023 21:37:23 +0800 Subject: [PATCH] Support custom emoji url --- app/components/chat.tsx | 10 +++++++++- app/components/settings.tsx | 5 +++++ config.ts | 3 +++ 3 files changed, 17 insertions(+), 1 deletion(-) create mode 100644 config.ts diff --git a/app/components/chat.tsx b/app/components/chat.tsx index 7aa8bfec6..35d679f79 100644 --- a/app/components/chat.tsx +++ b/app/components/chat.tsx @@ -33,6 +33,8 @@ import chatStyle from "./chat.module.scss"; import { Modal, showModal, showToast } from "./ui-lib"; +import { getEmojiUrl } from "@/config"; + const Markdown = dynamic(async () => (await import("./markdown")).Markdown, { loading: () => , }); @@ -50,7 +52,13 @@ export function Avatar(props: { role: Message["role"] }) { return (
- + + `${getEmojiUrl}${unified}.png` + } + />
); } diff --git a/app/components/settings.tsx b/app/components/settings.tsx index 4645f3191..53c4485e5 100644 --- a/app/components/settings.tsx +++ b/app/components/settings.tsx @@ -33,6 +33,8 @@ import { SearchService, usePromptStore } from "../store/prompt"; import { requestUsage } from "../requests"; import { ErrorBoundary } from "./error"; +import { getEmojiUrl } from "@/config"; + function SettingItem(props: { title: string; subTitle?: string; @@ -180,6 +182,9 @@ export function Settings(props: { closeSettings: () => void }) { onClose={() => setShowEmojiPicker(false)} content={ + `${getEmojiUrl}${unified}.png` + } lazyLoadEmojis theme={EmojiTheme.AUTO} onEmojiClick={(e) => { diff --git a/config.ts b/config.ts new file mode 100644 index 000000000..1de4bee8f --- /dev/null +++ b/config.ts @@ -0,0 +1,3 @@ +// export const getEmojiUrl = 反代的地址 ?? "https://cdn.jsdelivr.net/npm/emoji-datasource-apple/img/apple/64/" +// https://github.com/ealush/emoji-picker-react/blob/master/src/config/cdnUrls.ts +export const getEmojiUrl = null ?? "https://cdn.jsdelivr.net/npm/emoji-datasource-apple/img/apple/64/" \ No newline at end of file