mirror of
https://github.com/ChatGPTNextWeb/ChatGPT-Next-Web.git
synced 2025-10-01 23:56:39 +08:00
fix build error
This commit is contained in:
commit
3fd1035bfa
@ -1837,68 +1837,6 @@ function _Chat() {
|
|||||||
? Locale.Chat.IsContext
|
? Locale.Chat.IsContext
|
||||||
: message.date.toLocaleString()}
|
: message.date.toLocaleString()}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{showActions && (
|
|
||||||
<div className={styles["chat-message-actions"]}>
|
|
||||||
<div className={styles["chat-input-actions"]}>
|
|
||||||
{message.streaming ? (
|
|
||||||
<ChatAction
|
|
||||||
text={Locale.Chat.Actions.Stop}
|
|
||||||
icon={<StopIcon />}
|
|
||||||
onClick={() => onUserStop(message.id ?? i)}
|
|
||||||
/>
|
|
||||||
) : (
|
|
||||||
<>
|
|
||||||
<ChatAction
|
|
||||||
text={Locale.Chat.Actions.Retry}
|
|
||||||
icon={<ResetIcon />}
|
|
||||||
onClick={() => onResend(message)}
|
|
||||||
/>
|
|
||||||
|
|
||||||
<ChatAction
|
|
||||||
text={Locale.Chat.Actions.Delete}
|
|
||||||
icon={<DeleteIcon />}
|
|
||||||
onClick={() => onDelete(message.id ?? i)}
|
|
||||||
/>
|
|
||||||
|
|
||||||
<ChatAction
|
|
||||||
text={Locale.Chat.Actions.Pin}
|
|
||||||
icon={<PinIcon />}
|
|
||||||
onClick={() => onPinMessage(message)}
|
|
||||||
/>
|
|
||||||
<ChatAction
|
|
||||||
text={Locale.Chat.Actions.Copy}
|
|
||||||
icon={<CopyIcon />}
|
|
||||||
onClick={() =>
|
|
||||||
copyToClipboard(
|
|
||||||
getMessageTextContent(message),
|
|
||||||
)
|
|
||||||
}
|
|
||||||
/>
|
|
||||||
{config.ttsConfig.enable && (
|
|
||||||
<ChatAction
|
|
||||||
text={
|
|
||||||
speechStatus
|
|
||||||
? Locale.Chat.Actions.StopSpeech
|
|
||||||
: Locale.Chat.Actions.Speech
|
|
||||||
}
|
|
||||||
icon={
|
|
||||||
speechStatus ? (
|
|
||||||
<SpeakStopIcon />
|
|
||||||
) : (
|
|
||||||
<SpeakIcon />
|
|
||||||
)
|
|
||||||
}
|
|
||||||
onClick={() =>
|
|
||||||
openaiSpeech(getMessageTextContent(message))
|
|
||||||
}
|
|
||||||
/>
|
|
||||||
)}
|
|
||||||
</>
|
|
||||||
)}
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
)}
|
|
||||||
</div>
|
</div>
|
||||||
{message?.tools?.length == 0 && showTyping && (
|
{message?.tools?.length == 0 && showTyping && (
|
||||||
<div className={styles["chat-message-status"]}>
|
<div className={styles["chat-message-status"]}>
|
||||||
@ -2113,6 +2051,25 @@ function _Chat() {
|
|||||||
copyToClipboard(getMessageTextContent(message))
|
copyToClipboard(getMessageTextContent(message))
|
||||||
}
|
}
|
||||||
/>
|
/>
|
||||||
|
{config.ttsConfig.enable && (
|
||||||
|
<ChatAction
|
||||||
|
text={
|
||||||
|
speechStatus
|
||||||
|
? Locale.Chat.Actions.StopSpeech
|
||||||
|
: Locale.Chat.Actions.Speech
|
||||||
|
}
|
||||||
|
icon={
|
||||||
|
speechStatus ? (
|
||||||
|
<SpeakStopIcon />
|
||||||
|
) : (
|
||||||
|
<SpeakIcon />
|
||||||
|
)
|
||||||
|
}
|
||||||
|
onClick={() =>
|
||||||
|
openaiSpeech(getMessageTextContent(message))
|
||||||
|
}
|
||||||
|
/>
|
||||||
|
)}
|
||||||
</>
|
</>
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
import Fuse from "fuse.js";
|
import Fuse from "fuse.js";
|
||||||
import { getLang } from "../locales";
|
|
||||||
import { StoreKey } from "../constant";
|
|
||||||
import { nanoid } from "nanoid";
|
import { nanoid } from "nanoid";
|
||||||
|
import { StoreKey } from "../constant";
|
||||||
|
import { getLang } from "../locales";
|
||||||
import { createPersistStore } from "../utils/store";
|
import { createPersistStore } from "../utils/store";
|
||||||
|
|
||||||
export interface Prompt {
|
export interface Prompt {
|
||||||
@ -158,9 +158,14 @@ export const usePromptStore = createPersistStore(
|
|||||||
},
|
},
|
||||||
|
|
||||||
onRehydrateStorage(state) {
|
onRehydrateStorage(state) {
|
||||||
|
// Skip store rehydration on server side
|
||||||
|
if (typeof window === "undefined") {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const PROMPT_URL = "./prompts.json";
|
||||||
// const PROMPT_URL = "https://cos.xiaosi.cc/next/public/prompts.json";
|
// const PROMPT_URL = "https://cos.xiaosi.cc/next/public/prompts.json";
|
||||||
// const PROMPT_URL = "https://qn.xiaosi.cc/json/chat/prompts.json";
|
// const PROMPT_URL = "https://qn.xiaosi.cc/json/chat/prompts.json";
|
||||||
const PROMPT_URL = "./prompts.json"
|
|
||||||
const GPT_PROMPT_URL =
|
const GPT_PROMPT_URL =
|
||||||
"https://qn.xiaosi.cc/json/chat/prompt_library.json";
|
"https://qn.xiaosi.cc/json/chat/prompt_library.json";
|
||||||
|
|
||||||
|
@ -6,6 +6,9 @@ const localStorage = safeLocalStorage();
|
|||||||
|
|
||||||
class IndexedDBStorage implements StateStorage {
|
class IndexedDBStorage implements StateStorage {
|
||||||
public async getItem(name: string): Promise<string | null> {
|
public async getItem(name: string): Promise<string | null> {
|
||||||
|
if (typeof window === "undefined") {
|
||||||
|
return;
|
||||||
|
}
|
||||||
try {
|
try {
|
||||||
const value = (await get(name)) || localStorage.getItem(name);
|
const value = (await get(name)) || localStorage.getItem(name);
|
||||||
return value;
|
return value;
|
||||||
@ -15,6 +18,9 @@ class IndexedDBStorage implements StateStorage {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public async setItem(name: string, value: string): Promise<void> {
|
public async setItem(name: string, value: string): Promise<void> {
|
||||||
|
if (typeof window === "undefined") {
|
||||||
|
return;
|
||||||
|
}
|
||||||
try {
|
try {
|
||||||
const _value = JSON.parse(value);
|
const _value = JSON.parse(value);
|
||||||
if (!_value?.state?._hasHydrated) {
|
if (!_value?.state?._hasHydrated) {
|
||||||
|
@ -35,7 +35,7 @@ export function createPersistStore<T extends object, M>(
|
|||||||
persistOptions: SecondParam<typeof persist<T & M & MakeUpdater<T>>>,
|
persistOptions: SecondParam<typeof persist<T & M & MakeUpdater<T>>>,
|
||||||
) {
|
) {
|
||||||
// TODO: merge 报错,很离谱,后续再排查
|
// TODO: merge 报错,很离谱,后续再排查
|
||||||
// persistOptions.storage = createJSONStorage(() => indexedDBStorage);
|
persistOptions.storage = createJSONStorage(() => indexedDBStorage);
|
||||||
const oldOonRehydrateStorage = persistOptions?.onRehydrateStorage;
|
const oldOonRehydrateStorage = persistOptions?.onRehydrateStorage;
|
||||||
persistOptions.onRehydrateStorage = (state) => {
|
persistOptions.onRehydrateStorage = (state) => {
|
||||||
oldOonRehydrateStorage?.(state);
|
oldOonRehydrateStorage?.(state);
|
||||||
|
Loading…
Reference in New Issue
Block a user