feat: add TypeScript types for editor-embedded AI
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
62
frontend/src/types/editor-ai.ts
Normal file
62
frontend/src/types/editor-ai.ts
Normal file
@@ -0,0 +1,62 @@
|
|||||||
|
export type AIActionType =
|
||||||
|
| 'generate_full'
|
||||||
|
| 'generate_branch'
|
||||||
|
| 'modify_node'
|
||||||
|
| 'add_steps'
|
||||||
|
| 'quick_action'
|
||||||
|
| 'open_chat'
|
||||||
|
| 'variable_inference'
|
||||||
|
|
||||||
|
export interface AIDelta {
|
||||||
|
action: 'add' | 'modify' | 'delete'
|
||||||
|
target_node_id: string
|
||||||
|
nodes: Record<string, unknown>[]
|
||||||
|
explanation: string
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface AISuggestion {
|
||||||
|
id: string
|
||||||
|
action_type: AIActionType
|
||||||
|
target_node_id: string | null
|
||||||
|
changes_json: {
|
||||||
|
before?: Record<string, unknown>
|
||||||
|
after?: Record<string, unknown>
|
||||||
|
delta?: AIDelta
|
||||||
|
}
|
||||||
|
status: 'pending' | 'accepted' | 'dismissed'
|
||||||
|
created_at: string
|
||||||
|
resolved_at: string | null
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface EditorAIChatMessage {
|
||||||
|
role: 'user' | 'assistant'
|
||||||
|
content: string
|
||||||
|
timestamp: string
|
||||||
|
action_type?: AIActionType
|
||||||
|
delta?: AIDelta
|
||||||
|
knowledge?: KnowledgeCitation[]
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface KnowledgeCitation {
|
||||||
|
title: string
|
||||||
|
url: string
|
||||||
|
excerpt: string
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface ContextMenuAction {
|
||||||
|
id: string
|
||||||
|
label: string
|
||||||
|
icon: string
|
||||||
|
action_type: AIActionType
|
||||||
|
description?: string
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface ContextMenuPosition {
|
||||||
|
x: number
|
||||||
|
y: number
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface SuggestionMarker {
|
||||||
|
_suggestion?: true
|
||||||
|
_suggestion_id?: string
|
||||||
|
}
|
||||||
@@ -71,3 +71,14 @@ export type {
|
|||||||
FlowExportCategory,
|
FlowExportCategory,
|
||||||
FlowImportResponse,
|
FlowImportResponse,
|
||||||
} from './flowTransfer'
|
} from './flowTransfer'
|
||||||
|
|
||||||
|
export type {
|
||||||
|
AIActionType,
|
||||||
|
AIDelta,
|
||||||
|
AISuggestion,
|
||||||
|
EditorAIChatMessage,
|
||||||
|
KnowledgeCitation,
|
||||||
|
ContextMenuAction,
|
||||||
|
ContextMenuPosition,
|
||||||
|
SuggestionMarker,
|
||||||
|
} from './editor-ai'
|
||||||
|
|||||||
Reference in New Issue
Block a user