feat(agent): 增强 Agent 配置,新增结构化字段与聊天功能支持
This commit is contained in:
1 parent
ac4262cd75
commit
c8ce77199e
183 files changed
+11690
-2300
No files matched your search
@@ -5,7 +5,7 @@
|
||||
* 逻辑:由聊天页面传入当前 Agent、历史记录与用户可用 Agent;通过事件把新会话、切换 Agent、反馈等操作回传给页面。
|
||||
*/
|
||||
<script setup lang="ts">
|
||||
import { onBeforeUnmount, onMounted, ref } from 'vue';
|
||||
import { computed, onBeforeUnmount, onMounted, ref } from 'vue';
|
||||
import {
|
||||
BookOpen,
|
||||
Briefcase,
|
||||
@@ -25,6 +25,7 @@ import {
|
||||
} from 'lucide-vue-next';
|
||||
import LocaleToggleButton from '@/shared/components/LocaleToggleButton.vue';
|
||||
import AgentCategoryList from '@/shared/components/AgentCategoryList.vue';
|
||||
import { isHrFocusedAgent, type AgentRegistryFields } from '@/shared/utils/agent-registry.utils';
|
||||
import type { AgentWithCategory } from '@/shared/utils/agent-category.utils';
|
||||
import type { DisplayHistoryItem } from '../types/chat.types';
|
||||
|
||||
@@ -33,9 +34,9 @@ export interface ChatSidebarAgent extends AgentWithCategory {}
|
||||
const collapsed = defineModel<boolean>('collapsed', { required: true });
|
||||
const agentPanelOpen = defineModel<boolean>('agentPanelOpen', { required: true });
|
||||
|
||||
const { currentUser } = defineProps<{
|
||||
const props = defineProps<{
|
||||
isOpen: boolean;
|
||||
currentAgent: { name?: string } | null;
|
||||
currentAgent: AgentRegistryFields | null;
|
||||
currentAgentId: number;
|
||||
agentDescription: string;
|
||||
hasAgentGuides: boolean;
|
||||
@@ -95,8 +96,10 @@ const onGoAdmin = () => {
|
||||
emit('go-admin');
|
||||
};
|
||||
|
||||
const agentAvatarLabel = computed(() => (isHrFocusedAgent(props.currentAgent) ? 'HR' : 'AI'));
|
||||
|
||||
const userInitial = (fallback: string) => {
|
||||
const name = String(currentUser?.username ?? '').trim();
|
||||
const name = String(props.currentUser?.username ?? '').trim();
|
||||
return (name || fallback).charAt(0).toUpperCase();
|
||||
};
|
||||
</script>
|
||||
@@ -143,7 +146,7 @@ const userInitial = (fallback: string) => {
|
||||
<div class="flex items-center justify-between p-4">
|
||||
<div class="flex w-full min-w-0 items-center gap-3">
|
||||
<div class="flex h-8 w-8 shrink-0 items-center justify-center rounded-xl bg-gradient-to-br from-brand-500 via-brand-600 to-sky-600 text-sm font-bold text-white shadow-sm shadow-brand-500/25">
|
||||
{{ currentAgent?.name === '人事规章' ? 'HR' : 'AI' }}
|
||||
{{ agentAvatarLabel }}
|
||||
</div>
|
||||
<div class="group relative flex min-w-0 flex-1 flex-col justify-center">
|
||||
<div class="flex items-center gap-2">
|
||||
|
||||
Reference in new issue
Block a user