diff --git a/src/components/Option/Settings/tts-mode.tsx b/src/components/Option/Settings/tts-mode.tsx
new file mode 100644
index 0000000..bf5ad36
--- /dev/null
+++ b/src/components/Option/Settings/tts-mode.tsx
@@ -0,0 +1,116 @@
+import { SaveButton } from "@/components/Common/SaveButton"
+import { getTTSSettings, setTTSSettings } from "@/services/tts"
+import { useWebUI } from "@/store/webui"
+import { useForm } from "@mantine/form"
+import { useQuery } from "@tanstack/react-query"
+import { Select, Skeleton, Switch } from "antd"
+import { useTranslation } from "react-i18next"
+
+export const TTSModeSettings = ({ hideBorder }: { hideBorder?: boolean }) => {
+ const { t } = useTranslation("settings")
+ const { setTTSEnabled } = useWebUI()
+
+ const form = useForm({
+ initialValues: {
+ ttsEnabled: false,
+ ttsProvider: "",
+ voice: "",
+ ssmlEnabled: false
+ }
+ })
+
+ const { status, data } = useQuery({
+ queryKey: ["fetchTTSSettings"],
+ queryFn: async () => {
+ const data = await getTTSSettings()
+ form.setValues(data)
+ return data
+ }
+ })
+
+ if (status === "pending" || status === "error") {
+ return
+ }
+
+ return (
+
+
+
+ {t("generalSettings.tts.heading")}
+
+ {!hideBorder && (
+
+ )}
+
+
+
+ )
+}
diff --git a/src/components/Option/Share/index.tsx b/src/components/Option/Share/index.tsx
index 5b1c3cb..8239a67 100644
--- a/src/components/Option/Share/index.tsx
+++ b/src/components/Option/Share/index.tsx
@@ -3,7 +3,7 @@ import { Form, Input, Skeleton, Table, Tooltip, message } from "antd"
import { Trash2 } from "lucide-react"
import { Trans, useTranslation } from "react-i18next"
import { SaveButton } from "~/components/Common/SaveButton"
-import { deleteWebshare, getAllWebshares, getUserId } from "~/libs/db"
+import { deleteWebshare, getAllWebshares, getUserId } from "@/db"
import { getPageShareUrl, setPageShareUrl } from "~/services/ollama"
import { verifyPageShareURL } from "~/utils/verify-page-share"
diff --git a/src/components/Option/Sidebar.tsx b/src/components/Option/Sidebar.tsx
index 87628ff..e18f567 100644
--- a/src/components/Option/Sidebar.tsx
+++ b/src/components/Option/Sidebar.tsx
@@ -5,7 +5,7 @@ import {
formatToMessage,
deleteByHistoryId,
updateHistory
-} from "~/libs/db"
+} from "@/db"
import { Empty, Skeleton } from "antd"
import { useMessageOption } from "~/hooks/useMessageOption"
import { PencilIcon, Trash2 } from "lucide-react"
diff --git a/src/components/Sidepanel/Chat/body.tsx b/src/components/Sidepanel/Chat/body.tsx
index 1b62bd8..d6e3684 100644
--- a/src/components/Sidepanel/Chat/body.tsx
+++ b/src/components/Sidepanel/Chat/body.tsx
@@ -2,10 +2,12 @@ import React from "react"
import { PlaygroundMessage } from "~/components/Common/Playground/Message"
import { useMessage } from "~/hooks/useMessage"
import { EmptySidePanel } from "../Chat/empty"
+import { useWebUI } from "@/store/webui"
export const SidePanelBody = () => {
const { messages, streaming } = useMessage()
const divRef = React.useRef
(null)
+ const { ttsEnabled } = useWebUI()
React.useEffect(() => {
if (divRef.current) {
divRef.current.scrollIntoView({ behavior: "smooth" })
@@ -16,7 +18,7 @@ export const SidePanelBody = () => {
{messages.length === 0 && }
{messages.map((message, index) => (
{}}
+ onEditFormSubmit={(value) => {}}
key={index}
isBot={message.isBot}
message={message.message}
@@ -27,6 +29,7 @@ export const SidePanelBody = () => {
onRengerate={() => {}}
isProcessing={streaming}
hideEditAndRegenerate
+ isTTSEnabled={ttsEnabled}
/>
))}
diff --git a/src/components/Sidepanel/Chat/empty.tsx b/src/components/Sidepanel/Chat/empty.tsx
index d6c168c..41305b8 100644
--- a/src/components/Sidepanel/Chat/empty.tsx
+++ b/src/components/Sidepanel/Chat/empty.tsx
@@ -8,7 +8,8 @@ import {
getAllModels,
getOllamaURL,
isOllamaRunning,
- setOllamaURL as saveOllamaURL
+ setOllamaURL as saveOllamaURL,
+ fetchChatModels
} from "~/services/ollama"
export const EmptySidePanel = () => {
@@ -24,7 +25,7 @@ export const EmptySidePanel = () => {
queryFn: async () => {
const ollamaURL = await getOllamaURL()
const isOk = await isOllamaRunning()
- const models = await getAllModels({ returnEmpty: false })
+ const models = await fetchChatModels({ returnEmpty: false })
return {
isOk,
@@ -96,6 +97,7 @@ export const EmptySidePanel = () => {