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": { "copilotResumeLastChat": {
"label": "استئناف آخر محادثة عند فتح اللوحة الجانبية (كوبيلوت)" "label": "استئناف آخر محادثة عند فتح اللوحة الجانبية (كوبيلوت)"
}, },
"turnOnChatWithWebsite": {
"label": "تمكين الدردشة مع الموقع بشكل افتراضي (كوبيلوت)"
},
"webUIResumeLastChat": { "webUIResumeLastChat": {
"label": "استئناف آخر محادثة عند فتح واجهة المستخدم" "label": "استئناف آخر محادثة عند فتح واجهة المستخدم"
}, },

View File

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

View File

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

View File

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

View File

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

View File

@ -21,6 +21,9 @@
"copilotResumeLastChat": { "copilotResumeLastChat": {
"label": "Reprendre la dernière conversation lors de l'ouverture du sidepanel (Copilot)" "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": { "webUIResumeLastChat": {
"label": "Reprendre la dernière conversation lors de l'ouverture de l'interface Web" "label": "Reprendre la dernière conversation lors de l'ouverture de l'interface Web"
}, },

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -31,6 +31,10 @@ export const GeneralSettings = () => {
"webUIResumeLastChat", "webUIResumeLastChat",
false false
) )
const [defaultChatWithWebsite, setDefaultChatWithWebsite] = useStorage(
"defaultChatWithWebsite",
false
)
const [restoreLastChatModel, setRestoreLastChatModel] = useStorage( const [restoreLastChatModel, setRestoreLastChatModel] = useStorage(
"restoreLastChatModel", "restoreLastChatModel",
@ -118,6 +122,17 @@ export const GeneralSettings = () => {
onChange={(checked) => setCopilotResumeLastChat(checked)} onChange={(checked) => setCopilotResumeLastChat(checked)}
/> />
</div> </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="flex flex-row justify-between">
<div className="inline-flex items-center gap-2"> <div className="inline-flex items-center gap-2">
<span className="text-gray-700 dark:text-neutral-50"> <span className="text-gray-700 dark:text-neutral-50">

View File

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

View File

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