File size: 2,563 Bytes
8d8a5e1
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120

export enum NodeType {
  SOURCE = 'SOURCE',
  PROCESS = 'PROCESS',
  AI = 'AI',
  UTILITY = 'UTILITY',
  OUTPUT = 'OUTPUT',
  CUSTOM = 'CUSTOM'
}

export type Language = 'en' | 'fr';

export interface NodeDefinition {
  id: string;
  name: string;
  name_fr?: string;
  type: NodeType;
  description: string;
  description_fr?: string;
  category: 'input' | 'transform' | 'ai' | 'utility' | 'output' | 'custom' | 'logic';
  library: 'Core' | 'OpenCV' | 'MediaPipe' | 'Custom' | 'Community' | 'Connectivity' | 'GenAI' | 'Logic';
  pythonClass: string;
  pythonTemplate: string;
  requiredImports?: string[];
  inputs: number;
  outputs: number;
}

export interface Position {
  x: number;
  y: number;
}

export interface ApiConfig {
  url: string;
  method: 'GET' | 'POST' | 'PUT';
  headers: { id: string; key: string; value: string; isSecret: boolean }[];
  timeout: number;
  sendImage: boolean;
  imageResizeWidth?: number;
  asyncMode: boolean;
}

export interface DroidCamConfig {
  ip: string;
  port: string;
}

export interface OnnxConfig {
  modelPath: string;
}

export interface LogicConfig {
  inputKey?: string;
  inputKeyA?: string;
  inputKeyB?: string;
  index?: number;
  operation?: 'add' | 'sub' | 'mul' | 'div' | 'dist';
  comparator?: '>' | '<' | '==' | '!=';
  threshold?: number;
  outputKey: string;
  triggerKey?: string;
}

export interface PipelineNode {
  uuid: string;
  defId: string;
  position: Position;
  params: {
    apiConfig?: ApiConfig;
    droidCam?: DroidCamConfig;
    onnx?: OnnxConfig;
    logic?: LogicConfig;
    [key: string]: any;
  };
}

export interface PipelineConnection {
  id: string;
  sourceNodeId: string;
  targetNodeId: string;
}

export interface Challenge {
  id: string;
  title: string;
  title_fr?: string;
  difficulty: 'Easy' | 'Medium' | 'Hard' | 'Custom';
  theme: 'Basic' | 'Tracking' | 'Segmentation' | 'Optimization' | 'Creative' | 'Community';
  description: string;
  description_fr?: string;
  objectives: string[];
  objectives_fr?: string[];
  locked: boolean;
  isUserCreated?: boolean;
  isCompleted?: boolean;
  completionDate?: string | null;
}

export interface OptimizerConfig {
  resolutionScale: number;
  frameSkip: number;
  useThreading: boolean;
  enableCuda: boolean;
}

export interface ValidationResult {
  success: boolean;
  message: string;
  hint?: string;
}

export interface CppTranspilationResult {
  cppCode: string;
  cmakeCode: string;
  explanation: string;
}

export type ViewState = 'STUDIO' | 'CHALLENGES' | 'EDITOR' | 'CHALLENGE_WORKSPACE' | 'CORRECTOR';