feat: Add react-icons and PiGlobe icon to PlaygroundForm and SidepanelForm

This commit is contained in:
n4ze3m 2024-06-10 18:54:43 +05:30
parent 52ccbc67bb
commit 69ba305453
4 changed files with 9 additions and 20 deletions

BIN
bun.lockb

Binary file not shown.

View File

@ -44,6 +44,7 @@
"react": "18.2.0",
"react-dom": "18.2.0",
"react-i18next": "^14.1.0",
"react-icons": "^5.2.1",
"react-markdown": "8.0.0",
"react-router-dom": "6.10.0",
"react-syntax-highlighter": "^15.5.0",

View File

@ -4,7 +4,7 @@ import React from "react"
import useDynamicTextareaSize from "~/hooks/useDynamicTextareaSize"
import { toBase64 } from "~/libs/to-base64"
import { useMessageOption } from "~/hooks/useMessageOption"
import { Checkbox, Dropdown, Select, Switch, Tooltip } from "antd"
import { Checkbox, Dropdown, Switch, Tooltip } from "antd"
import { Image } from "antd"
import { useWebUI } from "~/store/webui"
import { defaultEmbeddingModelForRag } from "~/services/ollama"
@ -13,6 +13,7 @@ import { getVariable } from "~/utils/select-varaible"
import { useTranslation } from "react-i18next"
import { KnowledgeSelect } from "../Knowledge/KnowledgeSelect"
import { useSpeechRecognition } from "@/hooks/useSpeechRecognition"
import { PiGlobe } from "react-icons/pi"
type Props = {
dropedFile: File | undefined
@ -250,19 +251,7 @@ export const PlaygroundForm = ({ dropedFile }: Props) => {
{!selectedKnowledge && (
<Tooltip title={t("tooltip.searchInternet")}>
<div className="inline-flex items-center gap-2">
<svg
xmlns="http://www.w3.org/2000/svg"
fill="none"
viewBox="0 0 24 24"
strokeWidth={1.5}
stroke="currentColor"
className="w-5 h-5 dark:text-gray-300">
<path
strokeLinecap="round"
strokeLinejoin="round"
d="M12 21a9.004 9.004 0 0 0 8.716-6.747M12 21a9.004 9.004 0 0 1-8.716-6.747M12 21c2.485 0 4.5-4.03 4.5-9S14.485 3 12 3m0 18c-2.485 0-4.5-4.03-4.5-9S9.515 3 12 3m0 0a8.997 8.997 0 0 1 7.843 4.582M12 3a8.997 8.997 0 0 0-7.843 4.582m15.686 0A11.953 11.953 0 0 1 12 10.5c-2.998 0-5.74-1.1-7.843-2.918m15.686 0A8.959 8.959 0 0 1 21 12c0 .778-.099 1.533-.284 2.253m0 0A17.919 17.919 0 0 1 12 16.5c-3.162 0-6.133-.815-8.716-2.247m0 0A9.015 9.015 0 0 1 3 12c0-1.605.42-3.113 1.157-4.418"
/>
</svg>
<PiGlobe className="h-5 w-5 dark:text-gray-300" />
<Switch
value={webSearch}
onChange={(e) => setWebSearch(e)}

View File

@ -12,12 +12,11 @@ import {
MicIcon,
StopCircleIcon,
X,
Wifi,
WifiOff
} from "lucide-react"
import { useTranslation } from "react-i18next"
import { ModelSelect } from "@/components/Common/ModelSelect"
import { useSpeechRecognition } from "@/hooks/useSpeechRecognition"
import { PiGlobeX, PiGlobe} from "react-icons/pi";
type Props = {
dropedFile: File | undefined
@ -233,7 +232,6 @@ export const SidepanelForm = ({ dropedFile }: Props) => {
{...form.getInputProps("message")}
/>
<div className="flex mt-4 justify-end gap-3">
<ModelSelect />
<Tooltip title={t("tooltip.searchInternet")}>
<button
type="button"
@ -242,12 +240,13 @@ export const SidepanelForm = ({ dropedFile }: Props) => {
chatMode === "rag" ? "hidden" : "block"
}`}>
{webSearch ? (
<Wifi className="h-5 w-5 text-gray-900 dark:text-gray-300" />
<PiGlobe className="h-5 w-5 dark:text-gray-300" />
) : (
<WifiOff className="h-5 w-5 text-gray-600 dark:text-gray-400" />
<PiGlobeX className="h-5 w-5 text-gray-600 dark:text-gray-400" />
)}
</button>
</Tooltip>
<ModelSelect />
{browserSupportsSpeechRecognition && (
<Tooltip title={t("tooltip.speechToText")}>
<button