Browse Source

恢复聊天记录与工作空间功能

master
mk 6 months ago
parent
commit
940f7c7a2a
  1. 54
      src/lib/components/chat/Header.svelte
  2. 4
      src/lib/components/layout/Sidebar.svelte
  3. 2
      src/routes/(app)/workspace/+layout.svelte

54
src/lib/components/chat/Header.svelte

@ -1,6 +1,10 @@
<script lang="ts"> <script lang="ts">
import { createEventDispatcher } from 'svelte'; import { createEventDispatcher } from 'svelte';
import { goto } from '$app/navigation';
const dispatch = createEventDispatcher(); const dispatch = createEventDispatcher();
import {
showSidebar,
} from '$lib/stores';
let list = [ let list = [
{ {
title: '工作', title: '工作',
@ -15,22 +19,16 @@
placeholder: placeholder:
'<p>帮我写一份用于&nbsp;例如<span style="color:#2c77f1 !important">项目进度、本周工作等</span>&nbsp;的工作总结,包括<span style="color:#2c77f1 !important">工作内容、成果、风险点等。</span></p>' '<p>帮我写一份用于&nbsp;例如<span style="color:#2c77f1 !important">项目进度、本周工作等</span>&nbsp;的工作总结,包括<span style="color:#2c77f1 !important">工作内容、成果、风险点等。</span></p>'
}, },
{ // {
label: '文档生成', // label: '文档生成',
img: '/img/icon/document.png', // img: '/img/icon/document.png',
imgActive: '/img/icon/document_active.png', // imgActive: '/img/icon/document_active.png',
active: false // active: false
} // }
], ],
introduce: [ introduce: [
{ {
label: '介绍' label: '可以为您生成12345热线办理、社区活动开展等内容的工作总结。'
},
{
label: '介绍'
},
{
label: '介绍'
} }
] ]
}, },
@ -48,13 +46,7 @@
], ],
introduce: [ introduce: [
{ {
label: '介绍' label: '可以对平台维护的知识库(含共享空间)文档内容进行检索,您可以说出您的问题,我会尽力为您查找答案。'
},
{
label: '介绍'
},
{
label: '介绍'
} }
] ]
}, },
@ -72,13 +64,7 @@
], ],
introduce: [ introduce: [
{ {
label: '介绍' label: '我还会记忆您之前问过的问题哦,点击可以查看您之前的历史会话。'
},
{
label: '介绍'
},
{
label: '介绍'
} }
] ]
} }
@ -108,7 +94,7 @@
<div class="flex mt-5.5"> <div class="flex mt-5.5">
{#each item.buttons as but, index (index)} {#each item.buttons as but, index (index)}
<button <button
class="font-medium text-black text-base mr-4 bg-white rounded-2xl px-6 py-1 box-border flex items-center border {but.active class="font-medium text-black text-base mr-4 bg-white rounded-2xl px-6 py-1 box-border flex items-center border {but.label === '历史消息'||but.label === '工作总结'?'mt-4.5':''} {but.active
? 'border-blue-500 text-blue-500' ? 'border-blue-500 text-blue-500'
: ''}" : ''}"
on:click={() => { on:click={() => {
@ -117,11 +103,21 @@
if (c.active === true && c.label !== but.label) { if (c.active === true && c.label !== but.label) {
c.active = false; c.active = false;
} else if (c.label === but.label) { } else if (c.label === but.label) {
c.active = true; if(but.label === '历史消息'){
c.active = !c.active
}else {
c.active = true;
}
} }
}); });
}); });
list = [...list]; list = [...list];
if(but.label === '检索知识库'){
goto('/workspace/knowledge');
}else if(but.label === '历史消息'){
showSidebar.set(!$showSidebar);
}
dispatch('savePlaceholder',but.placeholder || null) dispatch('savePlaceholder',but.placeholder || null)
}} }}
> >

4
src/lib/components/layout/Sidebar.svelte

@ -567,7 +567,7 @@
{#if $user?.role === 'admin' || $user?.permissions?.workspace?.models || $user?.permissions?.workspace?.knowledge || $user?.permissions?.workspace?.prompts || $user?.permissions?.workspace?.tools} {#if $user?.role === 'admin' || $user?.permissions?.workspace?.models || $user?.permissions?.workspace?.knowledge || $user?.permissions?.workspace?.prompts || $user?.permissions?.workspace?.tools}
<div class="px-1.5 flex justify-center text-gray-800 "> <div class="px-1.5 flex justify-center text-gray-800 ">
<!-- <a <a
class="grow flex items-center space-x-3 rounded-lg px-2 py-[7px] hover:bg-gray-100 transition" class="grow flex items-center space-x-3 rounded-lg px-2 py-[7px] hover:bg-gray-100 transition"
href="/workspace" href="/workspace"
on:click={() => { on:click={() => {
@ -600,7 +600,7 @@
<div class="flex self-center translate-y-[0.5px]"> <div class="flex self-center translate-y-[0.5px]">
<div class=" self-center font-medium text-sm font-primary">{$i18n.t('Workspace')}</div> <div class=" self-center font-medium text-sm font-primary">{$i18n.t('Workspace')}</div>
</div> </div>
</a> --> </a>
</div> </div>
{/if} {/if}

2
src/routes/(app)/workspace/+layout.svelte

@ -122,7 +122,7 @@
</div> </div>
</div> </div>
<!-- <div class="flex items-center text-xl font-semibold">{$i18n.t('Workspace')}</div> --> <div class="flex items-center text-xl font-semibold">{$i18n.t('Workspace')}</div>
</div> </div>
</nav> </nav>

Loading…
Cancel
Save