You've already forked agentic-coding-workflow
删除会话
This commit is contained in:
@@ -19,6 +19,7 @@
|
|||||||
"license": "ISC",
|
"license": "ISC",
|
||||||
"packageManager": "pnpm@10.32.1",
|
"packageManager": "pnpm@10.32.1",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
"@vicons/ionicons5": "^0.13.0",
|
||||||
"markdown-it": "^14.1.1",
|
"markdown-it": "^14.1.1",
|
||||||
"naive-ui": "^2.44.1",
|
"naive-ui": "^2.44.1",
|
||||||
"pinia": "^3.0.4",
|
"pinia": "^3.0.4",
|
||||||
|
|||||||
Generated
+8
@@ -8,6 +8,9 @@ importers:
|
|||||||
|
|
||||||
.:
|
.:
|
||||||
dependencies:
|
dependencies:
|
||||||
|
'@vicons/ionicons5':
|
||||||
|
specifier: ^0.13.0
|
||||||
|
version: 0.13.0
|
||||||
markdown-it:
|
markdown-it:
|
||||||
specifier: ^14.1.1
|
specifier: ^14.1.1
|
||||||
version: 14.1.1
|
version: 14.1.1
|
||||||
@@ -524,6 +527,9 @@ packages:
|
|||||||
resolution: {integrity: sha512-LdDNl6C5iJExcM0Yh0PwAIBb9PrSiCsWamF/JyEZawm3kFDnRoaq3LGE4bpyRao/fWeGKKyw7icx0YxrLFC5Cg==}
|
resolution: {integrity: sha512-LdDNl6C5iJExcM0Yh0PwAIBb9PrSiCsWamF/JyEZawm3kFDnRoaq3LGE4bpyRao/fWeGKKyw7icx0YxrLFC5Cg==}
|
||||||
engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0}
|
engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0}
|
||||||
|
|
||||||
|
'@vicons/ionicons5@0.13.0':
|
||||||
|
resolution: {integrity: sha512-zvZKBPjEXKN7AXNo2Na2uy+nvuv6SP4KAMQxpKL2vfHMj0fSvuw7JZcOPCjQC3e7ayssKnaoFVAhbYcW6v41qQ==}
|
||||||
|
|
||||||
'@vitejs/plugin-vue@6.0.6':
|
'@vitejs/plugin-vue@6.0.6':
|
||||||
resolution: {integrity: sha512-u9HHgfrq3AjXlysn0eINFnWQOJQLO9WN6VprZ8FXl7A2bYisv3Hui9Ij+7QZ41F/WYWarHjwBbXtD7dKg3uxbg==}
|
resolution: {integrity: sha512-u9HHgfrq3AjXlysn0eINFnWQOJQLO9WN6VprZ8FXl7A2bYisv3Hui9Ij+7QZ41F/WYWarHjwBbXtD7dKg3uxbg==}
|
||||||
engines: {node: ^20.19.0 || >=22.12.0}
|
engines: {node: ^20.19.0 || >=22.12.0}
|
||||||
@@ -2065,6 +2071,8 @@ snapshots:
|
|||||||
'@typescript-eslint/types': 8.59.1
|
'@typescript-eslint/types': 8.59.1
|
||||||
eslint-visitor-keys: 5.0.1
|
eslint-visitor-keys: 5.0.1
|
||||||
|
|
||||||
|
'@vicons/ionicons5@0.13.0': {}
|
||||||
|
|
||||||
'@vitejs/plugin-vue@6.0.6(vite@8.0.10(@types/node@25.6.0)(jiti@2.6.1)(yaml@2.8.3))(vue@3.5.33(typescript@6.0.3))':
|
'@vitejs/plugin-vue@6.0.6(vite@8.0.10(@types/node@25.6.0)(jiti@2.6.1)(yaml@2.8.3))(vue@3.5.33(typescript@6.0.3))':
|
||||||
dependencies:
|
dependencies:
|
||||||
'@rolldown/pluginutils': 1.0.0-rc.13
|
'@rolldown/pluginutils': 1.0.0-rc.13
|
||||||
|
|||||||
@@ -14,17 +14,39 @@
|
|||||||
v-for="c in chat.conversations"
|
v-for="c in chat.conversations"
|
||||||
:key="c.id"
|
:key="c.id"
|
||||||
:class="[
|
:class="[
|
||||||
'p-2 rounded cursor-pointer hover:bg-neutral-100',
|
'group p-2 rounded cursor-pointer hover:bg-neutral-100 flex items-center justify-between gap-2',
|
||||||
chat.currentConversation?.id === c.id ? 'bg-blue-50' : '',
|
chat.currentConversation?.id === c.id ? 'bg-blue-50' : '',
|
||||||
]"
|
]"
|
||||||
@click="open(c.id)"
|
@click="open(c.id)"
|
||||||
>
|
>
|
||||||
<div class="truncate text-sm">
|
<div class="flex-1 min-w-0">
|
||||||
{{ c.title || '(未命名)' }}
|
<div class="truncate text-sm">
|
||||||
</div>
|
{{ c.title || '(未命名)' }}
|
||||||
<div class="text-xs text-neutral-400">
|
</div>
|
||||||
{{ formatTime(c.updated_at) }}
|
<div class="text-xs text-neutral-400">
|
||||||
|
{{ formatTime(c.updated_at) }}
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<NPopconfirm
|
||||||
|
:show-icon="false"
|
||||||
|
@positive-click="chat.deleteConversation(c.id)"
|
||||||
|
>
|
||||||
|
<template #trigger>
|
||||||
|
<NButton
|
||||||
|
text
|
||||||
|
size="tiny"
|
||||||
|
class="opacity-0 group-hover:opacity-100 transition-opacity"
|
||||||
|
@click.stop
|
||||||
|
>
|
||||||
|
<template #icon>
|
||||||
|
<NIcon><TrashOutline /></NIcon>
|
||||||
|
</template>
|
||||||
|
</NButton>
|
||||||
|
</template>
|
||||||
|
<template #default>
|
||||||
|
删除后无法恢复,确定删除此会话?
|
||||||
|
</template>
|
||||||
|
</NPopconfirm>
|
||||||
</div>
|
</div>
|
||||||
<div
|
<div
|
||||||
v-if="chat.conversations.length === 0"
|
v-if="chat.conversations.length === 0"
|
||||||
@@ -43,6 +65,28 @@
|
|||||||
选择或新建会话
|
选择或新建会话
|
||||||
</div>
|
</div>
|
||||||
<template v-else>
|
<template v-else>
|
||||||
|
<!-- 头部操作栏 -->
|
||||||
|
<div class="border-b px-4 py-2 flex items-center justify-between">
|
||||||
|
<div class="text-sm font-medium truncate flex-1">
|
||||||
|
{{ chat.currentConversation.title || '(未命名)' }}
|
||||||
|
</div>
|
||||||
|
<NPopconfirm
|
||||||
|
:show-icon="false"
|
||||||
|
@positive-click="deleteCurrentConversation"
|
||||||
|
>
|
||||||
|
<template #trigger>
|
||||||
|
<NButton text size="small">
|
||||||
|
<template #icon>
|
||||||
|
<NIcon><TrashOutline /></NIcon>
|
||||||
|
</template>
|
||||||
|
删除
|
||||||
|
</NButton>
|
||||||
|
</template>
|
||||||
|
<template #default>
|
||||||
|
删除后无法恢复,确定删除此会话?
|
||||||
|
</template>
|
||||||
|
</NPopconfirm>
|
||||||
|
</div>
|
||||||
<div
|
<div
|
||||||
ref="scrollEl"
|
ref="scrollEl"
|
||||||
class="flex-1 overflow-y-auto p-4 space-y-3"
|
class="flex-1 overflow-y-auto p-4 space-y-3"
|
||||||
@@ -101,7 +145,8 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { computed, nextTick, onMounted, ref, watch } from 'vue'
|
import { computed, nextTick, onMounted, ref, watch } from 'vue'
|
||||||
import { useRoute, useRouter } from 'vue-router'
|
import { useRoute, useRouter } from 'vue-router'
|
||||||
import { NButton, NInput } from 'naive-ui'
|
import { NButton, NInput, NPopconfirm, NIcon } from 'naive-ui'
|
||||||
|
import { TrashOutline } from '@vicons/ionicons5'
|
||||||
|
|
||||||
import AppShell from '@/layouts/AppShell.vue'
|
import AppShell from '@/layouts/AppShell.vue'
|
||||||
import { useChatStore } from '@/stores/chat'
|
import { useChatStore } from '@/stores/chat'
|
||||||
@@ -206,6 +251,15 @@ async function onCreated(id: string) {
|
|||||||
await open(id)
|
await open(id)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async function deleteCurrentConversation() {
|
||||||
|
const id = chat.currentConversation?.id
|
||||||
|
if (!id) return
|
||||||
|
await chat.deleteConversation(id)
|
||||||
|
await router.replace({
|
||||||
|
path: projectId.value ? `/projects/${projectId.value}/chat` : `/chat`,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
function formatTime(iso: string) {
|
function formatTime(iso: string) {
|
||||||
return new Date(iso).toLocaleString('zh-CN', { hour12: false })
|
return new Date(iso).toLocaleString('zh-CN', { hour12: false })
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user