|
|
@@ -1,6 +1,7 @@
|
|
|
<script setup lang="ts">
|
|
|
import { NInput, NButton, NEmpty, NScrollbar, NPopconfirm, NSpin, NTag, NModal, NCard, NDrawer, NDrawerContent } from 'naive-ui'
|
|
|
import { ref, nextTick, watch, onMounted, computed } from 'vue'
|
|
|
+import { useClipboard } from '@vueuse/core'
|
|
|
import { useAiChat } from './useAiChat'
|
|
|
import { listAiFiles, downloadAiFile } from '@/service/aiChat'
|
|
|
import type { AiFileItem } from './interface'
|
|
|
@@ -37,6 +38,15 @@ const fileInputRef = ref<HTMLInputElement>()
|
|
|
const editingSessionId = ref('')
|
|
|
const editingTitle = ref('')
|
|
|
|
|
|
+const { copy } = useClipboard()
|
|
|
+
|
|
|
+function copySessionId(id?: string) {
|
|
|
+ const target = id || currentSessionId.value
|
|
|
+ if (target) {
|
|
|
+ copy(target)
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
onMounted(() => {
|
|
|
fetchSession()
|
|
|
})
|
|
|
@@ -198,6 +208,14 @@ function formatExpiry(expiresAt: number): string {
|
|
|
<span class="i-ph:list text-sm" />
|
|
|
</NButton>
|
|
|
<span class="text-xs text-neutral-400">AI 助手</span>
|
|
|
+ <span
|
|
|
+ v-if="currentSessionId"
|
|
|
+ class="cursor-pointer rounded bg-neutral-100 px-1.5 py-0.5 font-mono text-[10px] text-neutral-400 transition-colors hover:bg-neutral-200 hover:text-neutral-600 dark:bg-neutral-700 dark:hover:bg-neutral-600 dark:hover:text-neutral-300"
|
|
|
+ :title="currentSessionId"
|
|
|
+ @click.stop="copySessionId()"
|
|
|
+ >
|
|
|
+ {{ currentSessionId.slice(0, 8) }}
|
|
|
+ </span>
|
|
|
</div>
|
|
|
<div class="flex items-center gap-1">
|
|
|
<NButton text size="small" title="上传文件历史" @click="showFileDrawer('upload')">
|
|
|
@@ -269,8 +287,16 @@ function formatExpiry(expiresAt: number): string {
|
|
|
</NPopconfirm>
|
|
|
</div>
|
|
|
</div>
|
|
|
- <div class="mt-0.5 text-neutral-400 text-[10px]">
|
|
|
- {{ formatTime(sess.lastActive) }}
|
|
|
+ <div class="mt-0.5 flex items-center gap-1 text-neutral-400 text-[10px]">
|
|
|
+ <span
|
|
|
+ class="cursor-pointer rounded bg-neutral-100 px-1 font-mono transition-colors hover:bg-neutral-200 hover:text-neutral-600 dark:bg-neutral-700 dark:hover:bg-neutral-600 dark:hover:text-neutral-300"
|
|
|
+ :title="sess.sessionId"
|
|
|
+ @click.stop="copySessionId(sess.sessionId)"
|
|
|
+ >
|
|
|
+ {{ sess.sessionId.slice(0, 8) }}
|
|
|
+ </span>
|
|
|
+ <span>·</span>
|
|
|
+ <span>{{ formatTime(sess.lastActive) }}</span>
|
|
|
</div>
|
|
|
</div>
|
|
|
<NEmpty v-if="sessionList.length === 0" description="暂无历史对话" size="small" />
|