Skip to content

Commit 7406fcc

Browse files
committed
feat:画布点击节点实现AI对话修改
1 parent ab2f9ba commit 7406fcc

13 files changed

Lines changed: 1764 additions & 7 deletions

File tree

packages/canvas/DesignCanvas/src/api/types.ts

Lines changed: 37 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,42 @@ import type { Node, RootNode } from '../../../types'
22

33
export type PageSchema = RootNode
44

5+
export type AIHelperState = 'hidden' | 'chat' | 'loading' | 'confirm' | 'completed'
6+
7+
export interface NodeAIStatus {
8+
state: AIHelperState
9+
aiContext?: any
10+
lastAIAction?: string
11+
aiHistory?: Array<{
12+
timestamp: number
13+
action: string
14+
content: any
15+
}>
16+
chatContent?: string // 聊天内容
17+
pendingConfirmation?: {
18+
title: string
19+
message: string
20+
confirmText?: string
21+
cancelText?: string
22+
data: any // 待确认的数据
23+
}
24+
25+
// AI采纳状态相关字段
26+
originalNodeData?: any // AI修改前的节点数据备份
27+
aiModifiedNodeData?: any // AI修改后的节点数据
28+
adoptionStatus?: AIAdoptionStatus // 采纳状态
29+
aiModificationTime?: number // AI修改时间戳
30+
userDecisionTime?: number // 用户决定时间戳
31+
modificationDescription?: string // 修改描述
32+
}
33+
34+
export type AIAdoptionStatus = 'not_asked' | 'pending' | 'adopted' | 'rejected'
35+
36+
export interface NodeStatus {
37+
[key: string]: any
38+
aiStatus?: NodeAIStatus // 现在包含了所有的AI状态,包括采纳状态
39+
}
40+
541
export interface PageState {
642
currentVm?: unknown
743
currentSchema?: { [x: string]: any; id: string }
@@ -17,7 +53,7 @@ export interface PageState {
1753
isSaved: boolean
1854
isLock: boolean
1955
isBlock: boolean
20-
nodesStatus: Record<string, any>
56+
nodesStatus: Record<string, NodeStatus>
2157
loading: boolean
2258
}
2359

0 commit comments

Comments
 (0)