@lsamien/yaoyao 0.4.78 → 0.4.79
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/build-info.json +6 -3
- package/dist/assets/{AboutDialog-jvhTP8-J.js → AboutDialog-CrajAC--.js} +2 -2
- package/dist/assets/{AboutDialog-jvhTP8-J.js.map → AboutDialog-CrajAC--.js.map} +1 -1
- package/dist/assets/{BotAutomationsView-ktoci79V.js → BotAutomationsView-DTOoFSEl.js} +2 -2
- package/dist/assets/{BotAutomationsView-ktoci79V.js.map → BotAutomationsView-DTOoFSEl.js.map} +1 -1
- package/dist/assets/{BotPluginsDialog-H85RI-7P.js → BotPluginsDialog-Ckiwmito.js} +2 -2
- package/dist/assets/{BotPluginsDialog-H85RI-7P.js.map → BotPluginsDialog-Ckiwmito.js.map} +1 -1
- package/dist/assets/{BotSettingsDialog-Ci_DZL4m.js → BotSettingsDialog-ChffrjSM.js} +4 -4
- package/dist/assets/{BotSettingsDialog-Ci_DZL4m.js.map → BotSettingsDialog-ChffrjSM.js.map} +1 -1
- package/dist/assets/{ChatView-6cdLMsuy.js → ChatView-znZF8RZE.js} +2 -2
- package/dist/assets/{ChatView-6cdLMsuy.js.map → ChatView-znZF8RZE.js.map} +1 -1
- package/dist/assets/{ComputerPanel-Dbwgx5n8.js → ComputerPanel-bNkvZAiT.js} +2 -2
- package/dist/assets/{ComputerPanel-Dbwgx5n8.js.map → ComputerPanel-bNkvZAiT.js.map} +1 -1
- package/dist/assets/{ComputerViewerView-csnhRedK.js → ComputerViewerView-DCTvbHr-.js} +2 -2
- package/dist/assets/{ComputerViewerView-csnhRedK.js.map → ComputerViewerView-DCTvbHr-.js.map} +1 -1
- package/dist/assets/{ConversationsView-CEO2SVGT.js → ConversationsView-BnysxvX_.js} +4 -4
- package/dist/assets/{ConversationsView-CEO2SVGT.js.map → ConversationsView-BnysxvX_.js.map} +1 -1
- package/dist/assets/{ConversationsView-CHLGKsJt.css → ConversationsView-CbArO1v2.css} +1 -1
- package/dist/assets/{FilesView-t5jA-H2-.js → FilesView-D7tA6Nu1.js} +2 -2
- package/dist/assets/{FilesView-t5jA-H2-.js.map → FilesView-D7tA6Nu1.js.map} +1 -1
- package/dist/assets/{FloatingResourceSearch-BAYymuJV.js → FloatingResourceSearch-c6l1JuAA.js} +2 -2
- package/dist/assets/{FloatingResourceSearch-BAYymuJV.js.map → FloatingResourceSearch-c6l1JuAA.js.map} +1 -1
- package/dist/assets/{HistoryView-BqMSV9iC.js → HistoryView-Cnsriop4.js} +2 -2
- package/dist/assets/{HistoryView-BqMSV9iC.js.map → HistoryView-Cnsriop4.js.map} +1 -1
- package/dist/assets/{KanbanView-CWwrwH9S.js → KanbanView-CXm05b62.js} +2 -2
- package/dist/assets/{KanbanView-CWwrwH9S.js.map → KanbanView-CXm05b62.js.map} +1 -1
- package/dist/assets/{LocalVmSettingsPanel-BXvZwFQP.js → LocalVmSettingsPanel-HgNC1SCF.js} +2 -2
- package/dist/assets/{LocalVmSettingsPanel-BXvZwFQP.js.map → LocalVmSettingsPanel-HgNC1SCF.js.map} +1 -1
- package/dist/assets/{RunnerSettingsPanel-KkpIkkob.js → RunnerSettingsPanel-CLKZvWua.js} +2 -2
- package/dist/assets/{RunnerSettingsPanel-KkpIkkob.js.map → RunnerSettingsPanel-CLKZvWua.js.map} +1 -1
- package/dist/assets/{StandaloneDialog-D4BQqjpB.js → StandaloneDialog-DODllzh1.js} +2 -2
- package/dist/assets/{StandaloneDialog-D4BQqjpB.js.map → StandaloneDialog-DODllzh1.js.map} +1 -1
- package/dist/assets/{UpdateCheckDialog-Ct0bT6xU.js → UpdateCheckDialog-DHcAuryL.js} +2 -2
- package/dist/assets/{UpdateCheckDialog-Ct0bT6xU.js.map → UpdateCheckDialog-DHcAuryL.js.map} +1 -1
- package/dist/assets/{WorkspaceKnowledgePanel-WBcPB49x.js → WorkspaceKnowledgePanel-BrE8xSi2.js} +2 -2
- package/dist/assets/{WorkspaceKnowledgePanel-WBcPB49x.js.map → WorkspaceKnowledgePanel-BrE8xSi2.js.map} +1 -1
- package/dist/assets/{WorkspaceRoutinesPanel-JubUwGsV.js → WorkspaceRoutinesPanel-CpDVEwHx.js} +2 -2
- package/dist/assets/{WorkspaceRoutinesPanel-JubUwGsV.js.map → WorkspaceRoutinesPanel-CpDVEwHx.js.map} +1 -1
- package/dist/assets/WorkspaceShell-Dhm3r61t.js +44 -0
- package/dist/assets/WorkspaceShell-Dhm3r61t.js.map +1 -0
- package/dist/assets/WorkspaceShell-Dk003lIq.css +1 -0
- package/dist/assets/{WorkspaceView-DTanioWW.js → WorkspaceView-CBWFRLki.js} +2 -2
- package/dist/assets/{WorkspaceView-DTanioWW.js.map → WorkspaceView-CBWFRLki.js.map} +1 -1
- package/dist/assets/{docx-preview-B1SjJgD_.js → docx-preview-CG4CK2Qm.js} +2 -2
- package/dist/assets/{docx-preview-B1SjJgD_.js.map → docx-preview-CG4CK2Qm.js.map} +1 -1
- package/dist/assets/{index-CWamgtSb.js → index-BRP9NWum.js} +4 -4
- package/dist/assets/index-BRP9NWum.js.map +1 -0
- package/dist/assets/{pdf-DVDddcFC.js → pdf-CFWXmhVF.js} +2 -2
- package/dist/assets/{pdf-DVDddcFC.js.map → pdf-CFWXmhVF.js.map} +1 -1
- package/dist/assets/{sessionOwnership-0hdKcwOs.js → sessionOwnership-B2YxdBdf.js} +2 -2
- package/dist/assets/{sessionOwnership-0hdKcwOs.js.map → sessionOwnership-B2YxdBdf.js.map} +1 -1
- package/dist/assets/{viewModels-DKBqaDRg.js → viewModels-CYJ8m5Uf.js} +4 -4
- package/dist/assets/{viewModels-DKBqaDRg.js.map → viewModels-CYJ8m5Uf.js.map} +1 -1
- package/dist/index.html +1 -1
- package/package.json +1 -1
- package/release.json +3 -3
- package/dist/assets/WorkspaceShell-0m4gg6AW.css +0 -1
- package/dist/assets/WorkspaceShell-Do2VAwIz.js +0 -44
- package/dist/assets/WorkspaceShell-Do2VAwIz.js.map +0 -1
- package/dist/assets/index-CWamgtSb.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FilesView-t5jA-H2-.js","names":[],"sources":["../../src/client/components/library/LibraryGrid.vue","../../src/client/components/library/LibraryGrid.vue","../../src/client/api/files.ts","../../src/client/stores/files.ts","../../src/client/views/FilesView.vue","../../src/client/views/FilesView.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport AppIcon from '@/components/common/AppIcon.vue'\nimport EmptyState from '@/components/common/EmptyState.vue'\nimport type { UiLibraryItem } from './types'\n\nwithDefaults(defineProps<{\n items: UiLibraryItem[]\n selectedId?: string\n loading?: boolean\n hasMore?: boolean\n emptyTitle?: string\n emptyDescription?: string\n kind?: 'files' | 'artifacts'\n}>(), {\n selectedId: '', loading: false, hasMore: false, emptyTitle: '暂无文件', emptyDescription: '这里会显示来自 Hermes 的文件。', kind: 'files',\n})\n\nconst emit = defineEmits<{\n select: [item: UiLibraryItem]\n loadMore: []\n addToComposer: [item: UiLibraryItem]\n source: [item: UiLibraryItem]\n}>()\n\nfunction iconFor(item: UiLibraryItem) {\n if (item.kind === 'document' || item.kind === 'pdf' || item.kind === 'code' || item.kind === 'text') return 'file'\n return item.kind\n}\n\nfunction kindLabel(item: UiLibraryItem) {\n return ({ image: '图片', video: '视频', audio: '音频', pdf: '文档', document: '文档', code: '文档', text: '文档', link: '网页', file: '其他' } as const)[item.kind]\n}\n\nfunction formatSize(size?: number) {\n if (size === undefined) return ''\n if (size < 1024) return `${size} B`\n if (size < 1024 * 1024) return `${(size / 1024).toFixed(1)} KB`\n return `${(size / 1024 / 1024).toFixed(1)} MB`\n}\n\nfunction formatDate(value?: string | number | Date) {\n if (!value) return ''\n const date = value instanceof Date ? value : new Date(value)\n if (Number.isNaN(date.getTime())) return ''\n return new Intl.DateTimeFormat('zh-CN', { month: 'short', day: 'numeric' }).format(date)\n}\n</script>\n\n<template>\n <div class=\"library-scroll\">\n <div v-if=\"loading && !items.length\" class=\"library-skeleton\">\n <i v-for=\"n in 10\" :key=\"n\" :style=\"{ opacity: .95 - n * .04 }\" />\n </div>\n <EmptyState v-else-if=\"!items.length\" :icon=\"kind === 'files' ? 'files' : 'artifacts'\" :title=\"emptyTitle\" :description=\"emptyDescription\" />\n <div v-else class=\"library-grid\">\n <article\n v-for=\"item in items\"\n :key=\"item.id\"\n :class=\"{ selected: item.id === selectedId }\"\n tabindex=\"0\"\n @click=\"emit('select', item)\"\n @keydown.enter=\"emit('select', item)\"\n >\n <div class=\"library-thumb\" :class=\"`library-thumb--${item.kind}`\">\n <img v-if=\"item.kind === 'image' && item.previewUrl\" :src=\"item.previewUrl\" :alt=\"item.name\" loading=\"lazy\" />\n <video v-else-if=\"item.kind === 'video' && item.previewUrl\" :src=\"item.previewUrl\" muted preload=\"metadata\" />\n <span v-else><AppIcon :name=\"iconFor(item)\" :size=\"36\" /><em>{{ item.name.split('.').at(-1)?.slice(0, 5).toUpperCase() }} · {{ kindLabel(item) }}</em></span>\n <div class=\"library-thumb__actions\">\n <button type=\"button\" title=\"加入输入框\" aria-label=\"加入输入框\" @click.stop=\"emit('addToComposer', item)\"><AppIcon name=\"plus\" :size=\"14\" /></button>\n <button v-if=\"item.sourceSessionId\" type=\"button\" title=\"查看来源\" aria-label=\"查看来源\" @click.stop=\"emit('source', item)\"><AppIcon name=\"external\" :size=\"14\" /></button>\n </div>\n </div>\n <div class=\"library-copy\">\n <strong :title=\"item.name\">{{ item.title || item.name }}</strong>\n <span><small>{{ item.sourceLabel || formatSize(item.size) || item.kind }}</small><time>{{ formatDate(item.updatedAt || item.createdAt) }}</time></span>\n </div>\n </article>\n </div>\n <button v-if=\"hasMore\" class=\"load-more\" type=\"button\" :disabled=\"loading\" @click=\"emit('loadMore')\">{{ loading ? '加载中…' : '加载更多' }}</button>\n </div>\n</template>\n\n<style scoped>\n.library-scroll { min-height: 0; flex: 1; overflow-y: auto; padding: 20px clamp(18px, 3vw, 36px) 32px; }\n.library-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 16px 12px; }\narticle { min-width: 0; overflow: hidden; border: 1px solid var(--line); border-radius: 11px; background: var(--surface); cursor: pointer; outline: 0; transition: border-color 140ms ease, box-shadow 140ms ease, transform 140ms ease; } article:focus-visible, article.selected { border-color: var(--line-strong); box-shadow: 0 0 0 2px var(--focus-ring); } article:hover { border-color: var(--line-strong); box-shadow: 0 8px 22px rgba(0,0,0,.07); transform: translateY(-1px); }\n.library-thumb { position: relative; display: grid; height: 154px; place-items: center; overflow: hidden; border: 0; border-bottom: 1px solid var(--line); border-radius: 0; background: var(--surface-soft); color: var(--text-muted); }\n.library-thumb img, .library-thumb video { width: 100%; height: 100%; object-fit: cover; }\n.library-thumb > span { display: flex; flex-direction: column; align-items: center; gap: 7px; }.library-thumb > span em { max-width: 150px; overflow: hidden; color: var(--text-muted); font-size: 11px; font-style: normal; letter-spacing: .02em; text-overflow: ellipsis; text-transform: capitalize; }\n.library-thumb--code, .library-thumb--text { background: linear-gradient(135deg, var(--surface-soft), var(--surface-raised)); }.library-thumb--link { border-style: dashed; }\n.library-thumb__actions { position: absolute; top: 6px; right: 6px; display: flex; gap: 4px; opacity: 0; transform: translateY(-3px); transition: opacity 120ms ease, transform 140ms var(--ease-out); }.library-thumb:hover .library-thumb__actions, article:focus-within .library-thumb__actions { opacity: 1; transform: translateY(0); }.library-thumb__actions button { display: grid; place-items: center; width: 28px; height: 28px; padding: 0; border: 1px solid rgba(255,255,255,.32); border-radius: 8px; background: rgba(25,25,24,.72); color: #fff; cursor: pointer; backdrop-filter: blur(8px); }\n.library-copy { padding: 10px 12px 9px; }.library-copy strong { display: block; overflow: hidden; font-size: 13px; font-weight: 550; text-overflow: ellipsis; white-space: nowrap; }.library-copy > span { display: flex; margin-top: 5px; justify-content: space-between; gap: 8px; color: var(--text-muted); font-size: 11px; line-height: 1.4; }.library-copy small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }.library-copy time { flex: 0 0 auto; }\n.load-more { display: block; margin: 28px auto 0; padding: 7px 12px; border: 1px solid var(--line); border-radius: 9px; background: transparent; color: var(--text-secondary); cursor: pointer; font-size: 10px; }.load-more:hover { background: var(--surface-hover); }\n.library-skeleton { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 16px 12px; }.library-skeleton i { height: 208px; border-radius: 11px; background: linear-gradient(90deg, var(--surface-soft), var(--surface-hover), var(--surface-soft)); background-size: 200% 100%; animation: shimmer 1.5s linear infinite; }\n@keyframes shimmer { to { background-position: -200% 0; } }\n@media (max-width: 600px) { .library-scroll { padding: 16px 12px 30px; }.library-grid, .library-skeleton { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 9px; }.library-thumb { height: 122px; }.library-thumb__actions { opacity: 1; transform: none; }.library-copy { padding: 8px 9px; }.library-copy strong { font-size: 11px; }.library-copy > span { font-size: 9px; } }\n</style>\n","<script setup lang=\"ts\">\nimport AppIcon from '@/components/common/AppIcon.vue'\nimport EmptyState from '@/components/common/EmptyState.vue'\nimport type { UiLibraryItem } from './types'\n\nwithDefaults(defineProps<{\n items: UiLibraryItem[]\n selectedId?: string\n loading?: boolean\n hasMore?: boolean\n emptyTitle?: string\n emptyDescription?: string\n kind?: 'files' | 'artifacts'\n}>(), {\n selectedId: '', loading: false, hasMore: false, emptyTitle: '暂无文件', emptyDescription: '这里会显示来自 Hermes 的文件。', kind: 'files',\n})\n\nconst emit = defineEmits<{\n select: [item: UiLibraryItem]\n loadMore: []\n addToComposer: [item: UiLibraryItem]\n source: [item: UiLibraryItem]\n}>()\n\nfunction iconFor(item: UiLibraryItem) {\n if (item.kind === 'document' || item.kind === 'pdf' || item.kind === 'code' || item.kind === 'text') return 'file'\n return item.kind\n}\n\nfunction kindLabel(item: UiLibraryItem) {\n return ({ image: '图片', video: '视频', audio: '音频', pdf: '文档', document: '文档', code: '文档', text: '文档', link: '网页', file: '其他' } as const)[item.kind]\n}\n\nfunction formatSize(size?: number) {\n if (size === undefined) return ''\n if (size < 1024) return `${size} B`\n if (size < 1024 * 1024) return `${(size / 1024).toFixed(1)} KB`\n return `${(size / 1024 / 1024).toFixed(1)} MB`\n}\n\nfunction formatDate(value?: string | number | Date) {\n if (!value) return ''\n const date = value instanceof Date ? value : new Date(value)\n if (Number.isNaN(date.getTime())) return ''\n return new Intl.DateTimeFormat('zh-CN', { month: 'short', day: 'numeric' }).format(date)\n}\n</script>\n\n<template>\n <div class=\"library-scroll\">\n <div v-if=\"loading && !items.length\" class=\"library-skeleton\">\n <i v-for=\"n in 10\" :key=\"n\" :style=\"{ opacity: .95 - n * .04 }\" />\n </div>\n <EmptyState v-else-if=\"!items.length\" :icon=\"kind === 'files' ? 'files' : 'artifacts'\" :title=\"emptyTitle\" :description=\"emptyDescription\" />\n <div v-else class=\"library-grid\">\n <article\n v-for=\"item in items\"\n :key=\"item.id\"\n :class=\"{ selected: item.id === selectedId }\"\n tabindex=\"0\"\n @click=\"emit('select', item)\"\n @keydown.enter=\"emit('select', item)\"\n >\n <div class=\"library-thumb\" :class=\"`library-thumb--${item.kind}`\">\n <img v-if=\"item.kind === 'image' && item.previewUrl\" :src=\"item.previewUrl\" :alt=\"item.name\" loading=\"lazy\" />\n <video v-else-if=\"item.kind === 'video' && item.previewUrl\" :src=\"item.previewUrl\" muted preload=\"metadata\" />\n <span v-else><AppIcon :name=\"iconFor(item)\" :size=\"36\" /><em>{{ item.name.split('.').at(-1)?.slice(0, 5).toUpperCase() }} · {{ kindLabel(item) }}</em></span>\n <div class=\"library-thumb__actions\">\n <button type=\"button\" title=\"加入输入框\" aria-label=\"加入输入框\" @click.stop=\"emit('addToComposer', item)\"><AppIcon name=\"plus\" :size=\"14\" /></button>\n <button v-if=\"item.sourceSessionId\" type=\"button\" title=\"查看来源\" aria-label=\"查看来源\" @click.stop=\"emit('source', item)\"><AppIcon name=\"external\" :size=\"14\" /></button>\n </div>\n </div>\n <div class=\"library-copy\">\n <strong :title=\"item.name\">{{ item.title || item.name }}</strong>\n <span><small>{{ item.sourceLabel || formatSize(item.size) || item.kind }}</small><time>{{ formatDate(item.updatedAt || item.createdAt) }}</time></span>\n </div>\n </article>\n </div>\n <button v-if=\"hasMore\" class=\"load-more\" type=\"button\" :disabled=\"loading\" @click=\"emit('loadMore')\">{{ loading ? '加载中…' : '加载更多' }}</button>\n </div>\n</template>\n\n<style scoped>\n.library-scroll { min-height: 0; flex: 1; overflow-y: auto; padding: 20px clamp(18px, 3vw, 36px) 32px; }\n.library-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 16px 12px; }\narticle { min-width: 0; overflow: hidden; border: 1px solid var(--line); border-radius: 11px; background: var(--surface); cursor: pointer; outline: 0; transition: border-color 140ms ease, box-shadow 140ms ease, transform 140ms ease; } article:focus-visible, article.selected { border-color: var(--line-strong); box-shadow: 0 0 0 2px var(--focus-ring); } article:hover { border-color: var(--line-strong); box-shadow: 0 8px 22px rgba(0,0,0,.07); transform: translateY(-1px); }\n.library-thumb { position: relative; display: grid; height: 154px; place-items: center; overflow: hidden; border: 0; border-bottom: 1px solid var(--line); border-radius: 0; background: var(--surface-soft); color: var(--text-muted); }\n.library-thumb img, .library-thumb video { width: 100%; height: 100%; object-fit: cover; }\n.library-thumb > span { display: flex; flex-direction: column; align-items: center; gap: 7px; }.library-thumb > span em { max-width: 150px; overflow: hidden; color: var(--text-muted); font-size: 11px; font-style: normal; letter-spacing: .02em; text-overflow: ellipsis; text-transform: capitalize; }\n.library-thumb--code, .library-thumb--text { background: linear-gradient(135deg, var(--surface-soft), var(--surface-raised)); }.library-thumb--link { border-style: dashed; }\n.library-thumb__actions { position: absolute; top: 6px; right: 6px; display: flex; gap: 4px; opacity: 0; transform: translateY(-3px); transition: opacity 120ms ease, transform 140ms var(--ease-out); }.library-thumb:hover .library-thumb__actions, article:focus-within .library-thumb__actions { opacity: 1; transform: translateY(0); }.library-thumb__actions button { display: grid; place-items: center; width: 28px; height: 28px; padding: 0; border: 1px solid rgba(255,255,255,.32); border-radius: 8px; background: rgba(25,25,24,.72); color: #fff; cursor: pointer; backdrop-filter: blur(8px); }\n.library-copy { padding: 10px 12px 9px; }.library-copy strong { display: block; overflow: hidden; font-size: 13px; font-weight: 550; text-overflow: ellipsis; white-space: nowrap; }.library-copy > span { display: flex; margin-top: 5px; justify-content: space-between; gap: 8px; color: var(--text-muted); font-size: 11px; line-height: 1.4; }.library-copy small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }.library-copy time { flex: 0 0 auto; }\n.load-more { display: block; margin: 28px auto 0; padding: 7px 12px; border: 1px solid var(--line); border-radius: 9px; background: transparent; color: var(--text-secondary); cursor: pointer; font-size: 10px; }.load-more:hover { background: var(--surface-hover); }\n.library-skeleton { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 16px 12px; }.library-skeleton i { height: 208px; border-radius: 11px; background: linear-gradient(90deg, var(--surface-soft), var(--surface-hover), var(--surface-soft)); background-size: 200% 100%; animation: shimmer 1.5s linear infinite; }\n@keyframes shimmer { to { background-position: -200% 0; } }\n@media (max-width: 600px) { .library-scroll { padding: 16px 12px 30px; }.library-grid, .library-skeleton { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 9px; }.library-thumb { height: 122px; }.library-thumb__actions { opacity: 1; transform: none; }.library-copy { padding: 8px 9px; }.library-copy strong { font-size: 11px; }.library-copy > span { font-size: 9px; } }\n</style>\n","import type { FileKind, FileLibraryPage } from '@shared/types'\nimport { apiRequest, apiUrl, unwrapData } from './client'\nimport { normalizeFile, number, record, values } from '@/utils/normalize'\n\nexport interface FileQuery {\n search?: string\n kind?: FileKind | 'all'\n profile?: string\n conversationOnly?: boolean\n cursor?: string\n limit?: number\n}\n\nexport async function getFiles(query: FileQuery = {}): Promise<FileLibraryPage> {\n const serverKind = query.kind === 'image' || query.kind === 'video' ? query.kind : undefined\n const payload = unwrapData(await apiRequest<unknown>(apiUrl('/api/app/files', {\n search: query.search,\n kind: serverKind,\n profile: query.profile,\n conversationOnly: query.conversationOnly || undefined,\n cursor: query.cursor,\n limit: Math.max(1, Math.min(100, query.limit ?? 50)),\n })))\n const source = record(payload)\n const responseProfile = typeof source.profile === 'string' ? source.profile : query.profile\n return {\n items: values(source.items ?? source.files ?? payload)\n .map(item => normalizeFile(item, responseProfile)).filter(file => file.id),\n nextCursor: typeof source.nextCursor === 'string' ? source.nextCursor : typeof source.next_cursor === 'string' ? source.next_cursor : null,\n total: number(source.total) || undefined,\n }\n}\n\nexport function fileDownloadUrl(id: string, profile?: string): string {\n return apiUrl(`/api/app/files/${encodeURIComponent(id)}/download`, { profile })\n}\n\nexport function filePreviewUrl(id: string, profile?: string): string {\n return apiUrl(`/api/app/files/${encodeURIComponent(id)}/preview`, { profile })\n}\n","import { computed, ref, shallowRef, watch } from 'vue'\nimport { defineStore } from 'pinia'\nimport type { FileKind, FileLibraryItem } from '@shared/types'\nimport { getFiles } from '@/api/files'\nimport { useAuthStore } from './auth'\n\nexport const useFilesStore = defineStore('files', () => {\n const auth = useAuthStore()\n const items = shallowRef<FileLibraryItem[]>([])\n const nextCursor = ref<string>()\n const hasMore = ref(true)\n const isLoading = ref(false)\n const error = ref<string>()\n const query = ref('')\n const kindFilter = ref<FileKind | 'all'>('all')\n const profile = ref<string>()\n const visitedCursors = new Set<string>()\n let loadGeneration = 0\n\n const filteredItems = computed<FileLibraryItem[]>(() => items.value.filter(item => kindFilter.value === 'all' || item.kind === kindFilter.value))\n\n async function load(reset = true): Promise<void> {\n if (isLoading.value && !reset) return\n const generation = ++loadGeneration\n if (reset) {\n items.value = []\n nextCursor.value = undefined\n hasMore.value = true\n visitedCursors.clear()\n } else if (!hasMore.value) return\n isLoading.value = true\n error.value = undefined\n try {\n const existing = new Map(items.value.map(item => [item.id, item]))\n let cursor = reset ? undefined : nextCursor.value\n let pages = 0\n while (pages < 20) {\n const cursorKey = cursor ?? '<first-page>'\n if (visitedCursors.has(cursorKey)) {\n hasMore.value = false\n error.value = '文件分页返回了重复游标,已停止加载'\n break\n }\n visitedCursors.add(cursorKey)\n const page = await getFiles({\n search: query.value.trim() || undefined,\n kind: kindFilter.value,\n profile: profile.value,\n cursor,\n limit: 50,\n })\n if (generation !== loadGeneration) return\n for (const item of page.items) existing.set(item.id, item)\n pages += 1\n cursor = page.nextCursor ?? undefined\n nextCursor.value = cursor\n hasMore.value = Boolean(cursor)\n const matching = [...existing.values()].filter(item => kindFilter.value === 'all' || item.kind === kindFilter.value).length\n if (!cursor || kindFilter.value === 'all' || matching >= 50) break\n }\n items.value = [...existing.values()]\n } catch (cause) {\n if (generation === loadGeneration) error.value = cause instanceof Error ? cause.message : '文件库加载失败'\n } finally {\n if (generation === loadGeneration) isLoading.value = false\n }\n }\n\n const reset = () => load(true)\n watch(() => auth.user?.id, () => {\n loadGeneration += 1\n items.value = []\n profile.value = undefined\n nextCursor.value = undefined\n visitedCursors.clear()\n isLoading.value = false\n error.value = undefined\n }, { flush: 'sync' })\n const loadMore = () => load(false)\n return { items, filteredItems, nextCursor, hasMore, isLoading, error, query, kindFilter, profile, load, reset, loadMore }\n})\n","<script setup lang=\"ts\">\nimport { computed, onBeforeUnmount, onMounted, ref, watch } from 'vue'\nimport { useRouter } from 'vue-router'\nimport type { FileKind } from '@shared/types'\nimport AppIcon from '@/components/common/AppIcon.vue'\nimport LibraryGrid from '@/components/library/LibraryGrid.vue'\nimport PreviewModal from '@/components/library/PreviewModal.vue'\nimport ImagePreviewLightbox from '@/components/library/ImagePreviewLightbox.vue'\nimport type { PreviewMedia } from '@/components/library/ImagePreviewLightbox.vue'\nimport type { LibraryFilterOption, UiLibraryItem } from '@/components/library/types'\nimport ResourceSidebar from '@/components/app/ResourceSidebar.vue'\nimport WorkspaceView from '@/components/workspace/WorkspaceView.vue'\nimport { fileToUi, sessionSidebarItem } from '@/components/workspace/viewModels'\nimport { useFilesStore } from '@/stores/files'\nimport { useAuthStore } from '@/stores/auth'\nimport { useChatStore } from '@/stores/chat'\n\nconst files = useFilesStore()\nconst auth = useAuthStore()\nconst chat = useChatStore()\nconst router = useRouter()\nconst selected = ref<UiLibraryItem | null>(null)\nconst mediaIndex = ref<number | null>(null)\nconst historySearch = ref('')\nlet searchTimer: number | undefined\n\nconst items = computed(() => files.filteredItems.map(fileToUi))\nconst lightboxMedia = computed(() => items.value.filter(item => item.kind === 'image' || item.kind === 'video').map(item => ({ url: item.previewUrl || item.downloadUrl || '', name: item.name, type: item.kind as 'image' | 'video' })).filter(item => item.url))\nconst agentNames = computed(() => new Map(auth.profiles.map(profile => [profile.name, profile.agentName || profile.displayName || profile.name])))\nconst historyItems = computed(() => chat.sessions\n .filter(session => !['cron', 'ios_group'].includes(session.source))\n .filter(session => !historySearch.value.trim() || `${session.title} ${session.preview || ''}`.toLocaleLowerCase().includes(historySearch.value.trim().toLocaleLowerCase()))\n .map(session => sessionSidebarItem(session, chat.unreadCounts[session.id] ?? 0, agentNames.value.get(session.profile || auth.activeProfile?.name || ''))))\nconst options = computed<LibraryFilterOption[]>(() => {\n const count = (kind: string) => files.items.filter(item => item.kind === kind).length\n return [\n { id: 'all', label: '全部', count: files.items.length, icon: 'files' },\n { id: 'image', label: '图片', count: count('image'), icon: 'image' },\n { id: 'video', label: '视频', count: count('video'), icon: 'video' },\n { id: 'audio', label: '音频', count: count('audio'), icon: 'audio' },\n { id: 'document', label: '文档', count: count('document'), icon: 'file' },\n { id: 'other', label: '其他', count: count('other'), icon: 'file' },\n ]\n})\n\nfunction updateSearch(value: string) {\n files.query = value\n window.clearTimeout(searchTimer)\n searchTimer = window.setTimeout(() => void files.load(true), 260)\n}\n\nfunction updateFilter(value: string) {\n files.kindFilter = value as FileKind | 'all'\n void files.load(true)\n}\n\nasync function openSource(item: UiLibraryItem) {\n if (item.sourceWorkspaceConversationId) {\n await router.push(`/conversations/${encodeURIComponent(item.sourceWorkspaceConversationId)}`)\n return\n }\n if (!item.sourceSessionId) return\n if (item.sourceProfile && auth.profiles.some(profile => profile.name === item.sourceProfile)) {\n auth.selectProfile(item.sourceProfile)\n }\n await router.push({\n path: `/chat/${encodeURIComponent(item.sourceSessionId)}`,\n query: {\n ...(item.sourceMessageId ? { message: item.sourceMessageId } : {}),\n ...(item.sourceProfile ? { profile: item.sourceProfile } : {}),\n },\n })\n}\n\nfunction selectFile(item: UiLibraryItem) {\n if (item.kind === 'image' || item.kind === 'video') {\n const index = lightboxMedia.value.findIndex(media => media.url === (item.previewUrl || item.downloadUrl))\n mediaIndex.value = index >= 0 ? index : null\n return\n }\n selected.value = item\n}\n\nasync function selectSession(id: string) {\n const session = chat.sessions.find(item => item.id === id)\n const profile = session?.profile || auth.activeProfile?.name\n await router.push({ path: `/chat/${encodeURIComponent(id)}`, query: profile ? { profile } : {} })\n}\n\nonMounted(() => {\n files.profile = undefined\n void files.load(true)\n void chat.loadSessions(auth.activeProfile?.name)\n void chat.loadUnread(auth.activeProfile?.name)\n})\nonBeforeUnmount(() => window.clearTimeout(searchTimer))\nwatch(() => files.items, () => {\n if (selected.value && !files.items.some(item => item.id === selected.value?.id)) selected.value = null\n})\nwatch(() => auth.activeProfile?.name, profile => {\n selected.value = null\n files.profile = profile\n void files.load(true)\n void chat.loadSessions(profile)\n void chat.loadUnread(profile)\n})\n</script>\n\n<template>\n <WorkspaceView sidebar-title=\"历史记录\" :sidebar-subtitle=\"`${chat.sessions.length} 个会话`\">\n <template #sidebar>\n <ResourceSidebar\n :items=\"historyItems\"\n :active-id=\"chat.activeSessionId\"\n :loading=\"chat.isLoading\"\n :search=\"historySearch\"\n single-line\n search-placeholder=\"搜索会话\"\n empty-title=\"还没有会话\"\n empty-description=\"原生 Hermes 会话会在这里以只读历史显示。\"\n @search=\"historySearch = $event\"\n @select=\"selectSession\"\n />\n </template>\n <section class=\"library-workspace\">\n <header class=\"library-header\">\n <div><h2>文件库</h2><span><AppIcon name=\"files\" :size=\"15\" />{{ items.length }}</span></div>\n <label class=\"file-search\"><AppIcon name=\"search\" :size=\"15\" /><input :value=\"files.query\" type=\"search\" placeholder=\"搜索文件名、路径或会话\" @input=\"updateSearch(($event.target as HTMLInputElement).value)\" /></label>\n </header>\n <nav class=\"file-tabs\" aria-label=\"文件类型筛选\">\n <button v-for=\"option in options\" :key=\"option.id\" type=\"button\" :class=\"{ active: option.id === files.kindFilter }\" @click=\"updateFilter(option.id)\">{{ option.label }}<small v-if=\"option.count !== undefined\">{{ option.count }}</small></button>\n <div class=\"file-tabs__status\"><span v-if=\"files.error\" class=\"error\"><AppIcon name=\"alert\" :size=\"13\" />{{ files.error }}</span><span v-else>{{ files.nextCursor ? '还有更多文件可加载' : items.length ? '已同步到最新' : '' }}</span><button class=\"icon-button\" type=\"button\" aria-label=\"刷新文件库\" title=\"刷新文件库\" :disabled=\"files.isLoading\" @click=\"files.load(true)\"><AppIcon name=\"refresh\" :size=\"15\" /></button></div>\n </nav>\n <LibraryGrid\n :items=\"items\"\n :selected-id=\"selected?.id\"\n :loading=\"files.isLoading\"\n :has-more=\"files.hasMore\"\n empty-title=\"文件库还是空的\"\n empty-description=\"聊天中的图片、文档和附件会出现在这里。\"\n @select=\"selectFile\"\n @load-more=\"files.loadMore\"\n @source=\"openSource\"\n />\n </section>\n </WorkspaceView>\n <PreviewModal v-if=\"selected\" :item=\"selected\" :items=\"items\" :can-add-to-composer=\"false\" @close=\"selected = null\" @source=\"openSource\" />\n <ImagePreviewLightbox v-model=\"mediaIndex\" :images=\"lightboxMedia\" :can-add=\"false\" />\n</template>\n\n<style scoped>\n.library-workspace { display: flex; min-width: 0; min-height: 0; flex: 1; flex-direction: column; }\n.library-header { display: flex; min-height: 58px; align-items: center; justify-content: space-between; gap: 16px; padding: 0 22px; border-bottom: 1px solid var(--line); }.library-header > div { display: flex; align-items: center; gap: 10px; }.library-header h2 { margin: 0; font-size: 15px; letter-spacing: -.02em; }.library-header span { display: flex; align-items: center; gap: 5px; color: var(--text-muted); font-size: 10px; }.file-search { display: flex; width: min(280px, 38vw); min-height: 32px; align-items: center; gap: 7px; padding: 0 9px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); color: var(--text-muted); }.file-search:focus-within { border-color: var(--line-strong); }.file-search input { min-width: 0; flex: 1; border: 0; outline: 0; background: transparent; color: var(--text-primary); font-size: 11px; }\n.file-tabs { display: flex; min-height: 46px; align-items: center; gap: 4px; padding: 0 22px; border-bottom: 1px solid var(--line); overflow-x: auto; }.file-tabs > button { min-height: 28px; padding: 0 10px; border: 0; border-radius: 7px; background: transparent; color: var(--text-muted); cursor: pointer; font-size: 10px; white-space: nowrap; }.file-tabs > button:hover, .file-tabs > button.active { background: var(--surface-soft); color: var(--text-primary); }.file-tabs > button.active { font-weight: 650; }.file-tabs > button small { margin-left: 4px; color: var(--text-muted); font-size: 8px; }.file-tabs__status { display: flex; min-width: 0; align-items: center; gap: 7px; margin-left: auto; color: var(--text-muted); font-size: 9px; white-space: nowrap; }.file-tabs__status > span { overflow: hidden; text-overflow: ellipsis; }.file-tabs__status .error { color: var(--danger); }.file-tabs__status .icon-button { display: grid; width: 28px; height: 28px; flex: 0 0 auto; place-items: center; padding: 0; border: 0; border-radius: 7px; background: transparent; color: var(--text-muted); cursor: pointer; }.file-tabs__status .icon-button:hover { background: var(--surface-soft); color: var(--text-primary); }\n@media (max-width: 600px) { .library-header { min-height: 52px; padding: 0 13px; }.library-header h2 { font-size: 14px; }.file-search { width: min(180px, 52vw); }.file-tabs { padding: 0 13px; }.file-tabs__status { display: none; } }\n</style>\n","<script setup lang=\"ts\">\nimport { computed, onBeforeUnmount, onMounted, ref, watch } from 'vue'\nimport { useRouter } from 'vue-router'\nimport type { FileKind } from '@shared/types'\nimport AppIcon from '@/components/common/AppIcon.vue'\nimport LibraryGrid from '@/components/library/LibraryGrid.vue'\nimport PreviewModal from '@/components/library/PreviewModal.vue'\nimport ImagePreviewLightbox from '@/components/library/ImagePreviewLightbox.vue'\nimport type { PreviewMedia } from '@/components/library/ImagePreviewLightbox.vue'\nimport type { LibraryFilterOption, UiLibraryItem } from '@/components/library/types'\nimport ResourceSidebar from '@/components/app/ResourceSidebar.vue'\nimport WorkspaceView from '@/components/workspace/WorkspaceView.vue'\nimport { fileToUi, sessionSidebarItem } from '@/components/workspace/viewModels'\nimport { useFilesStore } from '@/stores/files'\nimport { useAuthStore } from '@/stores/auth'\nimport { useChatStore } from '@/stores/chat'\n\nconst files = useFilesStore()\nconst auth = useAuthStore()\nconst chat = useChatStore()\nconst router = useRouter()\nconst selected = ref<UiLibraryItem | null>(null)\nconst mediaIndex = ref<number | null>(null)\nconst historySearch = ref('')\nlet searchTimer: number | undefined\n\nconst items = computed(() => files.filteredItems.map(fileToUi))\nconst lightboxMedia = computed(() => items.value.filter(item => item.kind === 'image' || item.kind === 'video').map(item => ({ url: item.previewUrl || item.downloadUrl || '', name: item.name, type: item.kind as 'image' | 'video' })).filter(item => item.url))\nconst agentNames = computed(() => new Map(auth.profiles.map(profile => [profile.name, profile.agentName || profile.displayName || profile.name])))\nconst historyItems = computed(() => chat.sessions\n .filter(session => !['cron', 'ios_group'].includes(session.source))\n .filter(session => !historySearch.value.trim() || `${session.title} ${session.preview || ''}`.toLocaleLowerCase().includes(historySearch.value.trim().toLocaleLowerCase()))\n .map(session => sessionSidebarItem(session, chat.unreadCounts[session.id] ?? 0, agentNames.value.get(session.profile || auth.activeProfile?.name || ''))))\nconst options = computed<LibraryFilterOption[]>(() => {\n const count = (kind: string) => files.items.filter(item => item.kind === kind).length\n return [\n { id: 'all', label: '全部', count: files.items.length, icon: 'files' },\n { id: 'image', label: '图片', count: count('image'), icon: 'image' },\n { id: 'video', label: '视频', count: count('video'), icon: 'video' },\n { id: 'audio', label: '音频', count: count('audio'), icon: 'audio' },\n { id: 'document', label: '文档', count: count('document'), icon: 'file' },\n { id: 'other', label: '其他', count: count('other'), icon: 'file' },\n ]\n})\n\nfunction updateSearch(value: string) {\n files.query = value\n window.clearTimeout(searchTimer)\n searchTimer = window.setTimeout(() => void files.load(true), 260)\n}\n\nfunction updateFilter(value: string) {\n files.kindFilter = value as FileKind | 'all'\n void files.load(true)\n}\n\nasync function openSource(item: UiLibraryItem) {\n if (item.sourceWorkspaceConversationId) {\n await router.push(`/conversations/${encodeURIComponent(item.sourceWorkspaceConversationId)}`)\n return\n }\n if (!item.sourceSessionId) return\n if (item.sourceProfile && auth.profiles.some(profile => profile.name === item.sourceProfile)) {\n auth.selectProfile(item.sourceProfile)\n }\n await router.push({\n path: `/chat/${encodeURIComponent(item.sourceSessionId)}`,\n query: {\n ...(item.sourceMessageId ? { message: item.sourceMessageId } : {}),\n ...(item.sourceProfile ? { profile: item.sourceProfile } : {}),\n },\n })\n}\n\nfunction selectFile(item: UiLibraryItem) {\n if (item.kind === 'image' || item.kind === 'video') {\n const index = lightboxMedia.value.findIndex(media => media.url === (item.previewUrl || item.downloadUrl))\n mediaIndex.value = index >= 0 ? index : null\n return\n }\n selected.value = item\n}\n\nasync function selectSession(id: string) {\n const session = chat.sessions.find(item => item.id === id)\n const profile = session?.profile || auth.activeProfile?.name\n await router.push({ path: `/chat/${encodeURIComponent(id)}`, query: profile ? { profile } : {} })\n}\n\nonMounted(() => {\n files.profile = undefined\n void files.load(true)\n void chat.loadSessions(auth.activeProfile?.name)\n void chat.loadUnread(auth.activeProfile?.name)\n})\nonBeforeUnmount(() => window.clearTimeout(searchTimer))\nwatch(() => files.items, () => {\n if (selected.value && !files.items.some(item => item.id === selected.value?.id)) selected.value = null\n})\nwatch(() => auth.activeProfile?.name, profile => {\n selected.value = null\n files.profile = profile\n void files.load(true)\n void chat.loadSessions(profile)\n void chat.loadUnread(profile)\n})\n</script>\n\n<template>\n <WorkspaceView sidebar-title=\"历史记录\" :sidebar-subtitle=\"`${chat.sessions.length} 个会话`\">\n <template #sidebar>\n <ResourceSidebar\n :items=\"historyItems\"\n :active-id=\"chat.activeSessionId\"\n :loading=\"chat.isLoading\"\n :search=\"historySearch\"\n single-line\n search-placeholder=\"搜索会话\"\n empty-title=\"还没有会话\"\n empty-description=\"原生 Hermes 会话会在这里以只读历史显示。\"\n @search=\"historySearch = $event\"\n @select=\"selectSession\"\n />\n </template>\n <section class=\"library-workspace\">\n <header class=\"library-header\">\n <div><h2>文件库</h2><span><AppIcon name=\"files\" :size=\"15\" />{{ items.length }}</span></div>\n <label class=\"file-search\"><AppIcon name=\"search\" :size=\"15\" /><input :value=\"files.query\" type=\"search\" placeholder=\"搜索文件名、路径或会话\" @input=\"updateSearch(($event.target as HTMLInputElement).value)\" /></label>\n </header>\n <nav class=\"file-tabs\" aria-label=\"文件类型筛选\">\n <button v-for=\"option in options\" :key=\"option.id\" type=\"button\" :class=\"{ active: option.id === files.kindFilter }\" @click=\"updateFilter(option.id)\">{{ option.label }}<small v-if=\"option.count !== undefined\">{{ option.count }}</small></button>\n <div class=\"file-tabs__status\"><span v-if=\"files.error\" class=\"error\"><AppIcon name=\"alert\" :size=\"13\" />{{ files.error }}</span><span v-else>{{ files.nextCursor ? '还有更多文件可加载' : items.length ? '已同步到最新' : '' }}</span><button class=\"icon-button\" type=\"button\" aria-label=\"刷新文件库\" title=\"刷新文件库\" :disabled=\"files.isLoading\" @click=\"files.load(true)\"><AppIcon name=\"refresh\" :size=\"15\" /></button></div>\n </nav>\n <LibraryGrid\n :items=\"items\"\n :selected-id=\"selected?.id\"\n :loading=\"files.isLoading\"\n :has-more=\"files.hasMore\"\n empty-title=\"文件库还是空的\"\n empty-description=\"聊天中的图片、文档和附件会出现在这里。\"\n @select=\"selectFile\"\n @load-more=\"files.loadMore\"\n @source=\"openSource\"\n />\n </section>\n </WorkspaceView>\n <PreviewModal v-if=\"selected\" :item=\"selected\" :items=\"items\" :can-add-to-composer=\"false\" @close=\"selected = null\" @source=\"openSource\" />\n <ImagePreviewLightbox v-model=\"mediaIndex\" :images=\"lightboxMedia\" :can-add=\"false\" />\n</template>\n\n<style scoped>\n.library-workspace { display: flex; min-width: 0; min-height: 0; flex: 1; flex-direction: column; }\n.library-header { display: flex; min-height: 58px; align-items: center; justify-content: space-between; gap: 16px; padding: 0 22px; border-bottom: 1px solid var(--line); }.library-header > div { display: flex; align-items: center; gap: 10px; }.library-header h2 { margin: 0; font-size: 15px; letter-spacing: -.02em; }.library-header span { display: flex; align-items: center; gap: 5px; color: var(--text-muted); font-size: 10px; }.file-search { display: flex; width: min(280px, 38vw); min-height: 32px; align-items: center; gap: 7px; padding: 0 9px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); color: var(--text-muted); }.file-search:focus-within { border-color: var(--line-strong); }.file-search input { min-width: 0; flex: 1; border: 0; outline: 0; background: transparent; color: var(--text-primary); font-size: 11px; }\n.file-tabs { display: flex; min-height: 46px; align-items: center; gap: 4px; padding: 0 22px; border-bottom: 1px solid var(--line); overflow-x: auto; }.file-tabs > button { min-height: 28px; padding: 0 10px; border: 0; border-radius: 7px; background: transparent; color: var(--text-muted); cursor: pointer; font-size: 10px; white-space: nowrap; }.file-tabs > button:hover, .file-tabs > button.active { background: var(--surface-soft); color: var(--text-primary); }.file-tabs > button.active { font-weight: 650; }.file-tabs > button small { margin-left: 4px; color: var(--text-muted); font-size: 8px; }.file-tabs__status { display: flex; min-width: 0; align-items: center; gap: 7px; margin-left: auto; color: var(--text-muted); font-size: 9px; white-space: nowrap; }.file-tabs__status > span { overflow: hidden; text-overflow: ellipsis; }.file-tabs__status .error { color: var(--danger); }.file-tabs__status .icon-button { display: grid; width: 28px; height: 28px; flex: 0 0 auto; place-items: center; padding: 0; border: 0; border-radius: 7px; background: transparent; color: var(--text-muted); cursor: pointer; }.file-tabs__status .icon-button:hover { background: var(--surface-soft); color: var(--text-primary); }\n@media (max-width: 600px) { .library-header { min-height: 52px; padding: 0 13px; }.library-header h2 { font-size: 14px; }.file-search { width: min(180px, 52vw); }.file-tabs { padding: 0 13px; }.file-tabs__status { display: none; } }\n</style>\n"],"mappings":"8kCAiBA,IAAM,EAAO,EAOb,SAAS,EAAQ,EAAqB,CAEpC,OADI,EAAK,OAAS,YAAc,EAAK,OAAS,OAAS,EAAK,OAAS,QAAU,EAAK,OAAS,OAAe,OACrG,EAAK,IACd,CAEA,SAAS,EAAU,EAAq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CAAQ,EAAA,CAAA,EAAqC,EAAA,CAA5B,KAAK,UAAW,KAAM,gBAE1X,EAUE,GAAA,CATC,MAAO,EAAA,MACP,cAAa,EAAA,OAAU,GACvB,QAAS,EAAA,CAAA,CAAK,CAAC,UACf,WAAU,EAAA,CAAA,CAAK,CAAC,QACjB,cAAY,UACZ,oBAAkB,sBACjB,SAAQ,EACR,WAAW,EAAA,CAAA,CAAK,CAAC,SACjB,SAAQ,sGAIK,EAAA,OAApB,EAAA,EAAA,EAA2I,EAAA,OAA5G,KAAM,EAAA,MAAW,MAAO,EAAA,MAAQ,sBAAqB,GAAQ,QAAK,AAAA,EAAA,KAAA,GAAE,EAAA,MAAQ,KAAU,SAAQ,sCAC7H,EAAsF,EAAA,CAAvD,WAAA,EAAA,MAAA,sBAAA,AAAA,EAAA,KAAA,GAAA,EAAU,MAAA,EAAG,OAAQ,EAAA,MAAgB,UAAS"}
|
|
1
|
+
{"version":3,"file":"FilesView-D7tA6Nu1.js","names":[],"sources":["../../src/client/components/library/LibraryGrid.vue","../../src/client/components/library/LibraryGrid.vue","../../src/client/api/files.ts","../../src/client/stores/files.ts","../../src/client/views/FilesView.vue","../../src/client/views/FilesView.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport AppIcon from '@/components/common/AppIcon.vue'\nimport EmptyState from '@/components/common/EmptyState.vue'\nimport type { UiLibraryItem } from './types'\n\nwithDefaults(defineProps<{\n items: UiLibraryItem[]\n selectedId?: string\n loading?: boolean\n hasMore?: boolean\n emptyTitle?: string\n emptyDescription?: string\n kind?: 'files' | 'artifacts'\n}>(), {\n selectedId: '', loading: false, hasMore: false, emptyTitle: '暂无文件', emptyDescription: '这里会显示来自 Hermes 的文件。', kind: 'files',\n})\n\nconst emit = defineEmits<{\n select: [item: UiLibraryItem]\n loadMore: []\n addToComposer: [item: UiLibraryItem]\n source: [item: UiLibraryItem]\n}>()\n\nfunction iconFor(item: UiLibraryItem) {\n if (item.kind === 'document' || item.kind === 'pdf' || item.kind === 'code' || item.kind === 'text') return 'file'\n return item.kind\n}\n\nfunction kindLabel(item: UiLibraryItem) {\n return ({ image: '图片', video: '视频', audio: '音频', pdf: '文档', document: '文档', code: '文档', text: '文档', link: '网页', file: '其他' } as const)[item.kind]\n}\n\nfunction formatSize(size?: number) {\n if (size === undefined) return ''\n if (size < 1024) return `${size} B`\n if (size < 1024 * 1024) return `${(size / 1024).toFixed(1)} KB`\n return `${(size / 1024 / 1024).toFixed(1)} MB`\n}\n\nfunction formatDate(value?: string | number | Date) {\n if (!value) return ''\n const date = value instanceof Date ? value : new Date(value)\n if (Number.isNaN(date.getTime())) return ''\n return new Intl.DateTimeFormat('zh-CN', { month: 'short', day: 'numeric' }).format(date)\n}\n</script>\n\n<template>\n <div class=\"library-scroll\">\n <div v-if=\"loading && !items.length\" class=\"library-skeleton\">\n <i v-for=\"n in 10\" :key=\"n\" :style=\"{ opacity: .95 - n * .04 }\" />\n </div>\n <EmptyState v-else-if=\"!items.length\" :icon=\"kind === 'files' ? 'files' : 'artifacts'\" :title=\"emptyTitle\" :description=\"emptyDescription\" />\n <div v-else class=\"library-grid\">\n <article\n v-for=\"item in items\"\n :key=\"item.id\"\n :class=\"{ selected: item.id === selectedId }\"\n tabindex=\"0\"\n @click=\"emit('select', item)\"\n @keydown.enter=\"emit('select', item)\"\n >\n <div class=\"library-thumb\" :class=\"`library-thumb--${item.kind}`\">\n <img v-if=\"item.kind === 'image' && item.previewUrl\" :src=\"item.previewUrl\" :alt=\"item.name\" loading=\"lazy\" />\n <video v-else-if=\"item.kind === 'video' && item.previewUrl\" :src=\"item.previewUrl\" muted preload=\"metadata\" />\n <span v-else><AppIcon :name=\"iconFor(item)\" :size=\"36\" /><em>{{ item.name.split('.').at(-1)?.slice(0, 5).toUpperCase() }} · {{ kindLabel(item) }}</em></span>\n <div class=\"library-thumb__actions\">\n <button type=\"button\" title=\"加入输入框\" aria-label=\"加入输入框\" @click.stop=\"emit('addToComposer', item)\"><AppIcon name=\"plus\" :size=\"14\" /></button>\n <button v-if=\"item.sourceSessionId\" type=\"button\" title=\"查看来源\" aria-label=\"查看来源\" @click.stop=\"emit('source', item)\"><AppIcon name=\"external\" :size=\"14\" /></button>\n </div>\n </div>\n <div class=\"library-copy\">\n <strong :title=\"item.name\">{{ item.title || item.name }}</strong>\n <span><small>{{ item.sourceLabel || formatSize(item.size) || item.kind }}</small><time>{{ formatDate(item.updatedAt || item.createdAt) }}</time></span>\n </div>\n </article>\n </div>\n <button v-if=\"hasMore\" class=\"load-more\" type=\"button\" :disabled=\"loading\" @click=\"emit('loadMore')\">{{ loading ? '加载中…' : '加载更多' }}</button>\n </div>\n</template>\n\n<style scoped>\n.library-scroll { min-height: 0; flex: 1; overflow-y: auto; padding: 20px clamp(18px, 3vw, 36px) 32px; }\n.library-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 16px 12px; }\narticle { min-width: 0; overflow: hidden; border: 1px solid var(--line); border-radius: 11px; background: var(--surface); cursor: pointer; outline: 0; transition: border-color 140ms ease, box-shadow 140ms ease, transform 140ms ease; } article:focus-visible, article.selected { border-color: var(--line-strong); box-shadow: 0 0 0 2px var(--focus-ring); } article:hover { border-color: var(--line-strong); box-shadow: 0 8px 22px rgba(0,0,0,.07); transform: translateY(-1px); }\n.library-thumb { position: relative; display: grid; height: 154px; place-items: center; overflow: hidden; border: 0; border-bottom: 1px solid var(--line); border-radius: 0; background: var(--surface-soft); color: var(--text-muted); }\n.library-thumb img, .library-thumb video { width: 100%; height: 100%; object-fit: cover; }\n.library-thumb > span { display: flex; flex-direction: column; align-items: center; gap: 7px; }.library-thumb > span em { max-width: 150px; overflow: hidden; color: var(--text-muted); font-size: 11px; font-style: normal; letter-spacing: .02em; text-overflow: ellipsis; text-transform: capitalize; }\n.library-thumb--code, .library-thumb--text { background: linear-gradient(135deg, var(--surface-soft), var(--surface-raised)); }.library-thumb--link { border-style: dashed; }\n.library-thumb__actions { position: absolute; top: 6px; right: 6px; display: flex; gap: 4px; opacity: 0; transform: translateY(-3px); transition: opacity 120ms ease, transform 140ms var(--ease-out); }.library-thumb:hover .library-thumb__actions, article:focus-within .library-thumb__actions { opacity: 1; transform: translateY(0); }.library-thumb__actions button { display: grid; place-items: center; width: 28px; height: 28px; padding: 0; border: 1px solid rgba(255,255,255,.32); border-radius: 8px; background: rgba(25,25,24,.72); color: #fff; cursor: pointer; backdrop-filter: blur(8px); }\n.library-copy { padding: 10px 12px 9px; }.library-copy strong { display: block; overflow: hidden; font-size: 13px; font-weight: 550; text-overflow: ellipsis; white-space: nowrap; }.library-copy > span { display: flex; margin-top: 5px; justify-content: space-between; gap: 8px; color: var(--text-muted); font-size: 11px; line-height: 1.4; }.library-copy small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }.library-copy time { flex: 0 0 auto; }\n.load-more { display: block; margin: 28px auto 0; padding: 7px 12px; border: 1px solid var(--line); border-radius: 9px; background: transparent; color: var(--text-secondary); cursor: pointer; font-size: 10px; }.load-more:hover { background: var(--surface-hover); }\n.library-skeleton { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 16px 12px; }.library-skeleton i { height: 208px; border-radius: 11px; background: linear-gradient(90deg, var(--surface-soft), var(--surface-hover), var(--surface-soft)); background-size: 200% 100%; animation: shimmer 1.5s linear infinite; }\n@keyframes shimmer { to { background-position: -200% 0; } }\n@media (max-width: 600px) { .library-scroll { padding: 16px 12px 30px; }.library-grid, .library-skeleton { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 9px; }.library-thumb { height: 122px; }.library-thumb__actions { opacity: 1; transform: none; }.library-copy { padding: 8px 9px; }.library-copy strong { font-size: 11px; }.library-copy > span { font-size: 9px; } }\n</style>\n","<script setup lang=\"ts\">\nimport AppIcon from '@/components/common/AppIcon.vue'\nimport EmptyState from '@/components/common/EmptyState.vue'\nimport type { UiLibraryItem } from './types'\n\nwithDefaults(defineProps<{\n items: UiLibraryItem[]\n selectedId?: string\n loading?: boolean\n hasMore?: boolean\n emptyTitle?: string\n emptyDescription?: string\n kind?: 'files' | 'artifacts'\n}>(), {\n selectedId: '', loading: false, hasMore: false, emptyTitle: '暂无文件', emptyDescription: '这里会显示来自 Hermes 的文件。', kind: 'files',\n})\n\nconst emit = defineEmits<{\n select: [item: UiLibraryItem]\n loadMore: []\n addToComposer: [item: UiLibraryItem]\n source: [item: UiLibraryItem]\n}>()\n\nfunction iconFor(item: UiLibraryItem) {\n if (item.kind === 'document' || item.kind === 'pdf' || item.kind === 'code' || item.kind === 'text') return 'file'\n return item.kind\n}\n\nfunction kindLabel(item: UiLibraryItem) {\n return ({ image: '图片', video: '视频', audio: '音频', pdf: '文档', document: '文档', code: '文档', text: '文档', link: '网页', file: '其他' } as const)[item.kind]\n}\n\nfunction formatSize(size?: number) {\n if (size === undefined) return ''\n if (size < 1024) return `${size} B`\n if (size < 1024 * 1024) return `${(size / 1024).toFixed(1)} KB`\n return `${(size / 1024 / 1024).toFixed(1)} MB`\n}\n\nfunction formatDate(value?: string | number | Date) {\n if (!value) return ''\n const date = value instanceof Date ? value : new Date(value)\n if (Number.isNaN(date.getTime())) return ''\n return new Intl.DateTimeFormat('zh-CN', { month: 'short', day: 'numeric' }).format(date)\n}\n</script>\n\n<template>\n <div class=\"library-scroll\">\n <div v-if=\"loading && !items.length\" class=\"library-skeleton\">\n <i v-for=\"n in 10\" :key=\"n\" :style=\"{ opacity: .95 - n * .04 }\" />\n </div>\n <EmptyState v-else-if=\"!items.length\" :icon=\"kind === 'files' ? 'files' : 'artifacts'\" :title=\"emptyTitle\" :description=\"emptyDescription\" />\n <div v-else class=\"library-grid\">\n <article\n v-for=\"item in items\"\n :key=\"item.id\"\n :class=\"{ selected: item.id === selectedId }\"\n tabindex=\"0\"\n @click=\"emit('select', item)\"\n @keydown.enter=\"emit('select', item)\"\n >\n <div class=\"library-thumb\" :class=\"`library-thumb--${item.kind}`\">\n <img v-if=\"item.kind === 'image' && item.previewUrl\" :src=\"item.previewUrl\" :alt=\"item.name\" loading=\"lazy\" />\n <video v-else-if=\"item.kind === 'video' && item.previewUrl\" :src=\"item.previewUrl\" muted preload=\"metadata\" />\n <span v-else><AppIcon :name=\"iconFor(item)\" :size=\"36\" /><em>{{ item.name.split('.').at(-1)?.slice(0, 5).toUpperCase() }} · {{ kindLabel(item) }}</em></span>\n <div class=\"library-thumb__actions\">\n <button type=\"button\" title=\"加入输入框\" aria-label=\"加入输入框\" @click.stop=\"emit('addToComposer', item)\"><AppIcon name=\"plus\" :size=\"14\" /></button>\n <button v-if=\"item.sourceSessionId\" type=\"button\" title=\"查看来源\" aria-label=\"查看来源\" @click.stop=\"emit('source', item)\"><AppIcon name=\"external\" :size=\"14\" /></button>\n </div>\n </div>\n <div class=\"library-copy\">\n <strong :title=\"item.name\">{{ item.title || item.name }}</strong>\n <span><small>{{ item.sourceLabel || formatSize(item.size) || item.kind }}</small><time>{{ formatDate(item.updatedAt || item.createdAt) }}</time></span>\n </div>\n </article>\n </div>\n <button v-if=\"hasMore\" class=\"load-more\" type=\"button\" :disabled=\"loading\" @click=\"emit('loadMore')\">{{ loading ? '加载中…' : '加载更多' }}</button>\n </div>\n</template>\n\n<style scoped>\n.library-scroll { min-height: 0; flex: 1; overflow-y: auto; padding: 20px clamp(18px, 3vw, 36px) 32px; }\n.library-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 16px 12px; }\narticle { min-width: 0; overflow: hidden; border: 1px solid var(--line); border-radius: 11px; background: var(--surface); cursor: pointer; outline: 0; transition: border-color 140ms ease, box-shadow 140ms ease, transform 140ms ease; } article:focus-visible, article.selected { border-color: var(--line-strong); box-shadow: 0 0 0 2px var(--focus-ring); } article:hover { border-color: var(--line-strong); box-shadow: 0 8px 22px rgba(0,0,0,.07); transform: translateY(-1px); }\n.library-thumb { position: relative; display: grid; height: 154px; place-items: center; overflow: hidden; border: 0; border-bottom: 1px solid var(--line); border-radius: 0; background: var(--surface-soft); color: var(--text-muted); }\n.library-thumb img, .library-thumb video { width: 100%; height: 100%; object-fit: cover; }\n.library-thumb > span { display: flex; flex-direction: column; align-items: center; gap: 7px; }.library-thumb > span em { max-width: 150px; overflow: hidden; color: var(--text-muted); font-size: 11px; font-style: normal; letter-spacing: .02em; text-overflow: ellipsis; text-transform: capitalize; }\n.library-thumb--code, .library-thumb--text { background: linear-gradient(135deg, var(--surface-soft), var(--surface-raised)); }.library-thumb--link { border-style: dashed; }\n.library-thumb__actions { position: absolute; top: 6px; right: 6px; display: flex; gap: 4px; opacity: 0; transform: translateY(-3px); transition: opacity 120ms ease, transform 140ms var(--ease-out); }.library-thumb:hover .library-thumb__actions, article:focus-within .library-thumb__actions { opacity: 1; transform: translateY(0); }.library-thumb__actions button { display: grid; place-items: center; width: 28px; height: 28px; padding: 0; border: 1px solid rgba(255,255,255,.32); border-radius: 8px; background: rgba(25,25,24,.72); color: #fff; cursor: pointer; backdrop-filter: blur(8px); }\n.library-copy { padding: 10px 12px 9px; }.library-copy strong { display: block; overflow: hidden; font-size: 13px; font-weight: 550; text-overflow: ellipsis; white-space: nowrap; }.library-copy > span { display: flex; margin-top: 5px; justify-content: space-between; gap: 8px; color: var(--text-muted); font-size: 11px; line-height: 1.4; }.library-copy small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }.library-copy time { flex: 0 0 auto; }\n.load-more { display: block; margin: 28px auto 0; padding: 7px 12px; border: 1px solid var(--line); border-radius: 9px; background: transparent; color: var(--text-secondary); cursor: pointer; font-size: 10px; }.load-more:hover { background: var(--surface-hover); }\n.library-skeleton { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 16px 12px; }.library-skeleton i { height: 208px; border-radius: 11px; background: linear-gradient(90deg, var(--surface-soft), var(--surface-hover), var(--surface-soft)); background-size: 200% 100%; animation: shimmer 1.5s linear infinite; }\n@keyframes shimmer { to { background-position: -200% 0; } }\n@media (max-width: 600px) { .library-scroll { padding: 16px 12px 30px; }.library-grid, .library-skeleton { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 9px; }.library-thumb { height: 122px; }.library-thumb__actions { opacity: 1; transform: none; }.library-copy { padding: 8px 9px; }.library-copy strong { font-size: 11px; }.library-copy > span { font-size: 9px; } }\n</style>\n","import type { FileKind, FileLibraryPage } from '@shared/types'\nimport { apiRequest, apiUrl, unwrapData } from './client'\nimport { normalizeFile, number, record, values } from '@/utils/normalize'\n\nexport interface FileQuery {\n search?: string\n kind?: FileKind | 'all'\n profile?: string\n conversationOnly?: boolean\n cursor?: string\n limit?: number\n}\n\nexport async function getFiles(query: FileQuery = {}): Promise<FileLibraryPage> {\n const serverKind = query.kind === 'image' || query.kind === 'video' ? query.kind : undefined\n const payload = unwrapData(await apiRequest<unknown>(apiUrl('/api/app/files', {\n search: query.search,\n kind: serverKind,\n profile: query.profile,\n conversationOnly: query.conversationOnly || undefined,\n cursor: query.cursor,\n limit: Math.max(1, Math.min(100, query.limit ?? 50)),\n })))\n const source = record(payload)\n const responseProfile = typeof source.profile === 'string' ? source.profile : query.profile\n return {\n items: values(source.items ?? source.files ?? payload)\n .map(item => normalizeFile(item, responseProfile)).filter(file => file.id),\n nextCursor: typeof source.nextCursor === 'string' ? source.nextCursor : typeof source.next_cursor === 'string' ? source.next_cursor : null,\n total: number(source.total) || undefined,\n }\n}\n\nexport function fileDownloadUrl(id: string, profile?: string): string {\n return apiUrl(`/api/app/files/${encodeURIComponent(id)}/download`, { profile })\n}\n\nexport function filePreviewUrl(id: string, profile?: string): string {\n return apiUrl(`/api/app/files/${encodeURIComponent(id)}/preview`, { profile })\n}\n","import { computed, ref, shallowRef, watch } from 'vue'\nimport { defineStore } from 'pinia'\nimport type { FileKind, FileLibraryItem } from '@shared/types'\nimport { getFiles } from '@/api/files'\nimport { useAuthStore } from './auth'\n\nexport const useFilesStore = defineStore('files', () => {\n const auth = useAuthStore()\n const items = shallowRef<FileLibraryItem[]>([])\n const nextCursor = ref<string>()\n const hasMore = ref(true)\n const isLoading = ref(false)\n const error = ref<string>()\n const query = ref('')\n const kindFilter = ref<FileKind | 'all'>('all')\n const profile = ref<string>()\n const visitedCursors = new Set<string>()\n let loadGeneration = 0\n\n const filteredItems = computed<FileLibraryItem[]>(() => items.value.filter(item => kindFilter.value === 'all' || item.kind === kindFilter.value))\n\n async function load(reset = true): Promise<void> {\n if (isLoading.value && !reset) return\n const generation = ++loadGeneration\n if (reset) {\n items.value = []\n nextCursor.value = undefined\n hasMore.value = true\n visitedCursors.clear()\n } else if (!hasMore.value) return\n isLoading.value = true\n error.value = undefined\n try {\n const existing = new Map(items.value.map(item => [item.id, item]))\n let cursor = reset ? undefined : nextCursor.value\n let pages = 0\n while (pages < 20) {\n const cursorKey = cursor ?? '<first-page>'\n if (visitedCursors.has(cursorKey)) {\n hasMore.value = false\n error.value = '文件分页返回了重复游标,已停止加载'\n break\n }\n visitedCursors.add(cursorKey)\n const page = await getFiles({\n search: query.value.trim() || undefined,\n kind: kindFilter.value,\n profile: profile.value,\n cursor,\n limit: 50,\n })\n if (generation !== loadGeneration) return\n for (const item of page.items) existing.set(item.id, item)\n pages += 1\n cursor = page.nextCursor ?? undefined\n nextCursor.value = cursor\n hasMore.value = Boolean(cursor)\n const matching = [...existing.values()].filter(item => kindFilter.value === 'all' || item.kind === kindFilter.value).length\n if (!cursor || kindFilter.value === 'all' || matching >= 50) break\n }\n items.value = [...existing.values()]\n } catch (cause) {\n if (generation === loadGeneration) error.value = cause instanceof Error ? cause.message : '文件库加载失败'\n } finally {\n if (generation === loadGeneration) isLoading.value = false\n }\n }\n\n const reset = () => load(true)\n watch(() => auth.user?.id, () => {\n loadGeneration += 1\n items.value = []\n profile.value = undefined\n nextCursor.value = undefined\n visitedCursors.clear()\n isLoading.value = false\n error.value = undefined\n }, { flush: 'sync' })\n const loadMore = () => load(false)\n return { items, filteredItems, nextCursor, hasMore, isLoading, error, query, kindFilter, profile, load, reset, loadMore }\n})\n","<script setup lang=\"ts\">\nimport { computed, onBeforeUnmount, onMounted, ref, watch } from 'vue'\nimport { useRouter } from 'vue-router'\nimport type { FileKind } from '@shared/types'\nimport AppIcon from '@/components/common/AppIcon.vue'\nimport LibraryGrid from '@/components/library/LibraryGrid.vue'\nimport PreviewModal from '@/components/library/PreviewModal.vue'\nimport ImagePreviewLightbox from '@/components/library/ImagePreviewLightbox.vue'\nimport type { PreviewMedia } from '@/components/library/ImagePreviewLightbox.vue'\nimport type { LibraryFilterOption, UiLibraryItem } from '@/components/library/types'\nimport ResourceSidebar from '@/components/app/ResourceSidebar.vue'\nimport WorkspaceView from '@/components/workspace/WorkspaceView.vue'\nimport { fileToUi, sessionSidebarItem } from '@/components/workspace/viewModels'\nimport { useFilesStore } from '@/stores/files'\nimport { useAuthStore } from '@/stores/auth'\nimport { useChatStore } from '@/stores/chat'\n\nconst files = useFilesStore()\nconst auth = useAuthStore()\nconst chat = useChatStore()\nconst router = useRouter()\nconst selected = ref<UiLibraryItem | null>(null)\nconst mediaIndex = ref<number | null>(null)\nconst historySearch = ref('')\nlet searchTimer: number | undefined\n\nconst items = computed(() => files.filteredItems.map(fileToUi))\nconst lightboxMedia = computed(() => items.value.filter(item => item.kind === 'image' || item.kind === 'video').map(item => ({ url: item.previewUrl || item.downloadUrl || '', name: item.name, type: item.kind as 'image' | 'video' })).filter(item => item.url))\nconst agentNames = computed(() => new Map(auth.profiles.map(profile => [profile.name, profile.agentName || profile.displayName || profile.name])))\nconst historyItems = computed(() => chat.sessions\n .filter(session => !['cron', 'ios_group'].includes(session.source))\n .filter(session => !historySearch.value.trim() || `${session.title} ${session.preview || ''}`.toLocaleLowerCase().includes(historySearch.value.trim().toLocaleLowerCase()))\n .map(session => sessionSidebarItem(session, chat.unreadCounts[session.id] ?? 0, agentNames.value.get(session.profile || auth.activeProfile?.name || ''))))\nconst options = computed<LibraryFilterOption[]>(() => {\n const count = (kind: string) => files.items.filter(item => item.kind === kind).length\n return [\n { id: 'all', label: '全部', count: files.items.length, icon: 'files' },\n { id: 'image', label: '图片', count: count('image'), icon: 'image' },\n { id: 'video', label: '视频', count: count('video'), icon: 'video' },\n { id: 'audio', label: '音频', count: count('audio'), icon: 'audio' },\n { id: 'document', label: '文档', count: count('document'), icon: 'file' },\n { id: 'other', label: '其他', count: count('other'), icon: 'file' },\n ]\n})\n\nfunction updateSearch(value: string) {\n files.query = value\n window.clearTimeout(searchTimer)\n searchTimer = window.setTimeout(() => void files.load(true), 260)\n}\n\nfunction updateFilter(value: string) {\n files.kindFilter = value as FileKind | 'all'\n void files.load(true)\n}\n\nasync function openSource(item: UiLibraryItem) {\n if (item.sourceWorkspaceConversationId) {\n await router.push(`/conversations/${encodeURIComponent(item.sourceWorkspaceConversationId)}`)\n return\n }\n if (!item.sourceSessionId) return\n if (item.sourceProfile && auth.profiles.some(profile => profile.name === item.sourceProfile)) {\n auth.selectProfile(item.sourceProfile)\n }\n await router.push({\n path: `/chat/${encodeURIComponent(item.sourceSessionId)}`,\n query: {\n ...(item.sourceMessageId ? { message: item.sourceMessageId } : {}),\n ...(item.sourceProfile ? { profile: item.sourceProfile } : {}),\n },\n })\n}\n\nfunction selectFile(item: UiLibraryItem) {\n if (item.kind === 'image' || item.kind === 'video') {\n const index = lightboxMedia.value.findIndex(media => media.url === (item.previewUrl || item.downloadUrl))\n mediaIndex.value = index >= 0 ? index : null\n return\n }\n selected.value = item\n}\n\nasync function selectSession(id: string) {\n const session = chat.sessions.find(item => item.id === id)\n const profile = session?.profile || auth.activeProfile?.name\n await router.push({ path: `/chat/${encodeURIComponent(id)}`, query: profile ? { profile } : {} })\n}\n\nonMounted(() => {\n files.profile = undefined\n void files.load(true)\n void chat.loadSessions(auth.activeProfile?.name)\n void chat.loadUnread(auth.activeProfile?.name)\n})\nonBeforeUnmount(() => window.clearTimeout(searchTimer))\nwatch(() => files.items, () => {\n if (selected.value && !files.items.some(item => item.id === selected.value?.id)) selected.value = null\n})\nwatch(() => auth.activeProfile?.name, profile => {\n selected.value = null\n files.profile = profile\n void files.load(true)\n void chat.loadSessions(profile)\n void chat.loadUnread(profile)\n})\n</script>\n\n<template>\n <WorkspaceView sidebar-title=\"历史记录\" :sidebar-subtitle=\"`${chat.sessions.length} 个会话`\">\n <template #sidebar>\n <ResourceSidebar\n :items=\"historyItems\"\n :active-id=\"chat.activeSessionId\"\n :loading=\"chat.isLoading\"\n :search=\"historySearch\"\n single-line\n search-placeholder=\"搜索会话\"\n empty-title=\"还没有会话\"\n empty-description=\"原生 Hermes 会话会在这里以只读历史显示。\"\n @search=\"historySearch = $event\"\n @select=\"selectSession\"\n />\n </template>\n <section class=\"library-workspace\">\n <header class=\"library-header\">\n <div><h2>文件库</h2><span><AppIcon name=\"files\" :size=\"15\" />{{ items.length }}</span></div>\n <label class=\"file-search\"><AppIcon name=\"search\" :size=\"15\" /><input :value=\"files.query\" type=\"search\" placeholder=\"搜索文件名、路径或会话\" @input=\"updateSearch(($event.target as HTMLInputElement).value)\" /></label>\n </header>\n <nav class=\"file-tabs\" aria-label=\"文件类型筛选\">\n <button v-for=\"option in options\" :key=\"option.id\" type=\"button\" :class=\"{ active: option.id === files.kindFilter }\" @click=\"updateFilter(option.id)\">{{ option.label }}<small v-if=\"option.count !== undefined\">{{ option.count }}</small></button>\n <div class=\"file-tabs__status\"><span v-if=\"files.error\" class=\"error\"><AppIcon name=\"alert\" :size=\"13\" />{{ files.error }}</span><span v-else>{{ files.nextCursor ? '还有更多文件可加载' : items.length ? '已同步到最新' : '' }}</span><button class=\"icon-button\" type=\"button\" aria-label=\"刷新文件库\" title=\"刷新文件库\" :disabled=\"files.isLoading\" @click=\"files.load(true)\"><AppIcon name=\"refresh\" :size=\"15\" /></button></div>\n </nav>\n <LibraryGrid\n :items=\"items\"\n :selected-id=\"selected?.id\"\n :loading=\"files.isLoading\"\n :has-more=\"files.hasMore\"\n empty-title=\"文件库还是空的\"\n empty-description=\"聊天中的图片、文档和附件会出现在这里。\"\n @select=\"selectFile\"\n @load-more=\"files.loadMore\"\n @source=\"openSource\"\n />\n </section>\n </WorkspaceView>\n <PreviewModal v-if=\"selected\" :item=\"selected\" :items=\"items\" :can-add-to-composer=\"false\" @close=\"selected = null\" @source=\"openSource\" />\n <ImagePreviewLightbox v-model=\"mediaIndex\" :images=\"lightboxMedia\" :can-add=\"false\" />\n</template>\n\n<style scoped>\n.library-workspace { display: flex; min-width: 0; min-height: 0; flex: 1; flex-direction: column; }\n.library-header { display: flex; min-height: 58px; align-items: center; justify-content: space-between; gap: 16px; padding: 0 22px; border-bottom: 1px solid var(--line); }.library-header > div { display: flex; align-items: center; gap: 10px; }.library-header h2 { margin: 0; font-size: 15px; letter-spacing: -.02em; }.library-header span { display: flex; align-items: center; gap: 5px; color: var(--text-muted); font-size: 10px; }.file-search { display: flex; width: min(280px, 38vw); min-height: 32px; align-items: center; gap: 7px; padding: 0 9px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); color: var(--text-muted); }.file-search:focus-within { border-color: var(--line-strong); }.file-search input { min-width: 0; flex: 1; border: 0; outline: 0; background: transparent; color: var(--text-primary); font-size: 11px; }\n.file-tabs { display: flex; min-height: 46px; align-items: center; gap: 4px; padding: 0 22px; border-bottom: 1px solid var(--line); overflow-x: auto; }.file-tabs > button { min-height: 28px; padding: 0 10px; border: 0; border-radius: 7px; background: transparent; color: var(--text-muted); cursor: pointer; font-size: 10px; white-space: nowrap; }.file-tabs > button:hover, .file-tabs > button.active { background: var(--surface-soft); color: var(--text-primary); }.file-tabs > button.active { font-weight: 650; }.file-tabs > button small { margin-left: 4px; color: var(--text-muted); font-size: 8px; }.file-tabs__status { display: flex; min-width: 0; align-items: center; gap: 7px; margin-left: auto; color: var(--text-muted); font-size: 9px; white-space: nowrap; }.file-tabs__status > span { overflow: hidden; text-overflow: ellipsis; }.file-tabs__status .error { color: var(--danger); }.file-tabs__status .icon-button { display: grid; width: 28px; height: 28px; flex: 0 0 auto; place-items: center; padding: 0; border: 0; border-radius: 7px; background: transparent; color: var(--text-muted); cursor: pointer; }.file-tabs__status .icon-button:hover { background: var(--surface-soft); color: var(--text-primary); }\n@media (max-width: 600px) { .library-header { min-height: 52px; padding: 0 13px; }.library-header h2 { font-size: 14px; }.file-search { width: min(180px, 52vw); }.file-tabs { padding: 0 13px; }.file-tabs__status { display: none; } }\n</style>\n","<script setup lang=\"ts\">\nimport { computed, onBeforeUnmount, onMounted, ref, watch } from 'vue'\nimport { useRouter } from 'vue-router'\nimport type { FileKind } from '@shared/types'\nimport AppIcon from '@/components/common/AppIcon.vue'\nimport LibraryGrid from '@/components/library/LibraryGrid.vue'\nimport PreviewModal from '@/components/library/PreviewModal.vue'\nimport ImagePreviewLightbox from '@/components/library/ImagePreviewLightbox.vue'\nimport type { PreviewMedia } from '@/components/library/ImagePreviewLightbox.vue'\nimport type { LibraryFilterOption, UiLibraryItem } from '@/components/library/types'\nimport ResourceSidebar from '@/components/app/ResourceSidebar.vue'\nimport WorkspaceView from '@/components/workspace/WorkspaceView.vue'\nimport { fileToUi, sessionSidebarItem } from '@/components/workspace/viewModels'\nimport { useFilesStore } from '@/stores/files'\nimport { useAuthStore } from '@/stores/auth'\nimport { useChatStore } from '@/stores/chat'\n\nconst files = useFilesStore()\nconst auth = useAuthStore()\nconst chat = useChatStore()\nconst router = useRouter()\nconst selected = ref<UiLibraryItem | null>(null)\nconst mediaIndex = ref<number | null>(null)\nconst historySearch = ref('')\nlet searchTimer: number | undefined\n\nconst items = computed(() => files.filteredItems.map(fileToUi))\nconst lightboxMedia = computed(() => items.value.filter(item => item.kind === 'image' || item.kind === 'video').map(item => ({ url: item.previewUrl || item.downloadUrl || '', name: item.name, type: item.kind as 'image' | 'video' })).filter(item => item.url))\nconst agentNames = computed(() => new Map(auth.profiles.map(profile => [profile.name, profile.agentName || profile.displayName || profile.name])))\nconst historyItems = computed(() => chat.sessions\n .filter(session => !['cron', 'ios_group'].includes(session.source))\n .filter(session => !historySearch.value.trim() || `${session.title} ${session.preview || ''}`.toLocaleLowerCase().includes(historySearch.value.trim().toLocaleLowerCase()))\n .map(session => sessionSidebarItem(session, chat.unreadCounts[session.id] ?? 0, agentNames.value.get(session.profile || auth.activeProfile?.name || ''))))\nconst options = computed<LibraryFilterOption[]>(() => {\n const count = (kind: string) => files.items.filter(item => item.kind === kind).length\n return [\n { id: 'all', label: '全部', count: files.items.length, icon: 'files' },\n { id: 'image', label: '图片', count: count('image'), icon: 'image' },\n { id: 'video', label: '视频', count: count('video'), icon: 'video' },\n { id: 'audio', label: '音频', count: count('audio'), icon: 'audio' },\n { id: 'document', label: '文档', count: count('document'), icon: 'file' },\n { id: 'other', label: '其他', count: count('other'), icon: 'file' },\n ]\n})\n\nfunction updateSearch(value: string) {\n files.query = value\n window.clearTimeout(searchTimer)\n searchTimer = window.setTimeout(() => void files.load(true), 260)\n}\n\nfunction updateFilter(value: string) {\n files.kindFilter = value as FileKind | 'all'\n void files.load(true)\n}\n\nasync function openSource(item: UiLibraryItem) {\n if (item.sourceWorkspaceConversationId) {\n await router.push(`/conversations/${encodeURIComponent(item.sourceWorkspaceConversationId)}`)\n return\n }\n if (!item.sourceSessionId) return\n if (item.sourceProfile && auth.profiles.some(profile => profile.name === item.sourceProfile)) {\n auth.selectProfile(item.sourceProfile)\n }\n await router.push({\n path: `/chat/${encodeURIComponent(item.sourceSessionId)}`,\n query: {\n ...(item.sourceMessageId ? { message: item.sourceMessageId } : {}),\n ...(item.sourceProfile ? { profile: item.sourceProfile } : {}),\n },\n })\n}\n\nfunction selectFile(item: UiLibraryItem) {\n if (item.kind === 'image' || item.kind === 'video') {\n const index = lightboxMedia.value.findIndex(media => media.url === (item.previewUrl || item.downloadUrl))\n mediaIndex.value = index >= 0 ? index : null\n return\n }\n selected.value = item\n}\n\nasync function selectSession(id: string) {\n const session = chat.sessions.find(item => item.id === id)\n const profile = session?.profile || auth.activeProfile?.name\n await router.push({ path: `/chat/${encodeURIComponent(id)}`, query: profile ? { profile } : {} })\n}\n\nonMounted(() => {\n files.profile = undefined\n void files.load(true)\n void chat.loadSessions(auth.activeProfile?.name)\n void chat.loadUnread(auth.activeProfile?.name)\n})\nonBeforeUnmount(() => window.clearTimeout(searchTimer))\nwatch(() => files.items, () => {\n if (selected.value && !files.items.some(item => item.id === selected.value?.id)) selected.value = null\n})\nwatch(() => auth.activeProfile?.name, profile => {\n selected.value = null\n files.profile = profile\n void files.load(true)\n void chat.loadSessions(profile)\n void chat.loadUnread(profile)\n})\n</script>\n\n<template>\n <WorkspaceView sidebar-title=\"历史记录\" :sidebar-subtitle=\"`${chat.sessions.length} 个会话`\">\n <template #sidebar>\n <ResourceSidebar\n :items=\"historyItems\"\n :active-id=\"chat.activeSessionId\"\n :loading=\"chat.isLoading\"\n :search=\"historySearch\"\n single-line\n search-placeholder=\"搜索会话\"\n empty-title=\"还没有会话\"\n empty-description=\"原生 Hermes 会话会在这里以只读历史显示。\"\n @search=\"historySearch = $event\"\n @select=\"selectSession\"\n />\n </template>\n <section class=\"library-workspace\">\n <header class=\"library-header\">\n <div><h2>文件库</h2><span><AppIcon name=\"files\" :size=\"15\" />{{ items.length }}</span></div>\n <label class=\"file-search\"><AppIcon name=\"search\" :size=\"15\" /><input :value=\"files.query\" type=\"search\" placeholder=\"搜索文件名、路径或会话\" @input=\"updateSearch(($event.target as HTMLInputElement).value)\" /></label>\n </header>\n <nav class=\"file-tabs\" aria-label=\"文件类型筛选\">\n <button v-for=\"option in options\" :key=\"option.id\" type=\"button\" :class=\"{ active: option.id === files.kindFilter }\" @click=\"updateFilter(option.id)\">{{ option.label }}<small v-if=\"option.count !== undefined\">{{ option.count }}</small></button>\n <div class=\"file-tabs__status\"><span v-if=\"files.error\" class=\"error\"><AppIcon name=\"alert\" :size=\"13\" />{{ files.error }}</span><span v-else>{{ files.nextCursor ? '还有更多文件可加载' : items.length ? '已同步到最新' : '' }}</span><button class=\"icon-button\" type=\"button\" aria-label=\"刷新文件库\" title=\"刷新文件库\" :disabled=\"files.isLoading\" @click=\"files.load(true)\"><AppIcon name=\"refresh\" :size=\"15\" /></button></div>\n </nav>\n <LibraryGrid\n :items=\"items\"\n :selected-id=\"selected?.id\"\n :loading=\"files.isLoading\"\n :has-more=\"files.hasMore\"\n empty-title=\"文件库还是空的\"\n empty-description=\"聊天中的图片、文档和附件会出现在这里。\"\n @select=\"selectFile\"\n @load-more=\"files.loadMore\"\n @source=\"openSource\"\n />\n </section>\n </WorkspaceView>\n <PreviewModal v-if=\"selected\" :item=\"selected\" :items=\"items\" :can-add-to-composer=\"false\" @close=\"selected = null\" @source=\"openSource\" />\n <ImagePreviewLightbox v-model=\"mediaIndex\" :images=\"lightboxMedia\" :can-add=\"false\" />\n</template>\n\n<style scoped>\n.library-workspace { display: flex; min-width: 0; min-height: 0; flex: 1; flex-direction: column; }\n.library-header { display: flex; min-height: 58px; align-items: center; justify-content: space-between; gap: 16px; padding: 0 22px; border-bottom: 1px solid var(--line); }.library-header > div { display: flex; align-items: center; gap: 10px; }.library-header h2 { margin: 0; font-size: 15px; letter-spacing: -.02em; }.library-header span { display: flex; align-items: center; gap: 5px; color: var(--text-muted); font-size: 10px; }.file-search { display: flex; width: min(280px, 38vw); min-height: 32px; align-items: center; gap: 7px; padding: 0 9px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); color: var(--text-muted); }.file-search:focus-within { border-color: var(--line-strong); }.file-search input { min-width: 0; flex: 1; border: 0; outline: 0; background: transparent; color: var(--text-primary); font-size: 11px; }\n.file-tabs { display: flex; min-height: 46px; align-items: center; gap: 4px; padding: 0 22px; border-bottom: 1px solid var(--line); overflow-x: auto; }.file-tabs > button { min-height: 28px; padding: 0 10px; border: 0; border-radius: 7px; background: transparent; color: var(--text-muted); cursor: pointer; font-size: 10px; white-space: nowrap; }.file-tabs > button:hover, .file-tabs > button.active { background: var(--surface-soft); color: var(--text-primary); }.file-tabs > button.active { font-weight: 650; }.file-tabs > button small { margin-left: 4px; color: var(--text-muted); font-size: 8px; }.file-tabs__status { display: flex; min-width: 0; align-items: center; gap: 7px; margin-left: auto; color: var(--text-muted); font-size: 9px; white-space: nowrap; }.file-tabs__status > span { overflow: hidden; text-overflow: ellipsis; }.file-tabs__status .error { color: var(--danger); }.file-tabs__status .icon-button { display: grid; width: 28px; height: 28px; flex: 0 0 auto; place-items: center; padding: 0; border: 0; border-radius: 7px; background: transparent; color: var(--text-muted); cursor: pointer; }.file-tabs__status .icon-button:hover { background: var(--surface-soft); color: var(--text-primary); }\n@media (max-width: 600px) { .library-header { min-height: 52px; padding: 0 13px; }.library-header h2 { font-size: 14px; }.file-search { width: min(180px, 52vw); }.file-tabs { padding: 0 13px; }.file-tabs__status { display: none; } }\n</style>\n"],"mappings":"8kCAiBA,IAAM,EAAO,EAOb,SAAS,EAAQ,EAAqB,CAEpC,OADI,EAAK,OAAS,YAAc,EAAK,OAAS,OAAS,EAAK,OAAS,QAAU,EAAK,OAAS,OAAe,OACrG,EAAK,IACd,CAEA,SAAS,EAAU,EAAqB,CACtC,MAAQ,CAAE,MAAO,KAAM,MAAO,KAAM,MAAO,KAAM,IAAK,KAAM,SAAU,KAAM,KAAM,KAAM,KAAM,KAAM,KAAM,KAAM,KAAM,IAAK,EAAY,EAAK,KAC9I,CAEA,SAAS,EAAW,EAAe,CAIjC,OAHI,IAAS,IAAA,GAAkB,GAC3B,EAAO,KAAa,GAAG,EAAK,IAC5B,EAAO,QAAoB,IAAI,EAAO,KAAA,CAAM,QAAQ,CAAC,EAAE,KACpD,IAAI,EAAO,KAAO,KAAA,CAAM,QAAQ,CAAC,EAAE,IAC5C,CAEA,SAAS,EAAW,EAAgC,CAClD,GAAI,CAAC,EAAO,MAAO,GACnB,IAAM,EAAO,aAAiB,KAAO,EAAQ,IAAI,KAAK,CAAK,EAE3D,OADI,OAAO,MAAM,EAAK,QAAQ,CAAC,EAAU,GAClC,IAAI,KAAK,eAAe,QAAS,CAAE,MAAO,QAAS,IAAK,SAAU,CAAC,CAAC,CAAC,OAAO,CAAI,CACzF,eAIE,EAAA,EAAA,EA8BM,MA9BN,EA8BM,CA7BO,EAAA,SAAO,CAAK,EAAA,MAAM,QAA7B,EAAA,EAAA,EAEM,MAFN,EAEM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,ct as f,d as p,et as m,f as ee,g as h,h as g,l as _,m as v,n as y,ot as b,p as x,s as te,st as S,t as C,u as w,v as T,x as E,y as D}from"./_plugin-vue_export-helper-CscYwSBt.js";import{A as ne,X as O,i as k,q as A,r as j}from"./index-
|
|
1
|
+
import{A as e,D as t,F as n,G as r,H as i,L as a,M as o,R as s,W as c,_ as l,a as u,at as d,ct as f,d as p,et as m,f as ee,g as h,h as g,l as _,m as v,n as y,ot as b,p as x,s as te,st as S,t as C,u as w,v as T,x as E,y as D}from"./_plugin-vue_export-helper-CscYwSBt.js";import{A as ne,X as O,i as k,q as A,r as j}from"./index-BRP9NWum.js";import{m as M,v as N,x as P,y as F}from"./viewModels-CYJ8m5Uf.js";var re={xmlns:`http://www.w3.org/2000/svg`,"xmlns:xlink":`http://www.w3.org/1999/xlink`,viewBox:`0 0 24 24`},I=E({name:`At`,render:function(e,t){return n(),l(`svg`,re,t[0]||=[v(`g`,{fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`},[v(`circle`,{cx:`12`,cy:`12`,r:`4`}),v(`path`,{d:`M16 12v1.5a2.5 2.5 0 0 0 5 0V12a9 9 0 1 0-5.5 8.28`})],-1)])}}),L={xmlns:`http://www.w3.org/2000/svg`,"xmlns:xlink":`http://www.w3.org/1999/xlink`,viewBox:`0 0 24 24`},ie=E({name:`Target`,render:function(e,t){return n(),l(`svg`,L,t[0]||=[v(`g`,{fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`},[v(`circle`,{cx:`12`,cy:`12`,r:`1`}),v(`circle`,{cx:`12`,cy:`12`,r:`5`}),v(`circle`,{cx:`12`,cy:`12`,r:`9`})],-1)])}}),ae={class:`composer-area`},R={key:0,class:`composer-reference`},oe={class:`composer-activity-slot`},se={key:0,class:`composer-activity`,role:`status`,"aria-label":`机器人输入状态`,"aria-live":`polite`,"aria-atomic":`true`},ce={key:0,class:`composer-sending`,role:`status`,"aria-live":`polite`},le=[`title`],ue={key:0},de={key:1},fe={key:2},pe={key:3},me={key:1,class:`composer-attachments`,"aria-label":`附件`},he=[`src`,`alt`],ge=[`aria-label`,`onClick`],_e=[`disabled`,`placeholder`],ve={class:`composer-toolbar`},ye={class:`composer-tools`},be=[`disabled`,`aria-expanded`],xe={key:0,class:`composer-popover composer-add-menu`,role:`menu`,"aria-label":`添加到消息`},Se=[`disabled`],Ce=[`disabled`],we=[`disabled`,`title`],Te=[`disabled`],Ee={key:3,class:`composer-popover-anchor`},De=[`disabled`,`title`,`aria-label`,`aria-expanded`],Oe={key:0,class:`composer-popover composer-popover--reasoning`,role:`dialog`,"aria-label":`推理强度`},ke={class:`composer-popover__heading`},Ae=[`max`,`value`],je={class:`composer-popover__range`},Me={key:4,class:`composer-popover-anchor`},Ne=[`disabled`,`aria-expanded`],Pe={key:0,class:`composer-popover composer-popover--settings`,role:`dialog`,"aria-label":`输入设置`},Fe=[`aria-checked`],Ie=[`disabled`],Le=[`disabled`,`title`],Re=[`disabled`,`aria-pressed`,`aria-label`],ze=[`disabled`],Be={class:`composer-actions`},Ve={key:0,class:`composer-queue-slot`},He=[`title`],Ue={key:1,class:`composer-stop-hitbox`},We={class:`composer-send-hitbox`},Ge=[`disabled`,`aria-label`],Ke={key:0,class:`composer-menu`,role:`listbox`},qe={class:`composer-menu__label`},Je=[`aria-selected`,`disabled`,`onMousedown`,`onMouseenter`],Ye={class:`composer-menu__avatar`},Xe={key:0},Ze={key:0},Qe={key:2,class:`composer-drop-hint`},$e={key:0,class:`composer-error`,role:`alert`},et=26214400,tt=8,z=C(E({__name:`ComposerShell`,props:{mode:{default:`chat`},draftKey:{default:``},placeholder:{default:`输入消息,Enter 发送,Shift + Enter 换行`},disabled:{type:Boolean,default:!1},streaming:{type:Boolean,default:!1},stopWhileRunning:{type:Boolean,default:!1},sending:{type:Boolean,default:!1},modelLabel:{default:`选择模型`},fastMode:{type:Boolean,default:!1},fastModeDisabled:{type:Boolean,default:!1},reasoningEffort:{default:`默认`},reasoningValue:{default:``},reasoningOptions:{default:()=>[]},contextUsed:{default:0},contextLimit:{default:0},contextPercent:{},showContext:{type:Boolean,default:!1},queueMode:{type:Boolean,default:!1},toolTraceVisible:{type:Boolean,default:!0},reference:{default:null},mentionOptions:{default:()=>[]},slashCommands:{default:()=>[]},attachmentsEnabled:{type:Boolean,default:!0},activityText:{default:``},deliveryAvailable:{type:Boolean,default:!1},deliveryMode:{type:Boolean,default:!1},deliveryDisabled:{type:Boolean,default:!1},deliveryDisabledReason:{default:``}},emits:[`send`,`stop`,`modelClick`,`fastModeToggle`,`reasoningChange`,`settingsClick`,`queueToggle`,`toolTraceToggle`,`clearReference`,`error`,`update:deliveryMode`],setup(u,{expose:ee,emit:C}){let E=u,k=C,A=m(``),j=m(null),M=m(null),N=m([]),P=m(!1),F=m(0),re=x(()=>F.value>0),L=m(null),z=m(0),B=m(null),nt=m(``),V=m([]),H=m(!1),U=m(!1),W=m(!1),rt=m(null),it=m(null),at=x(()=>E.mode===`group`&&(E.mentionOptions.length>0||E.deliveryAvailable)),ot=m(``),st,ct=x(()=>!E.disabled&&!E.sending&&(A.value.trim().length>0||N.value.length>0)),lt=x(()=>E.streaming&&(E.stopWhileRunning||E.mode===`chat`)),G=x(()=>lt.value&&!A.value.trim()&&!N.value.length),K=x(()=>E.modelLabel.split(`/`).filter(Boolean).at(-1)||E.modelLabel),ut=x(()=>Math.max(0,Math.min(100,E.contextPercent??(E.contextLimit>0?Math.round(E.contextUsed/E.contextLimit*100):0)))),q=x(()=>E.contextUsed>0),dt=x(()=>E.showContext||E.contextLimit>0||q.value),ft=x(()=>Math.max(0,E.contextLimit-E.contextUsed)),pt=x(()=>Math.max(0,E.reasoningOptions.findIndex(e=>e.id===E.reasoningValue))),J=x(()=>E.reasoningOptions[pt.value]?.label||E.reasoningEffort),Y=x(()=>{let e=B.value===`slash`?E.slashCommands:E.mentionOptions,t=nt.value.trim().toLocaleLowerCase();return e.filter(e=>!t||e.label.toLocaleLowerCase().includes(t)||e.detail?.toLocaleLowerCase().includes(t)).slice(0,10)});function X(e=E.draftKey){return e?`hermes-yaoyao:composer:${E.mode}:${e}`:``}let mt=!1,ht=!1,gt=new Map;i([A,N,V],()=>{if(ht&&!mt){let e=X();gt.set(e,(gt.get(e)??0)+1)}},{deep:!0,flush:`sync`});function _t(){ht=!0;let e=X();return{key:e,revision:gt.get(e)??0}}function vt(){let e=X();mt=!0;try{A.value=e&&localStorage.getItem(e)||``}finally{mt=!1}t(Q)}function yt(e){let t=X();t&&(e?localStorage.setItem(t,e):localStorage.removeItem(t))}function Z(e){ot.value=e,k(`error`,e),window.clearTimeout(st),st=window.setTimeout(()=>{ot.value=``},4500)}function bt(e){return e<1024?`${e} B`:e<1048576?`${(e/1024).toFixed(1)} KB`:`${(e/1024/1024).toFixed(1)} MB`}function xt(e){return e.startsWith(`image/`)}function St(e){if(!E.attachmentsEnabled){Z(`当前上游不支持团队附件`);return}let t=tt-N.value.length;if(t<=0)return Z(`最多添加 ${tt} 个文件`);let n=[];for(let r of e.slice(0,t)){if(r.size>et){Z(`${r.name} 超过 25 MiB`);continue}n.push({id:`${r.name}:${r.size}:${r.lastModified}:${ne(`attachment`)}`,file:r,name:r.name,size:r.size,type:r.type||`application/octet-stream`,previewUrl:xt(r.type)?URL.createObjectURL(r):void 0})}N.value.push(...n),e.length>t&&Z(`最多添加 ${tt} 个文件`)}function Ct(e){let t=N.value.findIndex(t=>t.id===e);if(t<0)return;let[n]=N.value.splice(t,1);n?.previewUrl&&URL.revokeObjectURL(n.previewUrl)}function wt(){N.value.forEach(e=>e.previewUrl&&URL.revokeObjectURL(e.previewUrl)),N.value=[],M.value&&(M.value.value=``)}function Tt(e){let t=e.target;St(Array.from(t.files??[])),t.value=``}function Et(e){let t=Array.from(e.clipboardData?.files??[]);t.length&&St(t)}function Dt(e){e.dataTransfer?.types.includes(`Files`)&&(e.preventDefault(),F.value+=1)}function Ot(e){e.dataTransfer?.types.includes(`Files`)&&(e.preventDefault(),e.dataTransfer&&(e.dataTransfer.dropEffect=`copy`))}function kt(e){e.preventDefault(),F.value=Math.max(0,F.value-1)}function At(e){e.preventDefault(),F.value=0,St(Array.from(e.dataTransfer?.files??[]))}function Q(){let e=j.value;!e||L.value!==null||(e.style.height=`auto`,e.style.height=`${Math.min(400,Math.max(30,e.scrollHeight))}px`)}function jt(){L.value=null,j.value&&(j.value.style.height=`auto`),t(Q)}function Mt(e){let t=j.value;if(!t)return;e.preventDefault();let n=e.clientY,r=t.clientHeight,i=e.pointerId,a=e.currentTarget;a.setPointerCapture(i);let o=e=>{L.value=Math.min(400,Math.max(30,r-(e.clientY-n)))},s=()=>{a.removeEventListener(`pointermove`,o),a.removeEventListener(`pointerup`,s),a.removeEventListener(`pointercancel`,s)};a.addEventListener(`pointermove`,o),a.addEventListener(`pointerup`,s),a.addEventListener(`pointercancel`,s)}function Nt(){let e=j.value;if(!e||P.value)return;let t=A.value.slice(0,e.selectionStart);if(t.startsWith(`/`)&&!t.includes(` `)&&!t.includes(`
|
|
2
2
|
`)&&E.slashCommands.length){B.value=`slash`,nt.value=t.slice(1),z.value=0;return}if(E.mode===`group`&&E.mentionOptions.length){let e=t.match(/(?<![A-Za-z0-9_.%+/@-])@([^\s@]*)$/u);if(e&&!/https?:\/\/\S*$/u.test(t)){B.value=`mention`,nt.value=e[1]??``,z.value=0;return}}B.value=null}function Pt(){W.value=!W.value,H.value=!1,U.value=!1,B.value=null,W.value&&t(()=>rt.value?.querySelector(`[role="menuitem"]:not(:disabled)`)?.focus())}function $(e=!1){W.value=!1,e&&it.value?.focus()}function Ft(e){if(e.key===`Escape`)e.preventDefault(),e.stopPropagation(),$(!0);else if(e.key===`Tab`)$(!0);else if([`ArrowDown`,`ArrowUp`,`Home`,`End`].includes(e.key)){e.preventDefault();let t=Array.from(rt.value?.querySelectorAll(`[role="menuitem"]:not(:disabled)`)??[]),n=t.indexOf(document.activeElement);t[e.key===`Home`?0:e.key===`End`?t.length-1:(n+(e.key===`ArrowUp`?-1:1)+t.length)%t.length]?.focus()}}function It(){$(!0),M.value?.click()}function Lt(){$();let e=j.value;if(!e)return;let n=e.selectionStart,r=A.value.slice(0,n),i=`${r&&!/\s$/.test(r)?` `:``}@`;A.value=r+i+A.value.slice(e.selectionEnd),t(()=>{e.focus(),e.setSelectionRange(n+i.length,n+i.length),Nt(),Q()})}function Rt(e){E.disabled||E.deliveryDisabled||E.sending||(k(`update:deliveryMode`,e),$(),t(()=>j.value?.focus()))}function zt(e){if(e.disabled)return;let n=j.value;if(!n)return;let r=n.selectionStart,i=A.value.slice(0,r),a=A.value.slice(r);if(B.value===`slash`){let r=e.insertText??`/${e.label} `;A.value=r+a,t(()=>n.setSelectionRange(r.length,r.length))}else{let o=i.match(/(?<![A-Za-z0-9_.%+/@-])@([^\s@]*)$/u),s=o?r-o[0].length:r,c=A.value.slice(0,s),l=`@${e.label} `;A.value=c+l+a,e.id!==`all`&&!V.value.includes(e.id)&&V.value.push(e.id),t(()=>{let e=c.length+l.length;n.setSelectionRange(e,e)})}B.value=null,t(()=>{n.focus(),Q()})}function Bt(e){if(B.value&&Y.value.length){if(e.key===`ArrowDown`){e.preventDefault(),z.value=(z.value+1)%Y.value.length;return}if(e.key===`ArrowUp`){e.preventDefault(),z.value=(z.value-1+Y.value.length)%Y.value.length;return}if(e.key===`Escape`){e.preventDefault(),B.value=null;return}if(e.key===`Tab`||e.key===`Enter`&&!e.shiftKey){e.preventDefault();let t=Y.value[z.value];t&&zt(t);return}}e.key!==`Enter`||e.shiftKey||P.value||e.isComposing||e.keyCode===229||(e.preventDefault(),Ht())}function Vt(){requestAnimationFrame(()=>{P.value=!1,Nt()})}function Ht(){if(!ct.value)return;let e={text:A.value.trim(),files:N.value.map(e=>e.file),mentionIds:[...V.value]};k(`send`,e),t(()=>j.value?.focus())}function Ut(e){if(e){if((gt.get(e.key)??0)!==e.revision)return!1;if(e.key!==X())return e.key&&localStorage.removeItem(e.key),!1}return A.value=``,V.value=[],yt(``),wt(),jt(),t(()=>j.value?.focus()),!0}function Wt(e){e.target.closest(`button, input, textarea, [role="option"], .composer-resize`)||j.value?.focus()}function Gt(e){return e>=1048576?`${(e/1048576).toFixed(1)}m`:e>=1024?`${(e/1024).toFixed(1)}k`:`${e}`}function Kt(e){let t=Number(e.target.value),n=E.reasoningOptions[t];n&&k(`reasoningChange`,n.id)}function qt(e){let t=e.target;rt.value?.contains(t)||$(),t.closest(`.composer-shell`)||(B.value=null,H.value=!1,U.value=!1)}return i(A,e=>{yt(e),t(Q)}),i(()=>E.draftKey,()=>{vt(),H.value=!1,U.value=!1,W.value=!1}),i(()=>E.disabled,e=>{e&&$()}),o(()=>{vt(),document.addEventListener(`pointerdown`,qt)}),e(()=>{wt(),window.clearTimeout(st),document.removeEventListener(`pointerdown`,qt)}),ee({attachFiles:St,filesSnapshot:()=>N.value.map(e=>e.file),focus:()=>j.value?.focus(),clearAfterSend:Ut,submissionToken:_t}),(e,t)=>(n(),l(`div`,ae,[u.reference?(n(),l(`div`,R,[D(O,{name:`quote`,size:14}),v(`span`,null,[v(`small`,null,f(u.reference.author?`回复 ${u.reference.author}`:`回复消息`),1),v(`strong`,null,f(u.reference.content.replace(/\s+/g,` `).trim()),1)]),v(`button`,{type:`button`,"aria-label":`取消引用`,onClick:t[0]||=e=>k(`clearReference`)},[D(O,{name:`close`,size:13})])])):h(``,!0),v(`div`,oe,[s(e.$slots,`activity`,{},()=>[D(y,{name:`composer-activity`},{default:c(()=>[u.activityText?(n(),l(`div`,se,[t[17]||=v(`span`,{class:`composer-typing-dots`,"aria-hidden":`true`},[v(`i`),v(`i`),v(`i`)],-1),v(`strong`,null,f(u.activityText),1)])):h(``,!0)]),_:1})],!0),u.sending?(n(),l(`span`,ce,[...t[18]||=[v(`i`,null,null,-1),T(`正在发送`,-1)]])):h(``,!0)]),s(e.$slots,`before-input`,{},void 0,!0),v(`div`,{class:b([`composer-shell`,{"composer-shell--drag":re.value,"composer-shell--disabled":u.disabled}]),onMousedown:Wt,onDragenter:Dt,onDragover:Ot,onDragleave:kt,onDrop:At},[v(`input`,{ref_key:`fileInput`,ref:M,class:`composer-file-input`,type:`file`,multiple:``,onChange:Tt},null,544),v(`div`,{class:`composer-resize`,title:`拖动调整高度;双击复位`,onPointerdown:Mt,onDblclick:jt},null,32),dt.value?(n(),l(`div`,{key:0,class:b([`composer-context`,{warning:q.value&&ut.value>80}]),title:q.value?`最近一次模型请求的上下文用量`:`等待服务端提供最近一次模型请求的上下文用量`},[q.value?u.contextLimit>0?(n(),l(`span`,de,f(Gt(u.contextUsed))+` / `+f(Gt(u.contextLimit))+` · 剩余 `+f(Gt(ft.value)),1)):(n(),l(`span`,fe,`当前上下文 `+f(Gt(u.contextUsed))+` · 窗口未确认`,1)):(n(),l(`span`,ue,`等待本轮实际用量 · `+f(u.contextLimit>0?`窗口 ${Gt(u.contextLimit)}`:`窗口未确认`),1)),q.value&&u.contextLimit>0?(n(),l(`i`,pe,[v(`b`,{style:S({width:`${ut.value}%`})},null,4)])):h(``,!0)],10,le)):h(``,!0),N.value.length?(n(),l(`div`,me,[(n(!0),l(p,null,a(N.value,e=>(n(),l(`div`,{key:e.id,class:b([`composer-attachment`,{image:xt(e.type)}])},[e.previewUrl?(n(),l(`img`,{key:0,src:e.previewUrl,alt:e.name},null,8,he)):(n(),g(O,{key:1,name:`file`,size:19})),v(`span`,null,[v(`strong`,null,f(e.name),1),v(`small`,null,f(bt(e.size)),1)]),v(`button`,{type:`button`,"aria-label":`移除 ${e.name}`,onClick:t=>Ct(e.id)},[D(O,{name:`close`,size:12})],8,ge)],2))),128))])):h(``,!0),r(v(`textarea`,{ref_key:`textarea`,ref:j,"onUpdate:modelValue":t[1]||=e=>A.value=e,class:`composer-textarea`,style:S(L.value===null?void 0:{height:`${L.value}px`}),rows:`1`,disabled:u.disabled,placeholder:u.deliveryAvailable&&u.deliveryMode?`描述希望团队交付的结果…`:u.placeholder,onInput:Nt,onClick:Nt,onKeydown:Bt,onPaste:Et,onCompositionstart:t[2]||=e=>P.value=!0,onCompositionend:Vt},null,44,_e),[[te,A.value]]),v(`div`,ve,[v(`div`,ye,[at.value?(n(),l(`div`,{key:0,ref_key:`actionsAnchor`,ref:rt,class:`composer-popover-anchor composer-actions-anchor`,onKeydown:Ft},[v(`button`,{ref_key:`actionsTrigger`,ref:it,class:`composer-tool composer-add`,type:`button`,disabled:u.disabled,"aria-label":`添加`,"aria-haspopup":`menu`,"aria-expanded":W.value,onClick:Pt,onKeydown:t[3]||=_(w(e=>!W.value&&Pt(),[`prevent`]),[`down`])},[D(O,{name:`plus`,size:20})],40,be),D(y,{name:`composer-menu`},{default:c(()=>[W.value?(n(),l(`div`,xe,[v(`button`,{type:`button`,role:`menuitem`,disabled:!u.attachmentsEnabled,onClick:It},[D(O,{name:`paperclip`,size:20}),t[19]||=v(`span`,null,`添加附件`,-1)],8,Se),u.mentionOptions.length?(n(),l(`button`,{key:0,type:`button`,role:`menuitem`,onClick:Lt},[D(d(I),{class:`composer-action-icon`,"aria-hidden":`true`}),t[20]||=v(`span`,null,`提及成员`,-1)])):h(``,!0),u.deliveryAvailable?(n(),l(p,{key:1},[t[22]||=v(`div`,{class:`composer-add-menu__divider`,role:`separator`},null,-1),v(`button`,{type:`button`,role:`menuitem`,disabled:u.deliveryDisabled||u.sending,onClick:t[4]||=e=>Rt(!u.deliveryMode)},[D(d(ie),{class:`composer-action-icon`,"aria-hidden":`true`}),v(`span`,null,[t[21]||=v(`strong`,null,`交付目标`,-1),v(`small`,null,f(u.deliveryDisabledReason||(u.deliveryMode?`已开启;点击返回普通聊天`:`让团队持续完成一个结果`)),1)]),u.deliveryMode?(n(),g(O,{key:0,name:`check`,size:16})):h(``,!0)],8,Ce)],64)):h(``,!0)])):h(``,!0)]),_:1})],544)):(n(),l(`button`,{key:1,class:`composer-tool composer-tool--icon`,type:`button`,disabled:u.disabled||!u.attachmentsEnabled,title:u.attachmentsEnabled?`添加附件`:`当前上游不支持附件`,"aria-label":`添加附件`,onClick:t[5]||=e=>M.value?.click()},[D(O,{name:`paperclip`,size:16})],8,we)),u.deliveryAvailable&&u.deliveryMode?(n(),l(`button`,{key:2,class:`composer-delivery-chip`,type:`button`,disabled:u.disabled||u.deliveryDisabled||u.sending,"aria-label":`关闭交付目标,返回普通聊天`,title:`关闭交付目标,返回普通聊天`,onClick:t[6]||=e=>Rt(!1)},[D(d(ie),{class:`composer-action-icon`,"aria-hidden":`true`}),t[23]||=v(`span`,null,`交付目标`,-1),D(O,{name:`close`,size:15})],8,Te)):h(``,!0),u.mode===`chat`?(n(),l(`div`,Ee,[v(`button`,{class:b([`composer-tool`,{active:H.value}]),type:`button`,disabled:u.disabled||!u.reasoningOptions.length,title:`推理强度:${J.value}`,"aria-label":`推理强度:${J.value}`,"aria-expanded":H.value,onClick:t[7]||=e=>{H.value=!H.value,U.value=!1}},[D(O,{name:`brain`,size:16}),v(`span`,null,f(J.value),1),D(O,{name:`chevron-down`,size:11})],10,De),D(y,{name:`composer-menu`},{default:c(()=>[H.value?(n(),l(`div`,Oe,[v(`div`,ke,[t[24]||=v(`span`,null,`推理强度`,-1),v(`strong`,null,f(J.value),1)]),v(`input`,{class:`reasoning-slider`,type:`range`,min:0,max:Math.max(0,u.reasoningOptions.length-1),step:`1`,value:pt.value,onInput:Kt},null,40,Ae),v(`div`,je,[v(`span`,null,f(u.reasoningOptions[0]?.label||`默认`),1),v(`span`,null,f(u.reasoningOptions.at(-1)?.label||`最大`),1)])])):h(``,!0)]),_:1})])):h(``,!0),u.mode===`chat`?(n(),l(`div`,Me,[v(`button`,{class:b([`composer-tool`,{active:U.value}]),type:`button`,disabled:u.disabled,title:`设置`,"aria-label":`设置`,"aria-expanded":U.value,onClick:t[8]||=e=>{U.value=!U.value,H.value=!1}},[D(O,{name:`settings`,size:16}),t[25]||=v(`span`,null,`设置`,-1),D(O,{name:`chevron-down`,size:11})],10,Ne),D(y,{name:`composer-menu`},{default:c(()=>[U.value?(n(),l(`div`,Pe,[v(`button`,{class:`composer-setting-row`,type:`button`,role:`switch`,"aria-checked":u.toolTraceVisible,onClick:t[9]||=e=>k(`settingsClick`)},[v(`span`,null,[D(O,{name:`brain`,size:15}),t[26]||=T(`显示思考`,-1)]),u.toolTraceVisible?(n(),g(O,{key:0,name:`check`,size:16})):h(``,!0)],8,Fe),v(`button`,{class:`composer-setting-row`,type:`button`,title:`首版暂未启用语音输入`,onClick:t[10]||=e=>Z(`语音输入尚未启用`)},[...t[27]||=[v(`span`,null,`语音输入设置`,-1)]])])):h(``,!0)]),_:1})])):(n(),l(`button`,{key:5,class:b([`composer-tool`,{active:u.toolTraceVisible}]),type:`button`,disabled:u.disabled,title:`显示思考`,onClick:t[11]||=e=>k(`toolTraceToggle`)},[D(O,{name:`brain`,size:16}),t[28]||=v(`span`,null,`思考`,-1)],10,Ie)),u.mode===`chat`?(n(),l(`button`,{key:6,class:`composer-tool composer-tool--model`,type:`button`,disabled:u.disabled,title:u.modelLabel,onClick:t[12]||=e=>k(`modelClick`)},[D(O,{name:`model`,size:15}),v(`span`,null,f(K.value),1),D(O,{name:`chevron-down`,size:11})],8,Le)):h(``,!0),u.mode===`chat`?(n(),l(`button`,{key:7,class:b([`composer-tool composer-tool--icon composer-fast-mode`,{active:u.fastMode}]),type:`button`,disabled:u.disabled||u.fastModeDisabled,"aria-pressed":u.fastMode,"aria-label":`快速模式:${u.fastMode?`已开启`:`已关闭`}`,title:`快速模式:响应更快,消耗更多额度`,onClick:t[13]||=e=>k(`fastModeToggle`,!u.fastMode)},[D(O,{name:`bolt`,size:15})],10,Re)):u.mentionOptions.length?(n(),l(`button`,{key:8,type:`button`,class:`composer-tool composer-mention-hint`,disabled:u.disabled,"aria-label":`提及成员`,onClick:Lt},[D(d(I),{class:`composer-action-icon`,"aria-hidden":`true`}),t[29]||=v(`span`,null,`提及成员`,-1)],8,ze)):h(``,!0)]),v(`div`,Be,[u.mode===`chat`?(n(),l(`span`,Ve,[u.streaming&&ct.value?(n(),l(`button`,{key:0,class:b([`queue-toggle`,{active:u.queueMode}]),type:`button`,title:u.queueMode?`消息将排队发送`:`消息将 Steer 当前会话`,onClick:t[14]||=e=>k(`queueToggle`)},f(u.queueMode?`排队`:`Steer`),11,He)):h(``,!0)])):h(``,!0),u.stopWhileRunning||u.mode===`chat`?(n(),l(`span`,Ue,[lt.value&&!G.value?(n(),l(`button`,{key:0,class:`composer-stop`,type:`button`,"aria-label":`停止生成`,title:`停止生成`,onClick:t[15]||=e=>k(`stop`)},[D(O,{name:`stop`,size:15})])):h(``,!0)])):h(``,!0),v(`span`,We,[v(`button`,{class:b([`composer-send`,{"composer-send--stop":G.value}]),type:`button`,disabled:!G.value&&!ct.value,"aria-label":G.value?`停止生成`:`发送消息`,onClick:t[16]||=e=>G.value?k(`stop`):Ht()},[D(O,{name:G.value?`stop`:`arrow-up`,size:(G.value,17)},null,8,[`name`,`size`])],10,Ge)])])]),D(y,{name:`composer-menu`},{default:c(()=>[B.value&&Y.value.length?(n(),l(`div`,Ke,[v(`div`,qe,f(B.value===`mention`?`提及机器人`:`命令`),1),(n(!0),l(p,null,a(Y.value,(e,t)=>(n(),l(`button`,{key:e.id,type:`button`,role:`option`,"aria-selected":t===z.value,disabled:e.disabled,class:b({active:t===z.value}),onMousedown:w(t=>zt(e),[`prevent`]),onMouseenter:e=>z.value=t},[v(`span`,Ye,f(B.value===`mention`?e.label.slice(0,1).toUpperCase():`/`),1),v(`span`,null,[v(`strong`,null,f(B.value===`mention`?`@${e.label}`:`/${e.label}`),1),e.detail?(n(),l(`small`,Xe,f(e.detail),1)):h(``,!0)]),e.disabled?(n(),l(`em`,Ze,`不可用`)):h(``,!0)],42,Je))),128))])):h(``,!0)]),_:1}),re.value?(n(),l(`div`,Qe,[D(O,{name:`paperclip`,size:20}),t[30]||=T(`松开以添加附件`,-1)])):h(``,!0)],34),D(y,{name:`composer-menu`},{default:c(()=>[ot.value?(n(),l(`p`,$e,f(ot.value),1)):h(``,!0)]),_:1})]))}}),[[`__scopeId`,`data-v-41dd5183`]]),B=new Set([`apng`,`avif`,`bmp`,`gif`,`heic`,`heif`,`ico`,`jfif`,`jpeg`,`jpg`,`jxl`,`png`,`svg`,`tif`,`tiff`,`webp`]),nt=new Set([`avi`,`m4v`,`mkv`,`mov`,`mp4`,`mpeg`,`mpg`,`webm`]);function V(e,t,n=`local:${t}`,r){let i=e.split(`.`).at(-1)?.toLocaleLowerCase()||``,a=B.has(i)?`image`:nt.has(i)?`video`:[`mp3`,`wav`,`m4a`,`aac`,`ogg`].includes(i)?`audio`:i===`pdf`?`pdf`:[`md`,`markdown`,`txt`,`json`,`yaml`,`yml`,`csv`,`js`,`ts`,`py`,`sh`].includes(i)?`text`:`file`;return{id:n,name:e,kind:r||a,previewUrl:t,downloadUrl:t}}function H(e){try{let t=new URL(e,window.location.origin);return t.origin===window.location.origin&&t.pathname===`/api/files/download`&&(t.searchParams.delete(`_retry`),t.searchParams.sort()),t.origin===window.location.origin&&(t.pathname=t.pathname.replace(/(\/api\/app\/files\/[^/]+)\/(?:preview|download)$/,`$1`)),t.href}catch{return e}}function U(e){try{let t=new URL(e,window.location.origin);return(t.pathname===`/api/files/download`?t.searchParams.get(`path`)||t.pathname:decodeURIComponent(t.pathname)).split(`/`).at(-1)||`媒体`}catch{return`媒体`}}function W(e){let t=[],n=new Set,r=e=>{if(!e.previewUrl||![`image`,`video`].includes(e.kind))return;let r=H(e.previewUrl);n.has(r)||(n.add(r),t.push(e))},i=new P({html:!1}),a=i.validateLink;i.validateLink=e=>!!A(e)||a(e);for(let t of e){if(![`user`,`assistant`].includes(t.role)&&!t.communication)continue;let e=e=>{let n=t.attachments?.find(t=>t.id===e);n?.url&&[`image`,`video`].includes(n.kind||`file`)&&r(V(n.name,n.url,`${t.id}:${n.id}`,n.kind))},n=e=>{if(t.role===`user`)return;let n=F(e,t.status===`streaming`);for(let e of i.parse(n,{}))for(let n of e.children??[]){let e=n.type===`image`?n.attrGet(`src`):n.type===`link_open`?n.attrGet(`href`):null;if(!e)continue;let i=A(e,t.profile)||e,a=t.attachments?.find(e=>e.url&&H(e.url)===H(i));r(V(a?.name||U(i),i,`${t.id}:${i}`,a?.kind))}};if(t.contentParts?.length)for(let r of t.contentParts)`text`in r?n(r.text):e(r.attachmentId);else n(t.content);for(let n of t.attachments??[])e(n.id)}return t}function rt(t,n){let r,i=new Set,a=()=>{let e=t.value;if(!e||document.hidden||!document.hasFocus()){i.clear();return}let r=e.getBoundingClientRect(),a=new Set;for(let t of e.querySelectorAll(`[data-message-id]`)){let e=t.getBoundingClientRect(),n=Math.max(e.top,r.top,0),i=Math.min(e.bottom,r.bottom,innerHeight),o=Math.max(e.left,r.left,0),s=Math.min(e.right,r.right,innerWidth);if(i-n<Math.min(24,e.height)||s<=o)continue;let c=document.elementFromPoint((o+s)/2,(n+i)/2);c&&t.contains(c)&&t.dataset.messageId&&a.add(t.dataset.messageId)}let o=[...a].filter(e=>i.has(e));i=a,o.length&&n(o)};o(()=>{r=setInterval(a,350)}),e(()=>{clearInterval(r),i.clear()})}var it={class:`system-message-notice`},at=[`href`,`aria-label`],ot={key:1},st=[`aria-label`],ct={role:`status`},lt={class:`system-message-notice__details`},G={key:2,class:`system-message-notice__label`,role:`status`},K=C(E({__name:`SystemMessageNotice`,props:{title:{},icon:{},href:{},accessibleLabel:{}},setup(e){return(t,r)=>(n(),l(`div`,it,[e.href?(n(),l(`a`,{key:0,class:`system-message-notice__label`,href:e.href,"aria-label":e.accessibleLabel||e.title},[D(O,{name:e.icon||`info`,size:16,"aria-hidden":`true`},null,8,[`name`]),v(`span`,null,f(e.title),1)],8,at)):t.$slots.default?(n(),l(`details`,ot,[v(`summary`,{class:`system-message-notice__label`,"aria-label":e.accessibleLabel||`${e.title},查看详情`},[D(O,{name:e.icon||`info`,size:16,"aria-hidden":`true`},null,8,[`name`]),v(`span`,ct,f(e.title),1)],8,st),v(`div`,lt,[s(t.$slots,`default`,{},void 0,!0)])])):(n(),l(`div`,G,[D(O,{name:e.icon||`info`,size:16,"aria-hidden":`true`},null,8,[`name`]),v(`span`,null,f(e.title),1)]))]))}}),[[`__scopeId`,`data-v-fd32abae`]]),ut={key:0,class:`service-warnings`,"aria-label":`服务状态提示`},q=E({__name:`ServiceWarnings`,props:{warnings:{}},setup(e){return(t,r)=>e.warnings.length?(n(),l(`div`,ut,[(n(!0),l(p,null,a(e.warnings,(e,t)=>(n(),g(K,{key:`${e.service}:${e.code}:${t}`,title:`${e.service}:${e.message}`,icon:`info`},null,8,[`title`]))),128))])):h(``,!0)}}),dt={key:0},ft=C(E({__name:`MessageFailureNotice`,props:{failure:{}},setup(e){return(t,r)=>(n(),g(K,{class:`failure-notice`,title:e.failure.title,icon:`info`},{default:c(()=>[v(`p`,null,f(e.failure.hint),1),e.failure.detail?(n(),l(`pre`,dt,f(e.failure.detail),1)):h(``,!0)]),_:1},8,[`title`]))}}),[[`__scopeId`,`data-v-739155c5`]]),pt=/^执行失败[::]\s*/;function J(e){if(e.communication||e.taskReference||e.role===`tool`||e.status!==`failed`&&!e.error?.trim())return;let t=e.content.trim(),n=e.role!==`user`&&e.status===`failed`&&pt.test(t),r=e.error?.trim()||(n?t.replace(pt,``):``);if(!r&&e.status!==`failed`)return;let i=e.role===`assistant`&&e.status===`failed`&&t.includes(`Provider said:`)&&/didn[’']t respond in time on any of \d+ attempts/.test(t),a=e.role!==`user`&&(n||i||!!r&&t===r||!t),o=[...new Set([a?t.replace(pt,``):``,r].filter(Boolean))].filter((e,t,n)=>!n.some((n,r)=>r!==t&&n.includes(e))).join(`
|
|
3
3
|
|
|
4
4
|
`),s=/timeout|timed?\s*out|no SSE events|didn[’']t respond in time|超时/i.test(r||o);return{title:e.role===`user`?`消息未发送`:s?`响应超时`:`回复暂时中断`,hint:e.role===`user`?`请检查连接后重新发送。`:`请稍后重试,或切换模型。`,detail:o,key:r||o,replacesContent:a}}function Y(e){return e.filter((t,n)=>{let r=e[n-1];if(!r||r.role!==`assistant`||t.role!==`system`||!/^执行失败[::]/.test(t.content))return!0;let i=J(t),a=J(r);if(!i?.key||i.key!==a?.key||t.attachments?.length||t.tools?.length||t.reasoning)return!0;if(t.runId&&r.runId)return t.runId!==r.runId;let o=new Date(t.createdAt??``).getTime(),s=new Date(r.createdAt??``).getTime();return!Number.isFinite(o)||!Number.isFinite(s)||o<s||o-s>2e3})}var X=E({__name:`TaskResultNotice`,props:{content:{},taskReference:{}},setup(e){let t=e,r=x(()=>t.content.split(/\r?\n/).map(e=>e.trim()).filter(e=>e&&!/^\[打开任务\]\(/.test(e))),i=x(()=>t.content.includes(`等待管理员复核`)),a=x(()=>i.value?`任务已有新结果`:t.content.includes(`已完成`)?`任务已完成`:`任务状态已更新`),o=x(()=>{let e=r.value[0]?.match(/^「([^」]+)」的任务「([^」]+)」/);return e?`${e[1]} · ${e[2]}`:r.value[0]||`团队交付任务`}),s=x(()=>i.value?`等待管理员复核后继续`:r.value.slice(1).join(` `)||`打开任务查看完整交付与验收状态`),c=x(()=>`/conversations/${encodeURIComponent(t.taskReference.conversationId)}?taskId=${encodeURIComponent(t.taskReference.taskId)}`);return(e,t)=>(n(),g(K,{class:`task-result-notice`,title:a.value,icon:i.value?`file`:`check`,href:c.value,"accessible-label":`${a.value},${o.value},${s.value},打开任务`},null,8,[`title`,`icon`,`href`,`accessible-label`]))}});function mt(e){if(e.communication||e.role===`user`)return;if(e.timelineKind===`delegation-complete`)return{title:`子任务已完成`,icon:`groups`};if(e.timelineKind===`background-process`){let t=e.timelineMetadata?.exit_code;return{title:e.timelineMetadata?.signal?`后台子任务已终止`:t==null?`后台子任务已结束`:Number(t)===0?`后台子任务已完成`:`后台子任务失败`,icon:`tools`}}if(e.role!==`system`&&e.timelineKind!==`system`)return;let t=e.content.trim();if(e.timelineMetadata?.eventKind===`compaction`||/^\[context compaction/i.test(t))return{title:`上下文已压缩`,icon:`archive`};if(/^(?:由管理员分派的子任务|(?:已)?分派(?:了)?(?:终审|子)?任务)/.test(t))return{title:`已分派子任务`,icon:`branch`};if(/^执行失败[::]/.test(t))return{title:/timeout|timed?\s*out|超时|no SSE events/i.test(t)?`响应超时`:`回复暂时中断`,icon:`info`};if(/^(?:回复重点|重点提示)[::]?/.test(t))return{title:`回复重点`,icon:`info`};if(/^(?:任务|子任务).*(?:已完成|完成通知)/.test(t.split(`
|
|
@@ -6,4 +6,4 @@ import{A as e,D as t,F as n,G as r,H as i,L as a,M as o,R as s,W as c,_ as l,a a
|
|
|
6
6
|
`),r].filter(Boolean).join(`
|
|
7
7
|
|
|
8
8
|
`)||r}var Qt=[`aria-label`,`onKeydown`],$t=[`placeholder`,`aria-label`],en=[`aria-label`,`aria-selected`,`tabindex`,`aria-controls`,`onClick`],tn={key:0,class:`floating-resource-search__navigation`,"aria-label":`搜索范围`},nn={key:0,class:`floating-resource-search__navigation-heading`},rn=[`onClick`],an=[`id`,`role`,`aria-label`],on={key:0,class:`floating-resource-search__context`},sn=[`role`],cn={key:0,class:`floating-resource-search__section`},ln=[`role`],un=[`role`,`aria-haspopup`,`onClick`],dn={key:0,class:`floating-resource-search__icon floating-resource-search__icon--avatar`},fn={key:1,class:`floating-resource-search__icon`},pn={class:`floating-resource-search__copy`},mn={key:0},hn={key:2},gn={key:0},_n=`hermes-yaoyao:sidebar-search`,vn=`hermes-yaoyao:sidebar-search-close`,yn=C(E({__name:`FloatingResourceSearch`,props:{section:{},label:{},items:{},split:{type:Boolean,default:!1},tabbed:{type:Boolean,default:!1}},emits:[`open`,`select`],setup(c,{emit:u}){let d=c,y=u,S=m(!1),C=m(``),E=m(null),ne=m(null),A=m(null),M=null,N=m(``),P=x(()=>d.items.find(e=>e.id===N.value)),F=x(()=>P.value?.children??d.items),re=x(()=>C.value.trim().toLocaleLowerCase()),I=x(()=>{let e=re.value;return e?F.value.filter(t=>`${t.title} ${t.subtitle||``} ${t.meta||``}`.toLocaleLowerCase().includes(e)).slice(0,50):F.value.slice(0,50)}),L=x(()=>I.value.map((e,t)=>({item:e,hasChildren:e.children!==void 0,showSection:!!(e.section&&e.section!==I.value[t-1]?.section)}))),ie=x(()=>d.items.map((e,t)=>({item:e,showSection:!!(e.section&&e.section!==d.items[t-1]?.section)})));async function ae(e){e.detail?.section===d.section&&(C.value=``,M=document.activeElement instanceof HTMLElement?document.activeElement:null,N.value=(d.split||d.tabbed)&&d.items[0]?.id||``,S.value=!0,y(`open`),await t(),E.value?.focus())}function R(){S.value&&(S.value=!1,C.value=``,N.value=``,document.dispatchEvent(new CustomEvent(vn)),t(()=>{M?.isConnected&&M.focus()}))}async function oe(e){if(e.children!==void 0){N.value=e.id,d.tabbed||(C.value=``,await t(),E.value?.focus());return}y(`select`,e.id),R()}async function se(){N.value=``,C.value=``,await t(),E.value?.focus()}function ce(e){let n=d.items.findIndex(e=>e.id===N.value);N.value=d.items[(n+e+d.items.length)%d.items.length]?.id||``,t(()=>A.value?.querySelector(`[aria-selected="true"]`)?.focus())}function le(e){let t=[...ne.value?.querySelectorAll(`button:not(:disabled),input,[tabindex="0"]`)??[]].filter(e=>e.tabIndex>=0&&e.getClientRects().length>0);t.length&&(e.shiftKey&&document.activeElement===t[0]?(e.preventDefault(),t.at(-1)?.focus()):!e.shiftKey&&document.activeElement===t.at(-1)&&(e.preventDefault(),t[0]?.focus()))}return i(I,async()=>{await t(),S.value&&document.activeElement===document.body&&E.value?.focus()}),o(()=>{document.addEventListener(_n,ae),document.addEventListener(vn,R)}),e(()=>{document.removeEventListener(_n,ae),document.removeEventListener(vn,R)}),(e,t)=>(n(),g(ee,{to:`body`},[S.value?(n(),l(`div`,{key:0,class:`floating-resource-search__backdrop`,onClick:w(R,[`self`])},[v(`section`,{ref_key:`panel`,ref:ne,class:b([`floating-resource-search`,{"floating-resource-search--split":c.split}]),role:`dialog`,"aria-modal":`true`,"aria-label":c.label,onKeydown:[_(le,[`tab`]),_(w(R,[`prevent`]),[`esc`])]},[v(`header`,null,[P.value&&!c.split&&!c.tabbed?(n(),l(`button`,{key:0,class:`floating-resource-search__back`,type:`button`,"aria-label":`返回搜索结果`,onClick:se},[D(O,{name:`chevron-left`,size:17})])):h(``,!0),v(`label`,null,[D(O,{name:`search`,size:18}),r(v(`input`,{ref_key:`input`,ref:E,"onUpdate:modelValue":t[0]||=e=>C.value=e,type:`search`,placeholder:c.tabbed?`搜索聊天名称或内容`:P.value?`搜索${P.value.title}`:c.label,"aria-label":c.tabbed?c.label:P.value?`搜索${P.value.title}`:c.label,onKeydown:t[1]||=_(w(e=>c.split||c.tabbed?R():P.value?se():R(),[`stop`,`prevent`]),[`esc`])},null,40,$t),[[te,C.value]])]),v(`button`,{type:`button`,"aria-label":`关闭搜索`,title:`关闭搜索`,onClick:R},[D(O,{name:`close`,size:17})])]),c.tabbed?(n(),l(`nav`,{key:0,ref_key:`categories`,ref:A,class:`floating-resource-search__tabs`,role:`tablist`,"aria-label":`聊天分类`,onKeydown:[t[2]||=_(w(e=>ce(-1),[`prevent`]),[`left`]),t[3]||=_(w(e=>ce(1),[`prevent`]),[`right`])]},[(n(!0),l(p,null,a(c.items,e=>(n(),l(`button`,{key:e.id,type:`button`,role:`tab`,"aria-label":e.title,"aria-selected":e.id===N.value,tabindex:e.id===N.value?0:-1,"aria-controls":`${c.section}-search-results`,onClick:t=>oe(e)},[T(f(e.title),1),v(`small`,null,f(e.children?.length??0),1)],8,en))),128))],544)):h(``,!0),v(`div`,{class:b([`floating-resource-search__body`,{"floating-resource-search__body--split":c.split}])},[c.split?(n(),l(`nav`,tn,[(n(!0),l(p,null,a(ie.value,e=>(n(),l(p,{key:e.item.id},[e.showSection?(n(),l(`div`,nn,f(e.item.section),1)):h(``,!0),v(`button`,{type:`button`,class:b({active:e.item.id===N.value}),onClick:t=>oe(e.item)},[e.item.icon?(n(),g(O,{key:0,name:e.item.icon,size:15},null,8,[`name`])):h(``,!0),v(`span`,null,f(e.item.title),1)],10,rn)],64))),128))])):h(``,!0),v(`section`,{id:`${c.section}-search-results`,class:`floating-resource-search__result-pane`,role:c.tabbed?`tabpanel`:void 0,"aria-label":c.tabbed?P.value?.title:void 0},[P.value&&!c.tabbed?(n(),l(`div`,on,[v(`strong`,null,f(P.value.title),1),v(`span`,null,f(P.value.subtitle),1)])):h(``,!0),v(`div`,{class:`floating-resource-search__results`,role:e.$slots[`item-actions`]?`list`:`listbox`,"aria-label":`搜索结果`},[(n(!0),l(p,null,a(L.value,t=>(n(),l(p,{key:t.item.id},[t.showSection?(n(),l(`div`,cn,f(t.item.section),1)):h(``,!0),v(`div`,{class:`floating-resource-search__row`,role:e.$slots[`item-actions`]?`listitem`:`presentation`},[v(`button`,{class:`floating-resource-search__select`,type:`button`,role:e.$slots[`item-actions`]?void 0:`option`,"aria-haspopup":t.hasChildren?`listbox`:void 0,onClick:e=>oe(t.item)},[t.item.avatar!==void 0||t.item.avatarMembers?.length?(n(),l(`span`,dn,[t.item.avatarKind===`agent`?(n(),g(k,{key:0,name:t.item.title,avatar:t.item.avatar,state:t.item.avatarState,size:30},null,8,[`name`,`avatar`,`state`])):(n(),g(j,{key:1,name:t.item.title,avatar:t.item.avatar||``,members:t.item.avatarMembers||[],"fallback-key":t.item.avatarFallbackKey||t.item.id,size:30},null,8,[`name`,`avatar`,`members`,`fallback-key`]))])):t.item.icon?(n(),l(`span`,fn,[D(O,{name:t.item.icon,size:16},null,8,[`name`])])):h(``,!0),v(`span`,pn,[v(`strong`,null,f(t.item.title),1),t.item.subtitle?(n(),l(`small`,mn,f(t.item.subtitle),1)):h(``,!0)]),t.item.meta?(n(),l(`small`,hn,f(t.item.meta),1)):h(``,!0)],8,un),s(e.$slots,`item-actions`,{item:t.item},void 0,!0)],8,ln)],64))),128)),I.value.length?h(``,!0):(n(),l(`p`,gn,f(P.value?.emptyText||(P.value?`暂无${P.value.title}内容`:`没有匹配结果`)),1))],8,sn)],8,an)],2),s(e.$slots,`footer`,{},void 0,!0)],42,Qt)])):h(``,!0)]))}}),[[`__scopeId`,`data-v-171c037c`]]);export{V as _,Rt as a,gt as c,J as d,ft as f,H as g,W as h,Ht as i,mt as l,rt as m,Zt as n,Pt as o,q as p,qt as r,yt as s,yn as t,X as u,z as v};
|
|
9
|
-
//# sourceMappingURL=FloatingResourceSearch-
|
|
9
|
+
//# sourceMappingURL=FloatingResourceSearch-c6l1JuAA.js.map
|