forked from QuantumNous/new-api
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathconstants.ts
More file actions
103 lines (89 loc) · 2.94 KB
/
Copy pathconstants.ts
File metadata and controls
103 lines (89 loc) · 2.94 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
/*
Copyright (C) 2023-2026 QuantumNous
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as
published by the Free Software Foundation, either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
For commercial licensing, please contact support@quantumnous.com
*/
import type { PlaygroundConfig, ParameterEnabled } from './types'
// Message constants
export const MESSAGE_ROLES = {
USER: 'user',
ASSISTANT: 'assistant',
SYSTEM: 'system',
} as const
export const MESSAGE_STATUS = {
LOADING: 'loading',
STREAMING: 'streaming',
COMPLETE: 'complete',
ERROR: 'error',
} as const
// API endpoints
export const API_ENDPOINTS = {
CHAT_COMPLETIONS: '/pg/chat/completions',
USER_MODELS: '/api/user/models',
USER_GROUPS: '/api/user/self/groups',
} as const
// Default group — uses 'default' as the safe fallback; auto-group is
// only selected when the backend confirms it is available for the user.
export const DEFAULT_GROUP = 'default' as const
// Default configuration
export const DEFAULT_CONFIG: PlaygroundConfig = {
model: 'gpt-4o',
group: DEFAULT_GROUP,
temperature: 0.7,
top_p: 1,
max_tokens: 4096,
frequency_penalty: 0,
presence_penalty: 0,
seed: null,
stream: true,
}
export const DEFAULT_PARAMETER_ENABLED: ParameterEnabled = {
temperature: true,
top_p: true,
max_tokens: false,
frequency_penalty: true,
presence_penalty: true,
seed: false,
}
// Storage keys
export const STORAGE_KEYS = {
CONFIG: 'playground_config',
MESSAGES: 'playground_messages',
PARAMETER_ENABLED: 'playground_parameter_enabled',
} as const
// Error messages
export const ERROR_MESSAGES = {
API_REQUEST_ERROR: 'Request error occurred',
NETWORK_ERROR: 'Network connection failed or server not responding',
PARSE_ERROR: 'Error parsing response data',
STREAM_START_ERROR: 'Error establishing connection',
CONNECTION_CLOSED: 'Connection closed',
INTERRUPTED: 'Generation was interrupted',
} as const
// Message action button styles
export const MESSAGE_ACTION_BUTTON_STYLES = {
BASE: 'size-7 text-muted-foreground hover:text-foreground',
DELETE: 'size-7 text-muted-foreground hover:text-destructive',
ICON: 'size-4',
} as const
// Message action labels
export const MESSAGE_ACTION_LABELS = {
COPY: 'Copy',
COPIED: 'Copied!',
REGENERATE: 'Regenerate',
SHOW_PREVIEW: 'Show preview',
SHOW_SOURCE: 'Show source',
EDIT: 'Edit',
DELETE: 'Delete',
NO_CONTENT: 'No content to copy',
WAIT_GENERATION: 'Please wait for the current generation to complete',
} as const