commit
3a751032f1
@ -124,5 +124,6 @@
|
||||
},
|
||||
"pin": "تثبيت",
|
||||
"unpin": "إلغاء التثبيت",
|
||||
"generationInfo": "معلومات التوليد"
|
||||
"generationInfo": "معلومات التوليد",
|
||||
"sidebarChat": "دردشة الشريط الجانبي"
|
||||
}
|
||||
|
@ -77,6 +77,9 @@
|
||||
},
|
||||
"googleDomain": {
|
||||
"label": "نطاق جوجل"
|
||||
},
|
||||
"searchOnByDefault": {
|
||||
"label": "تفعيل البحث على الإنترنت بشكل افتراضي"
|
||||
}
|
||||
},
|
||||
"system": {
|
||||
|
@ -117,5 +117,6 @@
|
||||
},
|
||||
"pin": "Fastgør",
|
||||
"unpin": "Frigør",
|
||||
"generationInfo": "Genererings Info"
|
||||
"generationInfo": "Genererings Info",
|
||||
"sidebarChat": "Sidepanel Chat"
|
||||
}
|
@ -74,6 +74,9 @@
|
||||
"braveApi": {
|
||||
"label": "Brave API Nøgle",
|
||||
"placeholder": "Indtast din Brave API nøgle"
|
||||
},
|
||||
"searchOnByDefault": {
|
||||
"label": "Internet Søgning TIL som standard"
|
||||
}
|
||||
},
|
||||
"system": {
|
||||
|
@ -117,5 +117,6 @@
|
||||
},
|
||||
"pin": "Anheften",
|
||||
"unpin": "Losheften",
|
||||
"generationInfo": "Generierungsinformationen"
|
||||
"generationInfo": "Generierungsinformationen",
|
||||
"sidebarChat": "Seitenleisten-Chat"
|
||||
}
|
@ -74,6 +74,9 @@
|
||||
"braveApi": {
|
||||
"label": "Brave API-Schlüssel",
|
||||
"placeholder": "Geben Sie Ihren Brave API-Schlüssel ein"
|
||||
},
|
||||
"searchOnByDefault": {
|
||||
"label": "Internetsuche standardmäßig aktiviert"
|
||||
}
|
||||
},
|
||||
"system": {
|
||||
|
@ -151,5 +151,6 @@
|
||||
},
|
||||
"pin": "Pin",
|
||||
"unpin": "Unpin",
|
||||
"generationInfo": "Generation Info"
|
||||
"generationInfo": "Generation Info",
|
||||
"sidebarChat": "Sidebar Chat"
|
||||
}
|
@ -77,6 +77,9 @@
|
||||
},
|
||||
"googleDomain": {
|
||||
"label": "Google Domain"
|
||||
},
|
||||
"searchOnByDefault": {
|
||||
"label": "Internet Search ON by default"
|
||||
}
|
||||
},
|
||||
"system": {
|
||||
|
@ -116,5 +116,6 @@
|
||||
},
|
||||
"pin": "Fijar",
|
||||
"unpin": "Desfijar",
|
||||
"generationInfo": "Información de Generación"
|
||||
"generationInfo": "Información de Generación",
|
||||
"sidebarChat": "Chat lateral"
|
||||
}
|
@ -74,6 +74,9 @@
|
||||
"braveApi": {
|
||||
"label": "Clave API de Brave",
|
||||
"placeholder": "Ingrese su clave API de Brave"
|
||||
},
|
||||
"searchOnByDefault": {
|
||||
"label": "Búsqueda en Internet activada por defecto"
|
||||
}
|
||||
},
|
||||
"system": {
|
||||
|
@ -110,5 +110,6 @@
|
||||
},
|
||||
"pin": "پین کردن",
|
||||
"unpin": "حذف پین",
|
||||
"generationInfo": "اطلاعات تولید"
|
||||
"generationInfo": "اطلاعات تولید",
|
||||
"sidebarChat": "چت کناری"
|
||||
}
|
@ -71,6 +71,9 @@
|
||||
"braveApi": {
|
||||
"label": "کلید API بریو",
|
||||
"placeholder": "کلید API بریو خود را وارد کنید"
|
||||
},
|
||||
"searchOnByDefault": {
|
||||
"label": "جستجوی اینترنتی به صورت پیشفرض فعال باشد"
|
||||
}
|
||||
},
|
||||
"system": {
|
||||
|
@ -116,5 +116,6 @@
|
||||
},
|
||||
"pin": "Épingler",
|
||||
"unpin": "Désépingler",
|
||||
"generationInfo": "Informations de génération"
|
||||
"generationInfo": "Informations de génération",
|
||||
"sidebarChat": "Chat latéral"
|
||||
}
|
@ -74,6 +74,9 @@
|
||||
"braveApi": {
|
||||
"label": "Clé API Brave",
|
||||
"placeholder": "Entrez votre clé API Brave"
|
||||
},
|
||||
"searchOnByDefault": {
|
||||
"label": "Recherche Internet activée par défaut"
|
||||
}
|
||||
},
|
||||
"system": {
|
||||
|
@ -116,5 +116,6 @@
|
||||
},
|
||||
"pin": "Fissa",
|
||||
"unpin": "Rimuovi",
|
||||
"generationInfo": "Informazioni sulla Generazione"
|
||||
"generationInfo": "Informazioni sulla Generazione",
|
||||
"sidebarChat": "Chat Laterale"
|
||||
}
|
@ -74,6 +74,9 @@
|
||||
"braveApi": {
|
||||
"label": "Chiave API Brave",
|
||||
"placeholder": "Inserisci la tua chiave API Brave"
|
||||
},
|
||||
"searchOnByDefault": {
|
||||
"label": "Ricerca Internet attiva per impostazione predefinita"
|
||||
}
|
||||
},
|
||||
"system": {
|
||||
|
@ -116,5 +116,6 @@
|
||||
},
|
||||
"pin": "固定",
|
||||
"unpin": "固定解除",
|
||||
"generationInfo": "生成情報"
|
||||
"generationInfo": "生成情報",
|
||||
"sidebarChat": "サイドバーチャット"
|
||||
}
|
@ -77,6 +77,9 @@
|
||||
"braveApi": {
|
||||
"label": "Brave APIキー",
|
||||
"placeholder": "Brave APIキーを入力してください"
|
||||
},
|
||||
"searchOnByDefault": {
|
||||
"label": "デフォルトでインターネット検索をオンにする"
|
||||
}
|
||||
},
|
||||
"system": {
|
||||
|
@ -73,7 +73,8 @@
|
||||
"numPredict": {
|
||||
"label": "최대 토큰 수 (num_predict)",
|
||||
"placeholder": "최대 토큰 수를 입력하세요 (예: 2048, 4096)"
|
||||
}, "seed": {
|
||||
},
|
||||
"seed": {
|
||||
"label": "시드",
|
||||
"placeholder": "시드 값을 입력하세요 (예: 1234)",
|
||||
"help": "모델 출력의 재현성"
|
||||
@ -115,5 +116,6 @@
|
||||
},
|
||||
"pin": "고정",
|
||||
"unpin": "고정 해제",
|
||||
"generationInfo": "생성 정보"
|
||||
}
|
||||
"generationInfo": "생성 정보",
|
||||
"sidebarChat": "사이드바 채팅"
|
||||
}
|
@ -77,6 +77,9 @@
|
||||
"braveApi": {
|
||||
"label": "Brave API 키",
|
||||
"placeholder": "Brave API 키를 입력하세요"
|
||||
},
|
||||
"searchOnByDefault": {
|
||||
"label": "기본적으로 인터넷 검색 켜기"
|
||||
}
|
||||
},
|
||||
"system": {
|
||||
|
@ -115,6 +115,7 @@
|
||||
},
|
||||
"pin": "പിൻ ചെയ്യുക",
|
||||
"unpin": "അൺപിൻ ചെയ്യുക",
|
||||
"generationInfo": "ജനറേഷൻ വിവരങ്ങൾ"
|
||||
"generationInfo": "ജനറേഷൻ വിവരങ്ങൾ",
|
||||
"sidebarChat": "സൈഡ്ബാർ ചാറ്റ്"
|
||||
|
||||
}
|
@ -77,6 +77,9 @@
|
||||
"braveApi": {
|
||||
"label": "ബ്രേവ് API കീ",
|
||||
"placeholder": "നിങ്ങളുടെ ബ്രേവ് API കീ നൽകുക"
|
||||
},
|
||||
"searchOnByDefault": {
|
||||
"label": "സ്ഥിരസ്ഥിതിയായി ഇന്റർനെറ്റ് തിരച്ചിൽ പ്രവർത്തനക്ഷമമാക്കുക"
|
||||
}
|
||||
},
|
||||
"system": {
|
||||
|
@ -117,5 +117,6 @@
|
||||
},
|
||||
"pin": "Fest",
|
||||
"unpin": "Løsne",
|
||||
"generationInfo": "Generasjonsinformasjon"
|
||||
"generationInfo": "Generasjonsinformasjon",
|
||||
"sidebarChat": "Sidepanel-chat"
|
||||
}
|
@ -74,6 +74,9 @@
|
||||
"braveApi": {
|
||||
"label": "Brave API Nøkkel",
|
||||
"placeholder": "Skriv inn din Brave API nøkkel"
|
||||
},
|
||||
"searchOnByDefault": {
|
||||
"label": "Internett-søk PÅ som standard"
|
||||
}
|
||||
},
|
||||
"system": {
|
||||
|
@ -116,5 +116,6 @@
|
||||
},
|
||||
"pin": "Fixar",
|
||||
"unpin": "Desafixar",
|
||||
"generationInfo": "Informações de Geração"
|
||||
"generationInfo": "Informações de Geração",
|
||||
"sidebarChat": "Chat Lateral"
|
||||
}
|
@ -74,6 +74,9 @@
|
||||
"braveApi": {
|
||||
"label": "Chave da API do Brave",
|
||||
"placeholder": "Digite sua chave da API do Brave"
|
||||
},
|
||||
"searchOnByDefault": {
|
||||
"label": "Pesquisa na Internet ativada por padrão"
|
||||
}
|
||||
},
|
||||
"system": {
|
||||
|
@ -116,5 +116,6 @@
|
||||
},
|
||||
"pin": "Закрепить",
|
||||
"unpin": "Открепить",
|
||||
"generationInfo": "Информация о генерации"
|
||||
"generationInfo": "Информация о генерации",
|
||||
"sidebarChat": "Боковой чат"
|
||||
}
|
@ -75,6 +75,9 @@
|
||||
"braveApi": {
|
||||
"label": "API-ключ Brave",
|
||||
"placeholder": "Введите ваш API-ключ Brave"
|
||||
},
|
||||
"searchOnByDefault": {
|
||||
"label": "Поиск в интернете включен по умолчанию"
|
||||
}
|
||||
},
|
||||
"system": {
|
||||
|
@ -121,5 +121,6 @@
|
||||
},
|
||||
"pin": "Fäst",
|
||||
"unpin": "Ta bort fäst",
|
||||
"generationInfo": "Generationsinformation"
|
||||
}
|
||||
"generationInfo": "Generationsinformation",
|
||||
"sidebarChat": "Sidofältschatt"
|
||||
}
|
@ -74,6 +74,9 @@
|
||||
"braveApi": {
|
||||
"label": "Brave API-nyckel",
|
||||
"placeholder": "Ange din Brave API-nyckel"
|
||||
},
|
||||
"searchOnByDefault": {
|
||||
"label": "Internetsökning PÅ som standard"
|
||||
}
|
||||
},
|
||||
"system": {
|
||||
|
@ -121,5 +121,6 @@
|
||||
},
|
||||
"pin": "Прикріпити",
|
||||
"unpin": "Відкріпити",
|
||||
"generationInfo": "Інформація про генерацію"
|
||||
}
|
||||
"generationInfo": "Інформація про генерацію",
|
||||
"sidebarChat": "Бічний чат"
|
||||
}
|
@ -74,6 +74,9 @@
|
||||
"braveApi": {
|
||||
"label": "Ключ API Brave",
|
||||
"placeholder": "Введіть ваш ключ API Brave"
|
||||
},
|
||||
"searchOnByDefault": {
|
||||
"label": "Пошук в Інтернеті увімкнено за замовчуванням"
|
||||
}
|
||||
},
|
||||
"system": {
|
||||
|
@ -116,5 +116,6 @@
|
||||
},
|
||||
"pin": "置顶",
|
||||
"unpin": "取消置顶",
|
||||
"generationInfo": "生成信息"
|
||||
"generationInfo": "生成信息",
|
||||
"sidebarChat": "侧边栏聊天"
|
||||
}
|
@ -77,6 +77,9 @@
|
||||
"braveApi": {
|
||||
"label": "Brave API 密钥",
|
||||
"placeholder": "输入您的 Brave API 密钥"
|
||||
},
|
||||
"searchOnByDefault": {
|
||||
"label": "默认开启网络搜索"
|
||||
}
|
||||
},
|
||||
"system": {
|
||||
|
@ -169,6 +169,7 @@ export const PlaygroundMessage = (props: Props) => {
|
||||
{props.isTTSEnabled && (
|
||||
<Tooltip title={t("tts")}>
|
||||
<button
|
||||
aria-label={t("tts")}
|
||||
onClick={() => {
|
||||
if (isSpeaking) {
|
||||
cancel()
|
||||
@ -192,6 +193,7 @@ export const PlaygroundMessage = (props: Props) => {
|
||||
{!props.hideCopy && (
|
||||
<Tooltip title={t("copyToClipboard")}>
|
||||
<button
|
||||
aria-label={t("copyToClipboard")}
|
||||
onClick={() => {
|
||||
navigator.clipboard.writeText(props.message)
|
||||
setIsBtnPressed(true)
|
||||
@ -217,7 +219,9 @@ export const PlaygroundMessage = (props: Props) => {
|
||||
/>
|
||||
}
|
||||
title={t("generationInfo")}>
|
||||
<button className="flex items-center justify-center w-6 h-6 rounded-full bg-gray-100 dark:bg-gray-800 hover:bg-gray-200 dark:hover:bg-gray-700 transition-colors duration-200 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-gray-500">
|
||||
<button
|
||||
aria-label={t("generationInfo")}
|
||||
className="flex items-center justify-center w-6 h-6 rounded-full bg-gray-100 dark:bg-gray-800 hover:bg-gray-200 dark:hover:bg-gray-700 transition-colors duration-200 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-gray-500">
|
||||
<InfoIcon className="w-3 h-3 text-gray-400 group-hover:text-gray-500" />
|
||||
</button>
|
||||
</Popover>
|
||||
@ -227,6 +231,7 @@ export const PlaygroundMessage = (props: Props) => {
|
||||
props.currentMessageIndex === props.totalMessages - 1 && (
|
||||
<Tooltip title={t("regenerate")}>
|
||||
<button
|
||||
aria-label={t("regenerate")}
|
||||
onClick={props.onRengerate}
|
||||
className="flex items-center justify-center w-6 h-6 rounded-full bg-gray-100 dark:bg-gray-800 hover:bg-gray-200 dark:hover:bg-gray-700 transition-colors duration-200 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-gray-500">
|
||||
<RotateCcw className="w-3 h-3 text-gray-400 group-hover:text-gray-500" />
|
||||
@ -239,6 +244,7 @@ export const PlaygroundMessage = (props: Props) => {
|
||||
<Tooltip title={t("edit")}>
|
||||
<button
|
||||
onClick={() => setEditMode(true)}
|
||||
aria-label={t("edit")}
|
||||
className="flex items-center justify-center w-6 h-6 rounded-full bg-gray-100 dark:bg-gray-800 hover:bg-gray-200 dark:hover:bg-gray-700 transition-colors duration-200 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-gray-500">
|
||||
<Pen className="w-3 h-3 text-gray-400 group-hover:text-gray-500" />
|
||||
</button>
|
||||
|
@ -11,6 +11,7 @@ import { EraserIcon } from "lucide-react"
|
||||
import { PageAssitDatabase } from "@/db"
|
||||
import { useMessageOption } from "@/hooks/useMessageOption"
|
||||
import { useQueryClient } from "@tanstack/react-query"
|
||||
import { useStoreChatModelSettings } from "@/store/model"
|
||||
|
||||
export default function OptionLayout({
|
||||
children
|
||||
@ -20,8 +21,19 @@ export default function OptionLayout({
|
||||
const [sidebarOpen, setSidebarOpen] = useState(false)
|
||||
const { t } = useTranslation(["option", "common", "settings"])
|
||||
const [openModelSettings, setOpenModelSettings] = useState(false)
|
||||
const { clearChat } = useMessageOption()
|
||||
const {
|
||||
setMessages,
|
||||
setHistory,
|
||||
setHistoryId,
|
||||
historyId,
|
||||
clearChat,
|
||||
setSelectedModel,
|
||||
temporaryChat,
|
||||
setSelectedSystemPrompt
|
||||
} = useMessageOption()
|
||||
|
||||
const queryClient = useQueryClient()
|
||||
const { setSystemPrompt } = useStoreChatModelSettings()
|
||||
|
||||
return (
|
||||
<>
|
||||
@ -70,7 +82,19 @@ export default function OptionLayout({
|
||||
closeIcon={null}
|
||||
onClose={() => setSidebarOpen(false)}
|
||||
open={sidebarOpen}>
|
||||
<Sidebar onClose={() => setSidebarOpen(false)} />
|
||||
<Sidebar
|
||||
onClose={() => setSidebarOpen(false)}
|
||||
setMessages={setMessages}
|
||||
setHistory={setHistory}
|
||||
setHistoryId={setHistoryId}
|
||||
setSelectedModel={setSelectedModel}
|
||||
setSelectedSystemPrompt={setSelectedSystemPrompt}
|
||||
clearChat={clearChat}
|
||||
historyId={historyId}
|
||||
setSystemPrompt={setSystemPrompt}
|
||||
temporaryChat={temporaryChat}
|
||||
history={history}
|
||||
/>
|
||||
</Drawer>
|
||||
|
||||
<CurrentChatModelSettings
|
||||
|
@ -39,7 +39,8 @@ export const PlaygroundForm = ({ dropedFile }: Props) => {
|
||||
selectedKnowledge,
|
||||
temporaryChat,
|
||||
useOCR,
|
||||
setUseOCR
|
||||
setUseOCR,
|
||||
defaultInternetSearchOn
|
||||
} = useMessageOption()
|
||||
|
||||
const isMobile = () => {
|
||||
@ -71,8 +72,17 @@ export const PlaygroundForm = ({ dropedFile }: Props) => {
|
||||
|
||||
React.useEffect(() => {
|
||||
textAreaFocus()
|
||||
if (defaultInternetSearchOn) {
|
||||
setWebSearch(true)
|
||||
}
|
||||
}, [])
|
||||
|
||||
React.useEffect(() => {
|
||||
if (defaultInternetSearchOn) {
|
||||
setWebSearch(true)
|
||||
}
|
||||
}, [defaultInternetSearchOn])
|
||||
|
||||
const onInputChange = async (
|
||||
e: React.ChangeEvent<HTMLInputElement> | File
|
||||
) => {
|
||||
@ -195,7 +205,7 @@ export const PlaygroundForm = ({ dropedFile }: Props) => {
|
||||
return (
|
||||
<div
|
||||
className={`px-3 pt-3 bg-gray-100 dark:bg-[#262626] border rounded-t-xl dark:border-gray-600
|
||||
${temporaryChat && "!bg-gray-300 dark:!bg-black "}
|
||||
${temporaryChat && "!bg-gray-200 dark:!bg-black "}
|
||||
`}>
|
||||
<div
|
||||
className={`h-full rounded-md shadow relative ${
|
||||
@ -221,7 +231,7 @@ export const PlaygroundForm = ({ dropedFile }: Props) => {
|
||||
<div>
|
||||
<div
|
||||
className={`flex rounded-t-xl bg-white dark:bg-transparent ${
|
||||
temporaryChat && "!bg-gray-300 dark:!bg-black"
|
||||
temporaryChat && "!bg-gray-100 dark:!bg-black"
|
||||
}`}>
|
||||
<form
|
||||
onSubmit={form.onSubmit(async (value) => {
|
||||
|
@ -19,7 +19,8 @@ export const SearchModeSettings = () => {
|
||||
searxngURL: "",
|
||||
searxngJSONMode: false,
|
||||
braveApiKey: "",
|
||||
googleDomain: ""
|
||||
googleDomain: "",
|
||||
defaultInternetSearchOn: false
|
||||
}
|
||||
})
|
||||
|
||||
@ -171,6 +172,19 @@ export const SearchModeSettings = () => {
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div className="flex sm:flex-row flex-col space-y-4 sm:space-y-0 sm:justify-between">
|
||||
<span className="text-gray-700 dark:text-neutral-50 ">
|
||||
{t("generalSettings.webSearch.searchOnByDefault.label")}
|
||||
</span>
|
||||
<div>
|
||||
<Switch
|
||||
className="mt-4 sm:mt-0"
|
||||
{...form.getInputProps("defaultInternetSearchOn", {
|
||||
type: "checkbox"
|
||||
})}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
<div className="flex justify-end">
|
||||
<SaveButton btnType="submit" />
|
||||
</div>
|
||||
|
@ -8,14 +8,14 @@ import {
|
||||
pinHistory,
|
||||
getPromptById
|
||||
} from "@/db"
|
||||
import { Empty, Skeleton, Dropdown, Menu } from "antd"
|
||||
import { useMessageOption } from "~/hooks/useMessageOption"
|
||||
import { Empty, Skeleton, Dropdown, Menu, Tooltip } from "antd"
|
||||
import {
|
||||
PencilIcon,
|
||||
Trash2,
|
||||
MoreVertical,
|
||||
PinIcon,
|
||||
PinOffIcon
|
||||
PinOffIcon,
|
||||
BotIcon
|
||||
} from "lucide-react"
|
||||
import { useNavigate } from "react-router-dom"
|
||||
import { useTranslation } from "react-i18next"
|
||||
@ -24,26 +24,33 @@ import {
|
||||
getLastUsedChatSystemPrompt,
|
||||
lastUsedChatModelEnabled
|
||||
} from "@/services/model-settings"
|
||||
import { useStoreChatModelSettings } from "@/store/model"
|
||||
|
||||
type Props = {
|
||||
onClose: () => void
|
||||
setMessages: (messages: any) => void
|
||||
setHistory: (history: any) => void
|
||||
setHistoryId: (historyId: string) => void
|
||||
setSelectedModel: (model: string) => void
|
||||
setSelectedSystemPrompt: (prompt: string) => void
|
||||
setSystemPrompt: (prompt: string) => void
|
||||
clearChat: () => void
|
||||
temporaryChat: boolean
|
||||
historyId: string
|
||||
history: any
|
||||
}
|
||||
|
||||
export const Sidebar = ({ onClose }: Props) => {
|
||||
const {
|
||||
setMessages,
|
||||
setHistory,
|
||||
setHistoryId,
|
||||
historyId,
|
||||
clearChat,
|
||||
setSelectedModel,
|
||||
temporaryChat,
|
||||
setSelectedSystemPrompt
|
||||
} = useMessageOption()
|
||||
|
||||
const { setSystemPrompt } = useStoreChatModelSettings()
|
||||
|
||||
export const Sidebar = ({
|
||||
onClose,
|
||||
setMessages,
|
||||
setHistory,
|
||||
setHistoryId,
|
||||
setSelectedModel,
|
||||
setSelectedSystemPrompt,
|
||||
clearChat,
|
||||
historyId,
|
||||
setSystemPrompt,
|
||||
temporaryChat
|
||||
}: Props) => {
|
||||
const { t } = useTranslation(["option", "common"])
|
||||
const client = useQueryClient()
|
||||
const navigate = useNavigate()
|
||||
@ -162,7 +169,12 @@ export const Sidebar = ({ onClose }: Props) => {
|
||||
{group.items.map((chat, index) => (
|
||||
<div
|
||||
key={index}
|
||||
className="flex py-2 px-2 items-start gap-3 relative rounded-md truncate hover:pr-4 group transition-opacity duration-300 ease-in-out bg-gray-100 dark:bg-[#232222] dark:text-gray-100 text-gray-800 border hover:bg-gray-200 dark:hover:bg-[#2d2d2d] dark:border-gray-800">
|
||||
className="flex py-2 px-2 items-center gap-3 relative rounded-md truncate hover:pr-4 group transition-opacity duration-300 ease-in-out bg-gray-100 dark:bg-[#232222] dark:text-gray-100 text-gray-800 border hover:bg-gray-200 dark:hover:bg-[#2d2d2d] dark:border-gray-800">
|
||||
{chat?.message_source === "copilot" && (
|
||||
<Tooltip title={t("common:sidebarChat")} placement="top">
|
||||
<BotIcon className="size-3 text-green-500" />
|
||||
</Tooltip>
|
||||
)}
|
||||
<button
|
||||
className="flex-1 overflow-hidden break-all text-start truncate w-full"
|
||||
onClick={async () => {
|
||||
|
@ -175,10 +175,11 @@ export const PageAssistSelect: React.FC<SelectProps> = ({
|
||||
flex items-center justify-between p-2.5 rounded-lg border
|
||||
${disabled || isLoading ? "cursor-not-allowed opacity-50" : "cursor-pointer"}
|
||||
${isOpen ? "ring-2 ring-blue-500" : ""}
|
||||
bg-transparent border-gray-200 text-gray-900
|
||||
bg-transparent border-gray-300 text-gray-900
|
||||
transition-all duration-200
|
||||
dark:text-white
|
||||
dark:border-[#353534]
|
||||
bg-white dark:bg-[#171717]
|
||||
`
|
||||
|
||||
const defaultDropdownClass = `
|
||||
|
@ -133,7 +133,8 @@ export const SidepanelForm = ({ dropedFile }: Props) => {
|
||||
setSelectedQuickPrompt,
|
||||
speechToTextLanguage,
|
||||
useOCR,
|
||||
setUseOCR
|
||||
setUseOCR,
|
||||
defaultInternetSearchOn
|
||||
} = useMessage()
|
||||
|
||||
React.useEffect(() => {
|
||||
@ -194,14 +195,25 @@ export const SidepanelForm = ({ dropedFile }: Props) => {
|
||||
}
|
||||
textareaRef.current?.addEventListener("drop", handleDrop)
|
||||
textareaRef.current?.addEventListener("dragover", handleDragOver)
|
||||
|
||||
if (defaultInternetSearchOn) {
|
||||
setWebSearch(true)
|
||||
}
|
||||
|
||||
return () => {
|
||||
textareaRef.current?.removeEventListener("drop", handleDrop)
|
||||
textareaRef.current?.removeEventListener("dragover", handleDragOver)
|
||||
}
|
||||
}, [])
|
||||
|
||||
React.useEffect(() => {
|
||||
if (defaultInternetSearchOn) {
|
||||
setWebSearch(true)
|
||||
}
|
||||
}, [defaultInternetSearchOn])
|
||||
|
||||
return (
|
||||
<div className="px-3 pt-3 md:px-6 md:pt-6 bg-gray-50 dark:bg-[#262626] border rounded-t-xl border-black/10 dark:border-gray-600">
|
||||
<div className="px-3 pt-3 md:px-6 md:pt-6 bg-white dark:bg-[#262626] border rounded-t-xl border-gray-300 dark:border-gray-600">
|
||||
<div
|
||||
className={`h-full rounded-md shadow relative ${
|
||||
form.values.image.length === 0 ? "hidden" : "block"
|
||||
@ -270,7 +282,7 @@ export const SidepanelForm = ({ dropedFile }: Props) => {
|
||||
multiple={false}
|
||||
onChange={onInputChange}
|
||||
/>
|
||||
<div className="w-full border-x border-t flex flex-col dark:border-gray-600 rounded-t-xl p-2">
|
||||
<div className="w-full border-x border-t border-gray-300 flex flex-col dark:border-gray-600 rounded-t-xl p-2">
|
||||
<textarea
|
||||
onKeyDown={(e) => handleKeyDown(e)}
|
||||
ref={textareaRef}
|
||||
@ -302,7 +314,7 @@ export const SidepanelForm = ({ dropedFile }: Props) => {
|
||||
chatMode === "rag" ? "hidden" : "block"
|
||||
}`}>
|
||||
{webSearch ? (
|
||||
<PiGlobe className="h-5 w-5 dark:text-gray-300" />
|
||||
<PiGlobe className="h-5 w-5 text-blue-600 dark:text-blue-400" />
|
||||
) : (
|
||||
<PiGlobeX className="h-5 w-5 text-gray-600 dark:text-gray-400" />
|
||||
)}
|
||||
|
@ -1,13 +1,20 @@
|
||||
import logoImage from "~/assets/icon.png"
|
||||
import { useMessage } from "~/hooks/useMessage"
|
||||
import { Link } from "react-router-dom"
|
||||
import { Tooltip } from "antd"
|
||||
import { BoxesIcon, BrainCog, CogIcon, EraserIcon } from "lucide-react"
|
||||
import { Tooltip, Drawer } from "antd"
|
||||
import {
|
||||
BoxesIcon,
|
||||
BrainCog,
|
||||
CogIcon,
|
||||
EraserIcon,
|
||||
HistoryIcon
|
||||
} from "lucide-react"
|
||||
import { useTranslation } from "react-i18next"
|
||||
import { CurrentChatModelSettings } from "@/components/Common/Settings/CurrentChatModelSettings"
|
||||
import React from "react"
|
||||
import { useStorage } from "@plasmohq/storage/hook"
|
||||
import { PromptSelect } from "@/components/Common/PromptSelect"
|
||||
import { Sidebar } from "@/components/Option/Sidebar"
|
||||
export const SidepanelHeader = () => {
|
||||
const [hideCurrentChatModelSettings] = useStorage(
|
||||
"hideCurrentChatModelSettings",
|
||||
@ -21,10 +28,16 @@ export const SidepanelHeader = () => {
|
||||
streaming,
|
||||
selectedSystemPrompt,
|
||||
setSelectedSystemPrompt,
|
||||
setSelectedQuickPrompt
|
||||
setSelectedQuickPrompt,
|
||||
setMessages,
|
||||
setHistory,
|
||||
setHistoryId,
|
||||
setSelectedModel,
|
||||
historyId
|
||||
} = useMessage()
|
||||
const { t } = useTranslation(["sidepanel", "common"])
|
||||
const [openModelSettings, setOpenModelSettings] = React.useState(false)
|
||||
const [sidebarOpen, setSidebarOpen] = React.useState(false)
|
||||
|
||||
return (
|
||||
<div className="flex px-3 justify-between bg-white dark:bg-[#171717] border-b border-gray-300 dark:border-gray-700 py-4 items-center">
|
||||
@ -53,13 +66,21 @@ export const SidepanelHeader = () => {
|
||||
<EraserIcon className="h-5 w-5 text-gray-500 dark:text-gray-400" />
|
||||
</button>
|
||||
)}
|
||||
<Tooltip title={t("tooltip.history")}>
|
||||
<button
|
||||
onClick={() => {
|
||||
setSidebarOpen(true)
|
||||
}}
|
||||
className="flex items-center space-x-1 focus:outline-none focus-visible:ring-2 focus-visible:ring-pink-700">
|
||||
<HistoryIcon className="h-5 w-5 text-gray-500 dark:text-gray-400" />
|
||||
</button>
|
||||
</Tooltip>
|
||||
<PromptSelect
|
||||
selectedSystemPrompt={selectedSystemPrompt}
|
||||
setSelectedSystemPrompt={setSelectedSystemPrompt}
|
||||
setSelectedQuickPrompt={setSelectedQuickPrompt}
|
||||
className="text-gray-500 dark:text-gray-400 hover:text-gray-600 dark:hover:text-gray-300 transition-colors"
|
||||
/>
|
||||
|
||||
{!hideCurrentChatModelSettings && (
|
||||
<Tooltip title={t("common:currentChatModelSettings")}>
|
||||
<button
|
||||
@ -77,6 +98,31 @@ export const SidepanelHeader = () => {
|
||||
open={openModelSettings}
|
||||
setOpen={setOpenModelSettings}
|
||||
/>
|
||||
|
||||
<Drawer
|
||||
title={
|
||||
<div className="flex items-center justify-between">
|
||||
{t("tooltip.history")}
|
||||
</div>
|
||||
}
|
||||
placement="left"
|
||||
closeIcon={null}
|
||||
onClose={() => setSidebarOpen(false)}
|
||||
open={sidebarOpen}>
|
||||
<Sidebar
|
||||
onClose={() => setSidebarOpen(false)}
|
||||
setMessages={setMessages}
|
||||
setHistory={setHistory}
|
||||
setHistoryId={setHistoryId}
|
||||
setSelectedModel={setSelectedModel}
|
||||
setSelectedSystemPrompt={setSelectedSystemPrompt}
|
||||
clearChat={clearChat}
|
||||
historyId={historyId}
|
||||
setSystemPrompt={(e) => {}}
|
||||
temporaryChat={false}
|
||||
history={history}
|
||||
/>
|
||||
</Drawer>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
@ -34,7 +34,6 @@ import { pageAssistModel } from "@/models"
|
||||
import { getPrompt } from "@/services/application"
|
||||
import { humanMessageFormatter } from "@/utils/human-message"
|
||||
import { pageAssistEmbeddingModel } from "@/models/embedding"
|
||||
import { PageAssistVectorStore } from "@/libs/PageAssistVectorStore"
|
||||
import { PAMemoryVectorStore } from "@/libs/PAMemoryVectorStore"
|
||||
import { getScreenshotFromCurrentTab } from "@/libs/get-screenshot"
|
||||
|
||||
@ -56,7 +55,10 @@ export const useMessage = () => {
|
||||
setWebSearch,
|
||||
isSearchingInternet
|
||||
} = useStoreMessageOption()
|
||||
|
||||
const [defaultInternetSearchOn, ] = useStorage(
|
||||
"defaultInternetSearchOn",
|
||||
false
|
||||
)
|
||||
const [chatWithWebsiteEmbedding] = useStorage(
|
||||
"chatWithWebsiteEmbedding",
|
||||
true
|
||||
@ -108,6 +110,9 @@ export const useMessage = () => {
|
||||
setIsProcessing(false)
|
||||
setStreaming(false)
|
||||
currentChatModelSettings.reset()
|
||||
if(defaultInternetSearchOn) {
|
||||
setWebSearch(true)
|
||||
}
|
||||
}
|
||||
|
||||
const chatWithWebsiteMode = async (
|
||||
@ -1715,6 +1720,7 @@ export const useMessage = () => {
|
||||
speechToTextLanguage,
|
||||
setSpeechToTextLanguage,
|
||||
useOCR,
|
||||
setUseOCR
|
||||
setUseOCR,
|
||||
defaultInternetSearchOn
|
||||
}
|
||||
}
|
||||
|
@ -76,6 +76,10 @@ export const useMessageOption = () => {
|
||||
} = useStoreMessageOption()
|
||||
const currentChatModelSettings = useStoreChatModelSettings()
|
||||
const [selectedModel, setSelectedModel] = useStorage("selectedModel")
|
||||
const [defaultInternetSearchOn, ] = useStorage(
|
||||
"defaultInternetSearchOn",
|
||||
false
|
||||
)
|
||||
const [speechToTextLanguage, setSpeechToTextLanguage] = useStorage(
|
||||
"speechToTextLanguage",
|
||||
"en-US"
|
||||
@ -98,6 +102,9 @@ export const useMessageOption = () => {
|
||||
setStreaming(false)
|
||||
currentChatModelSettings.reset()
|
||||
textareaRef?.current?.focus()
|
||||
if(defaultInternetSearchOn) {
|
||||
setWebSearch(true)
|
||||
}
|
||||
}
|
||||
|
||||
const searchChatMode = async (
|
||||
@ -1198,6 +1205,7 @@ export const useMessageOption = () => {
|
||||
temporaryChat,
|
||||
setTemporaryChat,
|
||||
useOCR,
|
||||
setUseOCR
|
||||
setUseOCR,
|
||||
defaultInternetSearchOn,
|
||||
}
|
||||
}
|
||||
|
@ -26,7 +26,6 @@ export const getIsVisitSpecificWebsite = async () => {
|
||||
return isVisitSpecificWebsite === "true"
|
||||
}
|
||||
|
||||
|
||||
export const setIsVisitSpecificWebsite = async (
|
||||
isVisitSpecificWebsite: boolean
|
||||
) => {
|
||||
@ -101,23 +100,39 @@ export const setGoogleDomain = async (domain: string) => {
|
||||
await storage2.set("searchGoogleDomain", domain)
|
||||
}
|
||||
|
||||
export const getInternetSearchOn = async () => {
|
||||
const defaultInternetSearchOn = await storage.get<boolean | undefined>(
|
||||
"defaultInternetSearchOn"
|
||||
)
|
||||
return defaultInternetSearchOn ?? false
|
||||
}
|
||||
|
||||
export const setInternetSearchOn = async (defaultInternetSearchOn: boolean) => {
|
||||
await storage.set("defaultInternetSearchOn", defaultInternetSearchOn)
|
||||
}
|
||||
|
||||
export const getSearchSettings = async () => {
|
||||
const [isSimpleInternetSearch, searchProvider, totalSearchResult, visitSpecificWebsite,
|
||||
const [
|
||||
isSimpleInternetSearch,
|
||||
searchProvider,
|
||||
totalSearchResult,
|
||||
visitSpecificWebsite,
|
||||
searxngURL,
|
||||
searxngJSONMode,
|
||||
braveApiKey,
|
||||
googleDomain
|
||||
] =
|
||||
await Promise.all([
|
||||
getIsSimpleInternetSearch(),
|
||||
getSearchProvider(),
|
||||
totalSearchResults(),
|
||||
getIsVisitSpecificWebsite(),
|
||||
getSearxngURL(),
|
||||
isSearxngJSONMode(),
|
||||
getBraveApiKey(),
|
||||
getGoogleDomain()
|
||||
])
|
||||
googleDomain,
|
||||
defaultInternetSearchOn
|
||||
] = await Promise.all([
|
||||
getIsSimpleInternetSearch(),
|
||||
getSearchProvider(),
|
||||
totalSearchResults(),
|
||||
getIsVisitSpecificWebsite(),
|
||||
getSearxngURL(),
|
||||
isSearxngJSONMode(),
|
||||
getBraveApiKey(),
|
||||
getGoogleDomain(),
|
||||
getInternetSearchOn()
|
||||
])
|
||||
|
||||
return {
|
||||
isSimpleInternetSearch,
|
||||
@ -127,7 +142,8 @@ export const getSearchSettings = async () => {
|
||||
searxngURL,
|
||||
searxngJSONMode,
|
||||
braveApiKey,
|
||||
googleDomain
|
||||
googleDomain,
|
||||
defaultInternetSearchOn
|
||||
}
|
||||
}
|
||||
|
||||
@ -139,16 +155,18 @@ export const setSearchSettings = async ({
|
||||
searxngJSONMode,
|
||||
searxngURL,
|
||||
braveApiKey,
|
||||
googleDomain
|
||||
googleDomain,
|
||||
defaultInternetSearchOn
|
||||
}: {
|
||||
isSimpleInternetSearch: boolean
|
||||
searchProvider: string
|
||||
totalSearchResults: number
|
||||
visitSpecificWebsite: boolean
|
||||
searxngURL: string
|
||||
searxngJSONMode: boolean,
|
||||
braveApiKey: string,
|
||||
googleDomain: string
|
||||
searxngJSONMode: boolean
|
||||
braveApiKey: string
|
||||
googleDomain: string,
|
||||
defaultInternetSearchOn: boolean
|
||||
}) => {
|
||||
await Promise.all([
|
||||
setIsSimpleInternetSearch(isSimpleInternetSearch),
|
||||
@ -158,6 +176,7 @@ export const setSearchSettings = async ({
|
||||
setSearxngJSONMode(searxngJSONMode),
|
||||
setSearxngURL(searxngURL),
|
||||
setBraveApiKey(braveApiKey),
|
||||
setGoogleDomain(googleDomain)
|
||||
setGoogleDomain(googleDomain),
|
||||
setInternetSearchOn(defaultInternetSearchOn)
|
||||
])
|
||||
}
|
||||
|
@ -51,7 +51,7 @@ export default defineConfig({
|
||||
outDir: "build",
|
||||
|
||||
manifest: {
|
||||
version: "1.4.1",
|
||||
version: "1.4.2",
|
||||
name:
|
||||
process.env.TARGET === "firefox"
|
||||
? "Page Assist - A Web UI for Local AI Models"
|
||||
|
Loading…
x
Reference in New Issue
Block a user