-
-
Notifications
You must be signed in to change notification settings - Fork 52
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
222 additions
and
63 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
106 changes: 106 additions & 0 deletions
106
apps/admin/src/pages/chat/components/AssistantSidebar/types/index.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,119 @@ | ||
/** | ||
* Interface representing a chat assistant. | ||
* 表示一个聊天助手的接口。 | ||
*/ | ||
export interface Assistant { | ||
/** | ||
* Unique identifier for the assistant. | ||
* 聊天助手的唯一标识符。 | ||
*/ | ||
id: string; | ||
|
||
/** | ||
* Name of the assistant. | ||
* 聊天助手的名称。 | ||
*/ | ||
name: string; | ||
|
||
/** | ||
* URL of the assistant's avatar image. | ||
* 聊天助手头像的 URL。 | ||
*/ | ||
avatar: string; | ||
|
||
/** | ||
* Prompt or introductory message for the assistant. | ||
* 聊天助手的提示或介绍性消息。 | ||
*/ | ||
prompt: string; | ||
|
||
/** | ||
* Availability status of the assistant. | ||
* 聊天助手的可用性状态。 | ||
*/ | ||
available: boolean; | ||
|
||
/** | ||
* Date when the assistant was last active. | ||
* 聊天助手上次活动的日期。 | ||
*/ | ||
lastDate: Date; | ||
|
||
/** | ||
* Text representation of the last active date. | ||
* 上次活动日期的文本表示。 | ||
*/ | ||
lastDateText: string; | ||
|
||
/** | ||
* Description or bio of the assistant. | ||
* 聊天助手的描述或简介。 | ||
*/ | ||
description: string; | ||
|
||
/** | ||
* Number of likes received by the assistant. | ||
* 聊天助手收到的点赞数。 | ||
*/ | ||
likes?: number; | ||
|
||
/** | ||
* Number of dislikes received by the assistant. | ||
* 聊天助手收到的踩数。 | ||
*/ | ||
dislikes?: number; | ||
|
||
/** | ||
* Number of shares for the assistant. | ||
* 聊天助手的分享数。 | ||
*/ | ||
shares?: number; | ||
} | ||
|
||
/** | ||
* Interface representing summary information of a chat session. | ||
* 表示聊天会话摘要信息的接口。 | ||
*/ | ||
export interface ChatSummary { | ||
/** | ||
* Unique identifier for the chat summary. | ||
* 聊天摘要的唯一标识符。 | ||
*/ | ||
id: string; | ||
|
||
/** | ||
* ID of the associated chat assistant. | ||
* 相关联的聊天助手的 ID。 | ||
*/ | ||
assistantId: string; | ||
|
||
/** | ||
* Title or summary of the chat session. | ||
* 聊天会话的标题或摘要。 | ||
*/ | ||
title: string; | ||
|
||
/** | ||
* Indicates whether the chat session is archived. | ||
* 表示聊天会话是否已归档。 | ||
*/ | ||
archived: boolean; | ||
} | ||
|
||
/** | ||
* Interface representing the sidebar content for chat history. | ||
* 表示聊天历史侧边栏内容的接口。 | ||
*/ | ||
export interface ChatHistorySidebar { | ||
/** | ||
* ID of the associated chat assistant. | ||
* 相关联的聊天助手的 ID。 | ||
*/ | ||
assistantId: string; | ||
|
||
/** | ||
* List of chat summaries displayed in the sidebar. | ||
* 显示在侧边栏中的聊天摘要列表。 | ||
*/ | ||
chatSummaries: ChatSummary[]; | ||
} |
69 changes: 69 additions & 0 deletions
69
apps/admin/src/pages/chat/components/ChatHistorySidebar/components/ChatHistoryItem.vue
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
<script setup lang="ts"> | ||
import { renderIcon } from "@celeris/components"; | ||
import type { RendererElement, RendererNode, VNode } from "vue"; | ||
import type { ChatSummary } from "~/pages/chat/components/AssistantSidebar/types"; | ||
import ActionIcon from "~/component/ActionIcon/src/ActionIcon.vue"; | ||
defineProps({ | ||
chatSummary: { | ||
type: Object as () => ChatSummary, | ||
required: true, | ||
}, | ||
}); | ||
const showActions = ref(false); | ||
const TrashIcon = "carbon:trash-can"; | ||
const MenuHorizontalIcon = "carbon:overflow-menu-horizontal"; | ||
const ExportIcon = "tabler:download"; | ||
const EditIcon = "tabler:edit"; | ||
const ArchiveIcon = "tabler:archive"; | ||
interface MenuItem { | ||
label: string; | ||
key: string; | ||
icon?: () => VNode<RendererNode, RendererElement, { [key: string]: any }>; | ||
} | ||
const menuItems: MenuItem[] = [ | ||
{ | ||
label: "导出", | ||
key: "Export", | ||
icon: renderIcon(ExportIcon), | ||
}, | ||
{ | ||
label: "重命名", | ||
key: "Edit", | ||
icon: renderIcon(EditIcon), | ||
}, | ||
{ | ||
label: "删除", | ||
key: "Delete", | ||
icon: renderIcon(TrashIcon), | ||
}, | ||
]; | ||
const menuOptions = ref<MenuItem[]>(menuItems); | ||
</script> | ||
|
||
<template> | ||
<div class="w-full rounded-lg transition ease-out flex mx-2 px-2 py-1.5 hover:bg-[var(--hover-color)]" @mouseover="showActions = true" @mouseleave="showActions = false"> | ||
<div class="overflow-hidden flex flex-col grow gap-1 p-1.5"> | ||
<NText class="description text-ellipsis"> | ||
{{ chatSummary.title }} | ||
</NText> | ||
</div> | ||
<!-- 显示操作组 --> | ||
<div v-show="showActions" class="chat-history-item-actions-group flex gap-x-2"> | ||
<div class="menu-options flex justify-center opacity-80"> | ||
<NDropdown :options="menuOptions"> | ||
<NButton text> | ||
<CAIcon :name="MenuHorizontalIcon" :size="20" /> | ||
</NButton> | ||
</NDropdown> | ||
</div> | ||
<ActionIcon tooltip-text="归档" :icon="ArchiveIcon" :size="20" transparent /> | ||
</div> | ||
</div> | ||
</template> | ||
|
||
<style scoped> | ||
</style> |
78 changes: 28 additions & 50 deletions
78
apps/admin/src/pages/chat/components/ChatHistorySidebar/components/ChatList.vue
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters