mirror of
https://github.com/ChatGPTNextWeb/ChatGPT-Next-Web.git
synced 2025-10-08 19:16:37 +08:00
Merge remote-tracking branch 'upstream/main' into dev
This commit is contained in:
commit
8e27255691
@ -1,5 +1,5 @@
|
|||||||
import { useDebouncedCallback } from "use-debounce";
|
import { useDebouncedCallback } from "use-debounce";
|
||||||
import { useState, useRef, useEffect, useLayoutEffect } from "react";
|
import { memo, useState, useRef, useEffect, useLayoutEffect } from "react";
|
||||||
|
|
||||||
import SendWhiteIcon from "../icons/send-white.svg";
|
import SendWhiteIcon from "../icons/send-white.svg";
|
||||||
import BrainIcon from "../icons/brain.svg";
|
import BrainIcon from "../icons/brain.svg";
|
||||||
@ -17,6 +17,7 @@ import { Message, SubmitKey, useChatStore, BOT_HELLO, ROLES } from "../store";
|
|||||||
import {
|
import {
|
||||||
copyToClipboard,
|
copyToClipboard,
|
||||||
downloadAs,
|
downloadAs,
|
||||||
|
getEmojiUrl,
|
||||||
isMobileScreen,
|
isMobileScreen,
|
||||||
selectOrCopy,
|
selectOrCopy,
|
||||||
} from "../utils";
|
} from "../utils";
|
||||||
@ -33,7 +34,7 @@ import chatStyle from "./chat.module.scss";
|
|||||||
|
|
||||||
import { Modal, showModal, showToast } from "./ui-lib";
|
import { Modal, showModal, showToast } from "./ui-lib";
|
||||||
|
|
||||||
const Markdown = dynamic(async () => (await import("./markdown")).Markdown, {
|
const Markdown = dynamic(async () => memo((await import("./markdown")).Markdown), {
|
||||||
loading: () => <LoadingIcon />,
|
loading: () => <LoadingIcon />,
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -50,7 +51,7 @@ export function Avatar(props: { role: Message["role"] }) {
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<div className={styles["user-avtar"]}>
|
<div className={styles["user-avtar"]}>
|
||||||
<Emoji unified={config.avatar} size={18} />
|
<Emoji unified={config.avatar} size={18} getEmojiUrl={getEmojiUrl} />
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@ -60,7 +61,9 @@ function exportMessages(messages: Message[], topic: string) {
|
|||||||
`# ${topic}\n\n` +
|
`# ${topic}\n\n` +
|
||||||
messages
|
messages
|
||||||
.map((m) => {
|
.map((m) => {
|
||||||
return m.role === "user" ? `## ${m.content}` : m.content.trim();
|
return m.role === "user"
|
||||||
|
? `## ${Locale.Export.MessageFromYou}:\n${m.content}`
|
||||||
|
: `## ${Locale.Export.MessageFromChatGPT}:\n${m.content.trim()}`;
|
||||||
})
|
})
|
||||||
.join("\n\n");
|
.join("\n\n");
|
||||||
const filename = `${topic}.md`;
|
const filename = `${topic}.md`;
|
||||||
|
@ -26,7 +26,7 @@ import {
|
|||||||
import { Avatar } from "./chat";
|
import { Avatar } from "./chat";
|
||||||
|
|
||||||
import Locale, { AllLangs, changeLang, getLang } from "../locales";
|
import Locale, { AllLangs, changeLang, getLang } from "../locales";
|
||||||
import { getCurrentVersion } from "../utils";
|
import { getCurrentVersion, getEmojiUrl } from "../utils";
|
||||||
import Link from "next/link";
|
import Link from "next/link";
|
||||||
import { UPDATE_URL } from "../constant";
|
import { UPDATE_URL } from "../constant";
|
||||||
import { SearchService, usePromptStore } from "../store/prompt";
|
import { SearchService, usePromptStore } from "../store/prompt";
|
||||||
@ -113,7 +113,6 @@ export function Settings(props: { closeSettings: () => void }) {
|
|||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
checkUpdate();
|
checkUpdate();
|
||||||
checkUsage();
|
|
||||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
@ -182,6 +181,7 @@ export function Settings(props: { closeSettings: () => void }) {
|
|||||||
<EmojiPicker
|
<EmojiPicker
|
||||||
lazyLoadEmojis
|
lazyLoadEmojis
|
||||||
theme={EmojiTheme.AUTO}
|
theme={EmojiTheme.AUTO}
|
||||||
|
getEmojiUrl={getEmojiUrl}
|
||||||
onEmojiClick={(e) => {
|
onEmojiClick={(e) => {
|
||||||
updateConfig((config) => (config.avatar = e.unified));
|
updateConfig((config) => (config.avatar = e.unified));
|
||||||
setShowEmojiPicker(false);
|
setShowEmojiPicker(false);
|
||||||
@ -417,7 +417,7 @@ export function Settings(props: { closeSettings: () => void }) {
|
|||||||
value={config.historyMessageCount}
|
value={config.historyMessageCount}
|
||||||
min="0"
|
min="0"
|
||||||
max="25"
|
max="25"
|
||||||
step="2"
|
step="1"
|
||||||
onChange={(e) =>
|
onChange={(e) =>
|
||||||
updateConfig(
|
updateConfig(
|
||||||
(config) =>
|
(config) =>
|
||||||
|
@ -10,6 +10,7 @@
|
|||||||
|
|
||||||
.window-header-title {
|
.window-header-title {
|
||||||
max-width: calc(100% - 100px);
|
max-width: calc(100% - 100px);
|
||||||
|
overflow: hidden;
|
||||||
|
|
||||||
.window-header-main-title {
|
.window-header-main-title {
|
||||||
font-size: 20px;
|
font-size: 20px;
|
||||||
|
@ -33,6 +33,8 @@ const cn = {
|
|||||||
Title: "导出聊天记录为 Markdown",
|
Title: "导出聊天记录为 Markdown",
|
||||||
Copy: "全部复制",
|
Copy: "全部复制",
|
||||||
Download: "下载文件",
|
Download: "下载文件",
|
||||||
|
MessageFromYou: "来自你的消息",
|
||||||
|
MessageFromChatGPT: "来自 ChatGPT 的消息",
|
||||||
},
|
},
|
||||||
Memory: {
|
Memory: {
|
||||||
Title: "历史记忆",
|
Title: "历史记忆",
|
||||||
|
@ -35,6 +35,8 @@ const en: LocaleType = {
|
|||||||
Title: "All Messages",
|
Title: "All Messages",
|
||||||
Copy: "Copy All",
|
Copy: "Copy All",
|
||||||
Download: "Download",
|
Download: "Download",
|
||||||
|
MessageFromYou: "Message From You",
|
||||||
|
MessageFromChatGPT: "Message From ChatGPT",
|
||||||
},
|
},
|
||||||
Memory: {
|
Memory: {
|
||||||
Title: "Memory Prompt",
|
Title: "Memory Prompt",
|
||||||
|
@ -35,6 +35,8 @@ const es: LocaleType = {
|
|||||||
Title: "Todos los mensajes",
|
Title: "Todos los mensajes",
|
||||||
Copy: "Copiar todo",
|
Copy: "Copiar todo",
|
||||||
Download: "Descargar",
|
Download: "Descargar",
|
||||||
|
MessageFromYou: "Mensaje de ti",
|
||||||
|
MessageFromChatGPT: "Mensaje de ChatGPT",
|
||||||
},
|
},
|
||||||
Memory: {
|
Memory: {
|
||||||
Title: "Historial de memoria",
|
Title: "Historial de memoria",
|
||||||
|
@ -35,6 +35,8 @@ const it: LocaleType = {
|
|||||||
Title: "Tutti i messaggi",
|
Title: "Tutti i messaggi",
|
||||||
Copy: "Copia tutto",
|
Copy: "Copia tutto",
|
||||||
Download: "Scarica",
|
Download: "Scarica",
|
||||||
|
MessageFromYou: "Messaggio da te",
|
||||||
|
MessageFromChatGPT: "Messaggio da ChatGPT",
|
||||||
},
|
},
|
||||||
Memory: {
|
Memory: {
|
||||||
Title: "Prompt di memoria",
|
Title: "Prompt di memoria",
|
||||||
|
@ -34,6 +34,8 @@ const tw: LocaleType = {
|
|||||||
Title: "匯出聊天記錄為 Markdown",
|
Title: "匯出聊天記錄為 Markdown",
|
||||||
Copy: "複製全部",
|
Copy: "複製全部",
|
||||||
Download: "下載檔案",
|
Download: "下載檔案",
|
||||||
|
MessageFromYou: "來自你的訊息",
|
||||||
|
MessageFromChatGPT: "來自 ChatGPT 的訊息",
|
||||||
},
|
},
|
||||||
Memory: {
|
Memory: {
|
||||||
Title: "上下文記憶 Prompt",
|
Title: "上下文記憶 Prompt",
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
import { EmojiStyle } from "emoji-picker-react";
|
||||||
import { showToast } from "./components/ui-lib";
|
import { showToast } from "./components/ui-lib";
|
||||||
import Locale from "./locales";
|
import Locale from "./locales";
|
||||||
|
|
||||||
@ -81,3 +82,7 @@ export function getCurrentVersion() {
|
|||||||
|
|
||||||
return currentId;
|
return currentId;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function getEmojiUrl(unified: string, style: EmojiStyle) {
|
||||||
|
return `https://cdn.staticfile.org/emoji-datasource-apple/14.0.0/img/${style}/64/${unified}.png`;
|
||||||
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user