refactor: Update version to 1.1.12, fix selectedModel spacing, and update meta viewport tags
This commit is contained in:
@@ -3,11 +3,19 @@ import { PlaygroundMessage } from "~/components/Common/Playground/Message"
|
||||
import { useMessage } from "~/hooks/useMessage"
|
||||
import { EmptySidePanel } from "../Chat/empty"
|
||||
import { useWebUI } from "@/store/webui"
|
||||
import { MessageSourcePopup } from "@/components/Common/Playground/MessageSourcePopup"
|
||||
|
||||
export const SidePanelBody = () => {
|
||||
const { messages, streaming, regenerateLastMessage, editMessage } =
|
||||
useMessage()
|
||||
const {
|
||||
messages,
|
||||
streaming,
|
||||
regenerateLastMessage,
|
||||
editMessage,
|
||||
isSearchingInternet
|
||||
} = useMessage()
|
||||
const divRef = React.useRef<HTMLDivElement>(null)
|
||||
const [isSourceOpen, setIsSourceOpen] = React.useState(false)
|
||||
const [source, setSource] = React.useState<any>(null)
|
||||
const { ttsEnabled } = useWebUI()
|
||||
React.useEffect(() => {
|
||||
if (divRef.current) {
|
||||
@@ -27,19 +35,26 @@ export const SidePanelBody = () => {
|
||||
currentMessageIndex={index}
|
||||
totalMessages={messages.length}
|
||||
onRengerate={regenerateLastMessage}
|
||||
isProcessing={streaming}
|
||||
isSearchingInternet={isSearchingInternet}
|
||||
sources={message.sources}
|
||||
onEditFormSubmit={(value) => {
|
||||
editMessage(index, value, !message.isBot)
|
||||
}}
|
||||
isProcessing={streaming}
|
||||
onSourceClick={(data) => {
|
||||
setSource(data)
|
||||
setIsSourceOpen(true)
|
||||
}}
|
||||
isTTSEnabled={ttsEnabled}
|
||||
/>
|
||||
))}
|
||||
{import.meta.env.BROWSER === "chrome" ? (
|
||||
<div className="w-full h-32 md:h-48 flex-shrink-0"></div>
|
||||
) : (
|
||||
<div className="w-full h-48 flex-shrink-0"></div>
|
||||
)}
|
||||
<div className="w-full h-48 flex-shrink-0"></div>
|
||||
<div ref={divRef} />
|
||||
<MessageSourcePopup
|
||||
open={isSourceOpen}
|
||||
setOpen={setIsSourceOpen}
|
||||
source={source}
|
||||
/>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
@@ -4,10 +4,17 @@ import React from "react"
|
||||
import useDynamicTextareaSize from "~/hooks/useDynamicTextareaSize"
|
||||
import { useMessage } from "~/hooks/useMessage"
|
||||
import { toBase64 } from "~/libs/to-base64"
|
||||
import { Checkbox, Dropdown, Image, Tooltip } from "antd"
|
||||
import { Checkbox, Dropdown, Image, Switch, Tooltip } from "antd"
|
||||
import { useWebUI } from "~/store/webui"
|
||||
import { defaultEmbeddingModelForRag } from "~/services/ollama"
|
||||
import { ImageIcon, MicIcon, StopCircleIcon, X } from "lucide-react"
|
||||
import {
|
||||
ImageIcon,
|
||||
MicIcon,
|
||||
StopCircleIcon,
|
||||
X,
|
||||
Wifi,
|
||||
WifiOff
|
||||
} from "lucide-react"
|
||||
import { useTranslation } from "react-i18next"
|
||||
import { ModelSelect } from "@/components/Common/ModelSelect"
|
||||
import { useSpeechRecognition } from "@/hooks/useSpeechRecognition"
|
||||
@@ -88,6 +95,13 @@ export const SidepanelForm = ({ dropedFile }: Props) => {
|
||||
return
|
||||
}
|
||||
}
|
||||
if (webSearch) {
|
||||
const defaultEM = await defaultEmbeddingModelForRag()
|
||||
if (!defaultEM) {
|
||||
form.setFieldError("message", t("formError.noEmbeddingModel"))
|
||||
return
|
||||
}
|
||||
}
|
||||
form.reset()
|
||||
textAreaFocus()
|
||||
await sendMessage({
|
||||
@@ -111,7 +125,9 @@ export const SidepanelForm = ({ dropedFile }: Props) => {
|
||||
speechToTextLanguage,
|
||||
stopStreamingRequest,
|
||||
streaming,
|
||||
setChatMode
|
||||
setChatMode,
|
||||
webSearch,
|
||||
setWebSearch
|
||||
} = useMessage()
|
||||
|
||||
React.useEffect(() => {
|
||||
@@ -175,6 +191,13 @@ export const SidepanelForm = ({ dropedFile }: Props) => {
|
||||
return
|
||||
}
|
||||
}
|
||||
if (webSearch) {
|
||||
const defaultEM = await defaultEmbeddingModelForRag()
|
||||
if (!defaultEM) {
|
||||
form.setFieldError("message", t("formError.noEmbeddingModel"))
|
||||
return
|
||||
}
|
||||
}
|
||||
await stopListening()
|
||||
form.reset()
|
||||
textAreaFocus()
|
||||
@@ -211,6 +234,20 @@ export const SidepanelForm = ({ dropedFile }: Props) => {
|
||||
/>
|
||||
<div className="flex mt-4 justify-end gap-3">
|
||||
<ModelSelect />
|
||||
<Tooltip title={t("tooltip.searchInternet")}>
|
||||
<button
|
||||
type="button"
|
||||
onClick={() => setWebSearch(!webSearch)}
|
||||
className={`inline-flex items-center gap-2 ${
|
||||
chatMode === "rag" ? "hidden" : "block"
|
||||
}`}>
|
||||
{webSearch ? (
|
||||
<Wifi className="h-5 w-5 text-gray-900 dark:text-gray-300" />
|
||||
) : (
|
||||
<WifiOff className="h-5 w-5 text-gray-600 dark:text-gray-400" />
|
||||
)}
|
||||
</button>
|
||||
</Tooltip>
|
||||
{browserSupportsSpeechRecognition && (
|
||||
<Tooltip title={t("tooltip.speechToText")}>
|
||||
<button
|
||||
|
||||
Reference in New Issue
Block a user