2024-11-20 15:09:54 +08:00
|
|
|
|
import SettingItem from '@/settings/SettingItem'
|
|
|
|
|
import useSettingsStore from '@/settings/useSettingsStore'
|
|
|
|
|
import { Radio, Switch } from 'ant-design-vue'
|
|
|
|
|
import clsx from 'clsx'
|
|
|
|
|
import { defineComponent, watch } from 'vue'
|
|
|
|
|
import useLayoutStore from '../useLayoutStore'
|
|
|
|
|
import { sendParent } from '@/utils/parent'
|
|
|
|
|
|
|
|
|
|
export default defineComponent({
|
|
|
|
|
setup() {
|
|
|
|
|
const settings = useSettingsStore()
|
|
|
|
|
watch(
|
|
|
|
|
() => ({
|
2024-11-28 16:44:29 +08:00
|
|
|
|
autoSearch: settings.state.autoUseAi === 'auto',
|
2024-11-20 15:09:54 +08:00
|
|
|
|
showTabButton: settings.state.showPetOnTab,
|
2024-11-28 16:44:29 +08:00
|
|
|
|
ifSearch: settings.state.autoUseAi !== ''
|
2024-11-20 15:09:54 +08:00
|
|
|
|
}),
|
|
|
|
|
(val) => {
|
2024-11-27 18:52:35 +08:00
|
|
|
|
|
2024-11-20 15:09:54 +08:00
|
|
|
|
sendParent([
|
|
|
|
|
'configAI',
|
|
|
|
|
{
|
|
|
|
|
autoSearch: val.autoSearch,
|
|
|
|
|
showTabButton: val.showTabButton,
|
2024-11-28 16:44:29 +08:00
|
|
|
|
ifSearch: val.ifSearch
|
2024-11-20 15:09:54 +08:00
|
|
|
|
}
|
|
|
|
|
])
|
2024-11-28 16:44:29 +08:00
|
|
|
|
console.log({
|
|
|
|
|
autoSearch: val.autoSearch,
|
|
|
|
|
showTabButton: val.showTabButton,
|
|
|
|
|
ifSearch: val.ifSearch
|
|
|
|
|
});
|
|
|
|
|
|
2024-11-20 15:09:54 +08:00
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
immediate: true
|
|
|
|
|
}
|
|
|
|
|
)
|
|
|
|
|
return () => (
|
|
|
|
|
<div class="p-4 flex flex-col ">
|
|
|
|
|
<div class={'flex flex-col'}>
|
|
|
|
|
<span
|
|
|
|
|
class={clsx(
|
|
|
|
|
'text-[14px] font-bold',
|
|
|
|
|
useLayoutStore().state.current === 0 ? 'text-white' : ' text-[#333]'
|
|
|
|
|
)}
|
|
|
|
|
>
|
|
|
|
|
AI助手
|
|
|
|
|
</span>
|
|
|
|
|
<span class={'text-[13px] text-[#666] '}>设置AI助手样式</span>
|
|
|
|
|
<div
|
|
|
|
|
class={clsx(
|
|
|
|
|
'w-full h-[1px] bg-black/10 mt-1 mb-2',
|
|
|
|
|
useLayoutStore().state.current === 0 ? 'bg-white/10' : ' bg-black/10'
|
|
|
|
|
)}
|
|
|
|
|
></div>
|
|
|
|
|
</div>
|
|
|
|
|
<span
|
|
|
|
|
class={clsx(
|
|
|
|
|
'text-[14px] font-bold my-2',
|
|
|
|
|
useLayoutStore().state.current === 0 ? 'text-white' : 'text-[#333]'
|
|
|
|
|
)}
|
|
|
|
|
>
|
|
|
|
|
功能开关
|
|
|
|
|
</span>
|
|
|
|
|
<SettingItem
|
|
|
|
|
v-slots={{
|
2024-11-27 18:52:35 +08:00
|
|
|
|
label: () => <div>侧边栏助手</div>
|
2024-11-20 15:09:54 +08:00
|
|
|
|
}}
|
2024-11-27 18:52:35 +08:00
|
|
|
|
desc="浏览其它网页时的侧边栏功能"
|
|
|
|
|
noRoundedT
|
2024-11-20 15:09:54 +08:00
|
|
|
|
>
|
|
|
|
|
<Switch
|
2024-11-27 18:52:35 +08:00
|
|
|
|
checked={settings.state.showPetOnTab}
|
2024-11-20 15:09:54 +08:00
|
|
|
|
onUpdate:checked={(e) => {
|
2024-11-27 18:52:35 +08:00
|
|
|
|
if (e) settings.state.showPetOnTab = true
|
|
|
|
|
else settings.state.showPetOnTab = false
|
2024-11-20 15:09:54 +08:00
|
|
|
|
}}
|
|
|
|
|
/>
|
|
|
|
|
</SettingItem>
|
|
|
|
|
<SettingItem
|
|
|
|
|
v-slots={{
|
|
|
|
|
label: () => <div>标签页助手</div>
|
|
|
|
|
}}
|
2024-11-27 18:52:35 +08:00
|
|
|
|
noRoundedB
|
2024-11-20 15:09:54 +08:00
|
|
|
|
desc="fatfox标签页内的小助手"
|
|
|
|
|
>
|
|
|
|
|
<Switch
|
2024-11-27 18:52:35 +08:00
|
|
|
|
checked={settings.state.showPet}
|
2024-11-20 15:09:54 +08:00
|
|
|
|
onUpdate:checked={(e) => {
|
2024-11-27 18:52:35 +08:00
|
|
|
|
if (e) settings.state.showPet = true
|
|
|
|
|
else settings.state.showPet = false
|
2024-11-20 15:09:54 +08:00
|
|
|
|
}}
|
|
|
|
|
/>
|
|
|
|
|
</SettingItem>
|
2024-11-27 18:52:35 +08:00
|
|
|
|
|
2024-11-20 15:09:54 +08:00
|
|
|
|
<span
|
|
|
|
|
class={clsx(
|
|
|
|
|
'text-[14px] font-bold my-2',
|
|
|
|
|
useLayoutStore().state.current === 0 ? 'text-white' : 'text-[#333]'
|
|
|
|
|
)}
|
|
|
|
|
>
|
|
|
|
|
结果增强
|
|
|
|
|
</span>
|
|
|
|
|
<SettingItem
|
|
|
|
|
v-slots={{
|
|
|
|
|
label: () => <div>结果增强开关</div>
|
|
|
|
|
}}
|
|
|
|
|
desc="使用搜索引擎时,Fatfox会给您更多有效的结果"
|
|
|
|
|
>
|
|
|
|
|
<Switch
|
|
|
|
|
checked={settings.state.autoUseAi !== ''}
|
|
|
|
|
onUpdate:checked={(e) => {
|
|
|
|
|
if (e) settings.state.autoUseAi = 'show'
|
|
|
|
|
else settings.state.autoUseAi = ''
|
|
|
|
|
}}
|
|
|
|
|
/>
|
|
|
|
|
</SettingItem>
|
|
|
|
|
|
2024-11-28 16:44:29 +08:00
|
|
|
|
{/* <div
|
2024-11-20 15:09:54 +08:00
|
|
|
|
class={clsx('flex w-full py-2 px-3 rounded-lg flex-col', {
|
|
|
|
|
'bg-black/5': useLayoutStore().state.current !== 0,
|
|
|
|
|
'bg-white/10': useLayoutStore().state.current === 0
|
|
|
|
|
})}
|
|
|
|
|
>
|
|
|
|
|
<span>何时使用结果增强</span>
|
|
|
|
|
<SettingItem
|
|
|
|
|
v-slots={{
|
|
|
|
|
label: () => <div>每次询问</div>
|
|
|
|
|
}}
|
|
|
|
|
noBg
|
|
|
|
|
desc="每次搜索直接询问fatfox"
|
|
|
|
|
>
|
|
|
|
|
<Radio
|
2024-11-28 16:44:29 +08:00
|
|
|
|
checked={settings.state.autoUseAi === 'auto'}
|
2024-11-20 15:09:54 +08:00
|
|
|
|
onClick={() => {
|
2024-11-28 16:44:29 +08:00
|
|
|
|
settings.state.autoUseAi = 'auto'
|
2024-11-20 15:09:54 +08:00
|
|
|
|
}}
|
2024-11-28 16:44:29 +08:00
|
|
|
|
|
2024-11-20 15:09:54 +08:00
|
|
|
|
/>
|
|
|
|
|
</SettingItem>
|
|
|
|
|
<SettingItem
|
|
|
|
|
v-slots={{
|
|
|
|
|
label: () => <div>手动询问</div>
|
|
|
|
|
}}
|
|
|
|
|
noBg
|
|
|
|
|
desc="每次搜索,提示您进行手动查询"
|
|
|
|
|
>
|
|
|
|
|
<Radio
|
2024-11-28 16:44:29 +08:00
|
|
|
|
checked={settings.state.autoUseAi === 'show'}
|
2024-11-20 15:09:54 +08:00
|
|
|
|
onClick={() => {
|
2024-11-28 16:44:29 +08:00
|
|
|
|
settings.state.autoUseAi = 'show'
|
2024-11-20 15:09:54 +08:00
|
|
|
|
}}
|
|
|
|
|
/>
|
|
|
|
|
</SettingItem>
|
2024-11-28 16:44:29 +08:00
|
|
|
|
</div> */}
|
2024-11-20 15:09:54 +08:00
|
|
|
|
</div>
|
|
|
|
|
)
|
|
|
|
|
}
|
|
|
|
|
})
|