-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathshared.ts
More file actions
124 lines (109 loc) · 2.38 KB
/
shared.ts
File metadata and controls
124 lines (109 loc) · 2.38 KB
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
121
122
123
124
export const NEW_CHAT_ID = 'new';
export class ApiKeyType {
id: string;
type: /*'anthropic' |*/ 'google' | 'openai' | 'xai';
value: string;
constructor(data: ApiKeyType) {
this.id = data.id;
this.type = data.type;
this.value = data.value;
}
static labels = {
// anthropic: 'Anthropic',
google: 'Google',
openai: 'OpenAI',
xai: 'xAI',
} as const;
}
export class ChatType {
id: string;
title: string;
created_at = new Date().toISOString();
constructor(data: Pick<ChatType, 'id' | 'title'>) {
this.id = data.id;
this.title = data.title;
}
}
export class DatabaseType {
id: string;
label: string;
type: 'mysql' | 'postgresql';
context: string;
host: string;
port: string;
user: string;
password: string;
database: string;
constructor(data: DatabaseType) {
this.id = data.id;
this.label = data.label;
this.type = data.type;
this.context = data.context;
this.host = data.host;
this.port = data.port;
this.user = data.user;
this.password = data.password;
this.database = data.database;
}
static labels = {
mysql: 'MySQL',
postgresql: 'Postgres',
} as const;
}
export class MessageType {
id: string;
type: 'prompt' | 'response' | 'results';
text: string;
model: string | null;
chat_id: string;
constructor(data: MessageType) {
this.id = data.id;
this.type = data.type;
this.text = data.text;
this.model = data.model;
this.chat_id = data.chat_id;
}
}
export class SettingType {
id: string;
database_id: string;
api_key_id: string;
model: string;
constructor(data: SettingType) {
this.id = data.id;
this.database_id = data.database_id;
this.api_key_id = data.api_key_id;
this.model = data.model;
}
static models = {
// anthropic: [
// 'claude-3-7-sonnet-20250219', //
// 'claude-3-5-sonnet-20241022', //
// ],
google: [
'gemini-2.5-pro', //
'gemini-2.0-flash', //
],
openai: [
'o4-mini', //
'o3-mini', //
'o3', //
'o1-mini', //
'o1', //
'chatgpt-4o-latest', //
'gpt-4o-mini', //
'gpt-4o', //
'gpt-4.1-nano', //
'gpt-4.1-mini', //
'gpt-4.1', //
'gpt-4-turbo', //
'gpt-4', //
],
xai: [
'grok-3-mini', //
'grok-3-mini-fast', //
'grok-3', //
'grok-3-fast', //
],
} as const;
}