Files
sionrui/frontend/app/web-gold/src/components/agents/ChatDrawerHeader.vue
sion123 eaef9a0e4c
Some checks failed
Build and Deploy / deploy (push) Has been cancelled
feat(agent): 支持自建风格与智能体双模式对话系统
- 新增 `source` 字段区分智能体(`agent`)与自建风格(`prompt`)两种对话来源
- 前端统一对话组件,根据来源动态构建请求参数、显示不同样式与文案
- 后端重构 Dify 会话与消息获取逻辑,支持合并查询 Pro 与 Standard 两个 Dify App 的会话历史
- 实现复合游标分页机制,支持跨双数据源的高效分页
- 新增 `clipboard-polyfill` 依赖,统一剪贴板复制功能,提升非 HTTPS 环境兼容性
- 扩展历史记录面板,支持按来源加载对应会话与消息
- 调整侧边抽屉宽度,优化大屏显示体验
2026-04-11 18:13:08 +08:00

56 lines
1.8 KiB
Vue

<script setup>
import { computed } from 'vue'
import { Icon } from '@iconify/vue'
import { Button } from '@/components/ui/button'
const props = defineProps({
agent: { type: Object, default: null }
})
const emit = defineEmits(['history'])
const isPromptScene = computed(() => props.agent?.source === 'prompt')
const openHistory = () => emit('history')
</script>
<template>
<div class="flex items-center justify-between px-4 py-3 border-b border-border/50 shrink-0 bg-gradient-to-r from-background to-muted/30">
<div class="flex items-center gap-3">
<div
class="size-10 rounded-xl flex items-center justify-center overflow-hidden shadow-sm"
:class="isPromptScene
? 'bg-gradient-to-br from-amber-400 to-orange-500 shadow-amber-200/30'
: 'bg-gradient-to-br from-primary to-violet-500 shadow-primary/20'"
>
<img
v-if="agent?.avatar"
:src="agent.avatar"
:alt="agent.name"
class="w-full h-full object-cover"
/>
<Icon v-else :icon="isPromptScene ? 'lucide:sparkles' : 'lucide:bot'" class="text-white text-xl" />
</div>
<div>
<div class="font-semibold text-foreground text-sm">{{ agent?.name || 'AI 助手' }}</div>
<div class="text-xs text-muted-foreground">
<span v-if="isPromptScene" class="inline-flex items-center gap-1">
<Icon icon="lucide:pencil" class="size-3" />
{{ agent?.categoryName || '我的风格' }}
</span>
<span v-else>{{ agent?.categoryName || '通用' }}</span>
</div>
</div>
</div>
<Button
variant="ghost"
size="icon"
class="size-9"
@click="openHistory"
title="历史记录"
>
<Icon icon="lucide:history" class="size-4" />
</Button>
</div>
</template>