feat: 重构聊天时间线与附件上传交互
- 管理端和用户中心统一切换到 chatTime 时间线模型,按真实 assistant/tool 时序渲染 - 收紧工具气泡与 JSON 展示样式,保留同气泡内的工具状态更新 - 回形针直接触发文件选择,附件列表上移到输入框上方并补充共享 helper 测试
This commit is contained in:
96
easyflow-ui-admin/packages/types/src/chat-time.ts
Normal file
96
easyflow-ui-admin/packages/types/src/chat-time.ts
Normal file
@@ -0,0 +1,96 @@
|
||||
type ChatTimeTimelineRole = 'assistant' | 'tool' | 'user';
|
||||
type ChatTimeToolStatus = 'TOOL_CALL' | 'TOOL_RESULT';
|
||||
type ChatTimeThinkingStatus = 'end' | 'thinking';
|
||||
|
||||
interface ChatTimeTimelineItemBase {
|
||||
created: number | string;
|
||||
id: string;
|
||||
loading?: boolean;
|
||||
placement: 'end' | 'start';
|
||||
role: ChatTimeTimelineRole;
|
||||
senderName?: string;
|
||||
typing?: boolean;
|
||||
}
|
||||
|
||||
interface ChatTimeAssistantThinkingSegment {
|
||||
content: string;
|
||||
expanded: boolean;
|
||||
id: string;
|
||||
status: ChatTimeThinkingStatus;
|
||||
type: 'thinking';
|
||||
}
|
||||
|
||||
interface ChatTimeAssistantTextSegment {
|
||||
content: string;
|
||||
id: string;
|
||||
type: 'text';
|
||||
}
|
||||
|
||||
type ChatTimeAssistantSegment =
|
||||
| ChatTimeAssistantTextSegment
|
||||
| ChatTimeAssistantThinkingSegment;
|
||||
|
||||
interface ChatTimeAssistantItem extends ChatTimeTimelineItemBase {
|
||||
content: string;
|
||||
role: 'assistant';
|
||||
segments: ChatTimeAssistantSegment[];
|
||||
}
|
||||
|
||||
interface ChatTimeToolItem extends ChatTimeTimelineItemBase {
|
||||
arguments?: string;
|
||||
content: string;
|
||||
name: string;
|
||||
result?: string;
|
||||
role: 'tool';
|
||||
status: ChatTimeToolStatus;
|
||||
toolCallId: string;
|
||||
}
|
||||
|
||||
interface ChatTimeUserItem extends ChatTimeTimelineItemBase {
|
||||
content: string;
|
||||
role: 'user';
|
||||
}
|
||||
|
||||
type ChatTimeTimelineItem =
|
||||
| ChatTimeAssistantItem
|
||||
| ChatTimeToolItem
|
||||
| ChatTimeUserItem;
|
||||
|
||||
interface ChatTimeHistoryRecord {
|
||||
chains?: Array<Record<string, any>>;
|
||||
content?: string;
|
||||
contentPayload?: null | Record<string, any>;
|
||||
contentText?: string;
|
||||
created?: number | string;
|
||||
id?: number | string;
|
||||
loading?: boolean;
|
||||
placement?: 'end' | 'start';
|
||||
role?: string;
|
||||
senderName?: string;
|
||||
senderRole?: string;
|
||||
typing?: boolean;
|
||||
}
|
||||
|
||||
interface ChatTimeToolMutationPayload {
|
||||
created?: number | string;
|
||||
name?: string;
|
||||
result?: any;
|
||||
toolCallId?: string;
|
||||
value?: any;
|
||||
}
|
||||
|
||||
export type {
|
||||
ChatTimeAssistantItem,
|
||||
ChatTimeAssistantSegment,
|
||||
ChatTimeAssistantTextSegment,
|
||||
ChatTimeAssistantThinkingSegment,
|
||||
ChatTimeHistoryRecord,
|
||||
ChatTimeThinkingStatus,
|
||||
ChatTimeTimelineItem,
|
||||
ChatTimeTimelineItemBase,
|
||||
ChatTimeTimelineRole,
|
||||
ChatTimeToolItem,
|
||||
ChatTimeToolMutationPayload,
|
||||
ChatTimeToolStatus,
|
||||
ChatTimeUserItem,
|
||||
};
|
||||
@@ -1,4 +1,5 @@
|
||||
export type * from './api';
|
||||
export type * from './bot';
|
||||
export type * from './chat-time';
|
||||
export type * from './user';
|
||||
export type * from '@easyflow-core/typings';
|
||||
|
||||
Reference in New Issue
Block a user