File size: 1,853 Bytes
6cdce85
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
export type TaskType = 'function_completion' | 'code_generation' | 'qa';

export type Category =
  | 'circuits_and_gates'
  | 'quantum_info_and_operators'
  | 'algorithms_and_applications'
  | 'hardware_and_providers'
  | 'transpilation_and_compilation'
  | 'primitives_and_execution'
  | 'noise_and_error_mitigation';

export interface DatasetExample {
  id: string;
  question: string;
  answer: string;
  type: TaskType;
  category: Category;
  imageUrl?: string;
  hasImage: boolean;
  testCode?: string;
  entryPoint?: string;
  source: string;
}

export interface CodingProblem extends DatasetExample {
  testCode: string;
  entryPoint: string;
}

export interface Message {
  id: string;
  role: 'user' | 'assistant' | 'system';
  content: string;
  imageUrl?: string;
  imageBase64?: string;
  timestamp: Date;
  isLoading?: boolean;
}

export interface ChatRequest {
  messages: Array<{
    role: string;
    content: string | Array<{ type: string; text?: string; image_url?: { url: string } }>;
  }>;
  image?: string;
}

export interface ChatResponse {
  content: string;
  error?: string;
}

export interface ModelConfig {
  baseUrl: string;
  modelName: string;
  apiKey: string;
  maxTokens: number;
  temperature: number;
  timeout: number;
}

export interface ExecuteRequest {
  code: string;
  timeout?: number;
}

export interface ExecuteResponse {
  success: boolean;
  output: string;
  error: string;
  executionTime: number;
  hasCircuitOutput?: boolean;
}

export interface TestResult {
  passed: boolean;
  total: number;
  failed: number;
  details: TestCaseResult[];
  executionTime: number;
  error?: string;
  traceback?: string;
  output?: string;
}

export interface TestCaseResult {
  name: string;
  passed: boolean;
  expected?: string;
  actual?: string;
  error?: string;
}

export type AppMode = 'chat' | 'practice';