Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support custom emoji url #470

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion app/components/chat.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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: () => <LoadingIcon />,
});
Expand All @@ -50,7 +52,13 @@ export function Avatar(props: { role: Message["role"] }) {

return (
<div className={styles["user-avtar"]}>
<Emoji unified={config.avatar} size={18} />
<Emoji
unified={config.avatar}
size={18}
getEmojiUrl={(unified = config.avatar) =>
`${getEmojiUrl}${unified}.png`
}
/>
</div>
);
}
Expand Down
5 changes: 5 additions & 0 deletions app/components/settings.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -180,6 +182,9 @@ export function Settings(props: { closeSettings: () => void }) {
onClose={() => setShowEmojiPicker(false)}
content={
<EmojiPicker
getEmojiUrl={(unified = config.avatar) =>
`${getEmojiUrl}${unified}.png`
}
lazyLoadEmojis
theme={EmojiTheme.AUTO}
onEmojiClick={(e) => {
Expand Down
3 changes: 3 additions & 0 deletions config.ts
Original file line number Diff line number Diff line change
@@ -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/"