feat: Add option to enable chat with website by default

This commit is contained in:
n4ze3m 2025-01-18 22:04:39 +05:30
parent aacade6c84
commit 7443d0ab6b
19 changed files with 86 additions and 3 deletions

View File

@ -21,6 +21,9 @@
"copilotResumeLastChat": {
"label": "استئناف آخر محادثة عند فتح اللوحة الجانبية (كوبيلوت)"
},
"turnOnChatWithWebsite": {
"label": "تمكين الدردشة مع الموقع بشكل افتراضي (كوبيلوت)"
},
"webUIResumeLastChat": {
"label": "استئناف آخر محادثة عند فتح واجهة المستخدم"
},

View File

@ -21,6 +21,9 @@
"copilotResumeLastChat": {
"label": "Letzten Chat beim Öffnen des Seitenpanels fortsetzen (Copilot)"
},
"turnOnChatWithWebsite": {
"label": "Chat mit Website standardmäßig aktivieren (Copilot)"
},
"webUIResumeLastChat": {
"label": "Letzten Chat beim Öffnen der Web-UI fortsetzen"
},

View File

@ -21,6 +21,9 @@
"copilotResumeLastChat": {
"label": "Resume the last chat when opening the SidePanel (Copilot)"
},
"turnOnChatWithWebsite": {
"label": "Enable Chat with Website by default (Copilot)"
},
"webUIResumeLastChat": {
"label": "Resume the last chat when opening the Web UI"
},

View File

@ -21,6 +21,9 @@
"copilotResumeLastChat": {
"label": "Retomar el último chat al abrir el Panel Lateral (Copilot)"
},
"turnOnChatWithWebsite": {
"label": "Habilitar Chat con Sitio Web por defecto (Copilot)"
},
"webUIResumeLastChat": {
"label": "Retomar el último chat al abrir la Interfaz Web"
},

View File

@ -21,6 +21,9 @@
"copilotResumeLastChat": {
"label": "آخرین گفتگو را هنگام باز کردن SidePanel (Copilot) از سر بگیر"
},
"turnOnChatWithWebsite": {
"label": "فعال کردن گپ با وب سایت به صورت پیش‌فرض (کوپایلوت)"
},
"hideCurrentChatModelSettings": {
"label": "مخفی کردن تنظیمات مدل گپ فعلی را"
},

View File

@ -21,6 +21,9 @@
"copilotResumeLastChat": {
"label": "Reprendre la dernière conversation lors de l'ouverture du sidepanel (Copilot)"
},
"turnOnChatWithWebsite": {
"label": "Activer le chat avec le site Web par défaut (Copilot)"
},
"webUIResumeLastChat": {
"label": "Reprendre la dernière conversation lors de l'ouverture de l'interface Web"
},

View File

@ -21,6 +21,9 @@
"copilotResumeLastChat": {
"label": "Riprendi l'ultima chat quando apri il Pannello Laterale (Copilot)"
},
"turnOnChatWithWebsite": {
"label": "Abilita Chat con il Sito Web per impostazione predefinita (Copilot)"
},
"webUIResumeLastChat": {
"label": "Riprendi l'ultima chat quando apri l'interfaccia Web"
},

View File

@ -24,6 +24,9 @@
"copilotResumeLastChat": {
"label": "サイドパネルを開いたときに最後のチャットを再開 (Copilot)"
},
"turnOnChatWithWebsite": {
"label": "デフォルトでウェブサイトとのチャットを有効にする (Copilot)"
},
"webUIResumeLastChat": {
"label": "Web UIを開いたときに最後のチャットを再開"
},

View File

@ -24,6 +24,9 @@
"copilotResumeLastChat": {
"label": "사이드 패널을 열 때 마지막 채팅 재개 (Copilot)"
},
"turnOnChatWithWebsite": {
"label": "웹사이트와의 채팅 기본 활성화 (Copilot)"
},
"webUIResumeLastChat": {
"label": "웹 UI를 열 때 마지막 채팅 재개"
},

View File

@ -24,6 +24,9 @@
"copilotResumeLastChat": {
"label": "സൈഡ്പാനൽ തുറക്കുമ്പോൾ അവസാനത്തെ ചാറ്റ് പുനരാരംഭിക്കുക (Copilot)"
},
"turnOnChatWithWebsite": {
"label": "സ്ഥിരസ്ഥിതിയായി വെബ്സൈറ്റുമായുള്ള ചാറ്റ് പ്രവർത്തനക്ഷമമാക്കുക (കോപൈലറ്റ്)"
},
"webUIResumeLastChat": {
"label": "വെബ് UI തുറക്കുമ്പോൾ അവസാനത്തെ ചാറ്റ് പുനരാരംഭിക്കുക"
},

View File

@ -21,6 +21,9 @@
"copilotResumeLastChat": {
"label": "Gjenoppta siste chat ved åpning av SidePanel (copilot)"
},
"turnOnChatWithWebsite": {
"label": "Aktiver Chat med Nettsted som standard (Copilot)"
},
"webUIResumeLastChat": {
"label": "Gjenoppta siste chat når Web UI åpnes"
},

View File

@ -21,6 +21,9 @@
"copilotResumeLastChat": {
"label": "Retomar o último chat ao abrir o Painel Lateral (Copilot)"
},
"turnOnChatWithWebsite": {
"label": "Ativar Chat com o Site por padrão (Copilot)"
},
"webUIResumeLastChat": {
"label": "Retomar o último chat ao abrir a Interface Web"
},

View File

@ -21,6 +21,9 @@
"copilotResumeLastChat": {
"label": "Возобновить последний чат при открытии боковой панели (Copilot)"
},
"turnOnChatWithWebsite": {
"label": "Включить чат с веб-сайтом по умолчанию (Copilot)"
},
"webUIResumeLastChat": {
"label": "Возобновить последний чат при открытии веб-интерфейса"
},

View File

@ -21,6 +21,9 @@
"copilotResumeLastChat": {
"label": "Återuppta den senaste chatten när du öppnar sidopanelen (Copilot)"
},
"turnOnChatWithWebsite": {
"label": "Aktivera Chatta med Webbplats som standard (Copilot)"
},
"webUIResumeLastChat": {
"label": "Återuppta den senaste chatten när du öppnar webbgränssnittet"
},

View File

@ -21,6 +21,9 @@
"copilotResumeLastChat": {
"label": "Поновити останню розмову при відкритті бічної панелі (Copilot)"
},
"turnOnChatWithWebsite": {
"label": "Увімкнути чат з веб-сайтом за замовчуванням (Copilot)"
},
"webUIResumeLastChat": {
"label": "Поновити останню розмову при відкритті веб-інтерфейсу"
},

View File

@ -24,6 +24,9 @@
"copilotResumeLastChat": {
"label": "打开侧边栏时恢复上次聊天Copilot"
},
"turnOnChatWithWebsite": {
"label": "默认启用与网站对话Copilot"
},
"webUIResumeLastChat": {
"label": "打开Web UI时恢复上次聊天"
},

View File

@ -31,6 +31,10 @@ export const GeneralSettings = () => {
"webUIResumeLastChat",
false
)
const [defaultChatWithWebsite, setDefaultChatWithWebsite] = useStorage(
"defaultChatWithWebsite",
false
)
const [restoreLastChatModel, setRestoreLastChatModel] = useStorage(
"restoreLastChatModel",
@ -118,6 +122,17 @@ export const GeneralSettings = () => {
onChange={(checked) => setCopilotResumeLastChat(checked)}
/>
</div>
<div className="flex flex-row justify-between">
<div className="inline-flex items-center gap-2">
<span className="text-gray-700 dark:text-neutral-50">
{t("generalSettings.settings.turnOnChatWithWebsite.label")}
</span>
</div>
<Switch
checked={defaultChatWithWebsite}
onChange={(checked) => setDefaultChatWithWebsite(checked)}
/>
</div>
<div className="flex flex-row justify-between">
<div className="inline-flex items-center gap-2">
<span className="text-gray-700 dark:text-neutral-50">
@ -220,7 +235,7 @@ export const GeneralSettings = () => {
</h2>
<div className="border border-b border-gray-200 dark:border-gray-600 mt-3"></div>
</div>
<div className="flex flex-row mb-3 justify-between">
<span className="text-gray-700 dark:text-neutral-50 ">
{t("generalSettings.system.export.label")}

View File

@ -134,7 +134,8 @@ export const SidepanelForm = ({ dropedFile }: Props) => {
speechToTextLanguage,
useOCR,
setUseOCR,
defaultInternetSearchOn
defaultInternetSearchOn,
defaultChatWithWebsite
} = useMessage()
React.useEffect(() => {
@ -200,6 +201,10 @@ export const SidepanelForm = ({ dropedFile }: Props) => {
setWebSearch(true)
}
if (defaultChatWithWebsite) {
setChatMode("rag")
}
return () => {
textareaRef.current?.removeEventListener("drop", handleDrop)
textareaRef.current?.removeEventListener("dragover", handleDragOver)
@ -212,6 +217,12 @@ export const SidepanelForm = ({ dropedFile }: Props) => {
}
}, [defaultInternetSearchOn])
React.useEffect(() => {
if (defaultChatWithWebsite) {
setChatMode("rag")
}
}, [defaultChatWithWebsite])
return (
<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

View File

@ -59,6 +59,11 @@ export const useMessage = () => {
"defaultInternetSearchOn",
false
)
const [
defaultChatWithWebsite,
] = useStorage("defaultChatWithWebsite", false)
const [chatWithWebsiteEmbedding] = useStorage(
"chatWithWebsiteEmbedding",
true
@ -113,6 +118,9 @@ export const useMessage = () => {
if(defaultInternetSearchOn) {
setWebSearch(true)
}
if(defaultChatWithWebsite) {
setChatMode("rag")
}
}
const chatWithWebsiteMode = async (
@ -1721,6 +1729,7 @@ export const useMessage = () => {
setSpeechToTextLanguage,
useOCR,
setUseOCR,
defaultInternetSearchOn
defaultInternetSearchOn,
defaultChatWithWebsite
}
}