Skip to content

Commit

Permalink
[Add] 🎨 Plugin Panel when Anonymous
Browse files Browse the repository at this point in the history
  • Loading branch information
Harry-zklcdc committed Jan 15, 2024
1 parent ab744ec commit 56d4d1c
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 21 deletions.
13 changes: 7 additions & 6 deletions frontend/src/components/ChatNav/ChatNav.vue
Original file line number Diff line number Diff line change
Expand Up @@ -244,14 +244,15 @@ const saveAdvancedSetting = () => {
sydneyPrompt.value = sydneyPromptSetting.value;
userStore.setPassServer(passServerSetting.value)
if (history.value) {
if (userStore.getUserToken()) {
CIB.vm.sidePanel.isVisibleDesktop = true;
document.querySelector('cib-serp')?.setAttribute('alignment', 'left');
if (userStore.getUserToken() && !enterpriseEnable.value) {
CIB.vm.sidePanel.panels = [{type: 'threads', label: '最近的活动'},{type: 'plugins', label: '插件'}]
} else {
CIB.vm.sidePanel.panels = [{type: 'plugins', label: '插件'}]
CIB.vm.sidePanel.selectedPanel = 'plugins'
}
} else {
CIB.vm.sidePanel.isVisibleDesktop = false;
CIB.vm.sidePanel.isVisibleMobile = false;
document.querySelector('cib-serp')?.setAttribute('alignment', 'center');
CIB.vm.sidePanel.panels = [{type: 'plugins', label: '插件'}]
CIB.vm.sidePanel.selectedPanel = 'plugins'
}
themeMode.value = themeModeSetting.value;
if (themeModeSetting.value == 'light') {
Expand Down
23 changes: 8 additions & 15 deletions frontend/src/stores/modules/user/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,22 +47,15 @@ export const useUserStore = defineStore(
await fetch('/search?q=Bing+AI&showconv=1&FORM=hpcodx&ajaxhist=0&ajaxserp=0&cc=us', {
credentials: 'include',
})
if (historyEnable.value && !enterpriseEnable.value) {
CIB.vm.sidePanel.isVisibleDesktop = true;
document.querySelector('cib-serp')?.setAttribute('alignment', 'left');
// 设置历史记录侧边栏的高度为 90vh
document.querySelector('cib-serp')?.shadowRoot?.querySelector('cib-side-panel')?.shadowRoot?.querySelector('div.scroller')?.setAttribute('style', 'height: 90vh');
} else {
CIB.vm.sidePanel.isVisibleDesktop = false;
document.querySelector('cib-serp')?.setAttribute('alignment', 'center');
}
const token = getUserToken();
if (!token) {
// 未登录不显示历史记录
CIB.config.features.enableGetChats = false;
CIB.vm.sidePanel.isVisibleMobile = false;
CIB.vm.sidePanel.isVisibleDesktop = false;
document.querySelector('cib-serp')?.setAttribute('alignment', 'center');
if (historyEnable.value) {
if (!token || enterpriseEnable.value) {
CIB.vm.sidePanel.panels = [{type: 'plugins', label: '插件'}]
CIB.vm.sidePanel.selectedPanel = 'plugins'
}
} else {
CIB.vm.sidePanel.panels = [{type: 'plugins', label: '插件'}]
CIB.vm.sidePanel.selectedPanel = 'plugins'
}
};

Expand Down
11 changes: 11 additions & 0 deletions frontend/types/bing/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,17 @@ declare const CIB: {
* PC 是否显示 get shouldShowPanel
*/
isVisibleDesktop: boolean;
/**
* 选择的面板 threads / plugins
*/
selectedPanel: string;
/**
* 面板列表
*/
panels: {
type: string;
label: string;
}[];
};
/**
* 选择对话样式
Expand Down

0 comments on commit 56d4d1c

Please sign in to comment.