diff --git a/app/components/chat.tsx b/app/components/chat.tsx
index b5f7a0153..29091aced 100644
--- a/app/components/chat.tsx
+++ b/app/components/chat.tsx
@@ -1837,68 +1837,6 @@ function _Chat() {
? Locale.Chat.IsContext
: message.date.toLocaleString()}
-
- {showActions && (
-
-
- {message.streaming ? (
- }
- onClick={() => onUserStop(message.id ?? i)}
- />
- ) : (
- <>
- }
- onClick={() => onResend(message)}
- />
-
- }
- onClick={() => onDelete(message.id ?? i)}
- />
-
- }
- onClick={() => onPinMessage(message)}
- />
- }
- onClick={() =>
- copyToClipboard(
- getMessageTextContent(message),
- )
- }
- />
- {config.ttsConfig.enable && (
-
- ) : (
-
- )
- }
- onClick={() =>
- openaiSpeech(getMessageTextContent(message))
- }
- />
- )}
- >
- )}
-
-
- )}
{message?.tools?.length == 0 && showTyping && (
@@ -2113,6 +2051,25 @@ function _Chat() {
copyToClipboard(getMessageTextContent(message))
}
/>
+ {config.ttsConfig.enable && (
+
+ ) : (
+
+ )
+ }
+ onClick={() =>
+ openaiSpeech(getMessageTextContent(message))
+ }
+ />
+ )}
>
)}
diff --git a/app/store/prompt.ts b/app/store/prompt.ts
index 5a1e2cfd6..9c4f5c4bc 100644
--- a/app/store/prompt.ts
+++ b/app/store/prompt.ts
@@ -1,7 +1,7 @@
import Fuse from "fuse.js";
-import { getLang } from "../locales";
-import { StoreKey } from "../constant";
import { nanoid } from "nanoid";
+import { StoreKey } from "../constant";
+import { getLang } from "../locales";
import { createPersistStore } from "../utils/store";
export interface Prompt {
@@ -158,9 +158,14 @@ export const usePromptStore = createPersistStore(
},
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://qn.xiaosi.cc/json/chat/prompts.json";
- const PROMPT_URL = "./prompts.json"
const GPT_PROMPT_URL =
"https://qn.xiaosi.cc/json/chat/prompt_library.json";
diff --git a/app/utils/indexedDB-storage.ts b/app/utils/indexedDB-storage.ts
index 51417e9f3..114644c66 100644
--- a/app/utils/indexedDB-storage.ts
+++ b/app/utils/indexedDB-storage.ts
@@ -6,6 +6,9 @@ const localStorage = safeLocalStorage();
class IndexedDBStorage implements StateStorage {
public async getItem(name: string): Promise {
+ if (typeof window === "undefined") {
+ return;
+ }
try {
const value = (await get(name)) || localStorage.getItem(name);
return value;
@@ -15,6 +18,9 @@ class IndexedDBStorage implements StateStorage {
}
public async setItem(name: string, value: string): Promise {
+ if (typeof window === "undefined") {
+ return;
+ }
try {
const _value = JSON.parse(value);
if (!_value?.state?._hasHydrated) {
diff --git a/app/utils/store.ts b/app/utils/store.ts
index 2eef302ac..b3440b318 100644
--- a/app/utils/store.ts
+++ b/app/utils/store.ts
@@ -35,7 +35,7 @@ export function createPersistStore(
persistOptions: SecondParam>>,
) {
// TODO: merge 报错,很离谱,后续再排查
- // persistOptions.storage = createJSONStorage(() => indexedDBStorage);
+ persistOptions.storage = createJSONStorage(() => indexedDBStorage);
const oldOonRehydrateStorage = persistOptions?.onRehydrateStorage;
persistOptions.onRehydrateStorage = (state) => {
oldOonRehydrateStorage?.(state);