2023-04-22 12:39:27 +00:00
|
|
|
package common
|
|
|
|
|
2024-01-21 15:21:42 +00:00
|
|
|
import "time"
|
2023-04-22 12:39:27 +00:00
|
|
|
|
|
|
|
var StartTime = time.Now().Unix() // unit: second
|
|
|
|
var Version = "v0.0.0" // this hard coding will be replaced automatically when building, no need to manually change
|
2023-09-17 07:39:46 +00:00
|
|
|
|
2023-04-22 12:39:27 +00:00
|
|
|
const (
|
|
|
|
RoleGuestUser = 0
|
|
|
|
RoleCommonUser = 1
|
|
|
|
RoleAdminUser = 10
|
|
|
|
RoleRootUser = 100
|
|
|
|
)
|
|
|
|
|
|
|
|
const (
|
|
|
|
UserStatusEnabled = 1 // don't use 0, 0 is the default value!
|
|
|
|
UserStatusDisabled = 2 // also don't use 0
|
|
|
|
)
|
2023-04-22 14:02:59 +00:00
|
|
|
|
2023-04-23 10:24:11 +00:00
|
|
|
const (
|
2023-04-24 12:52:40 +00:00
|
|
|
TokenStatusEnabled = 1 // don't use 0, 0 is the default value!
|
|
|
|
TokenStatusDisabled = 2 // also don't use 0
|
|
|
|
TokenStatusExpired = 3
|
|
|
|
TokenStatusExhausted = 4
|
2023-04-23 10:24:11 +00:00
|
|
|
)
|
|
|
|
|
2023-04-26 09:02:26 +00:00
|
|
|
const (
|
|
|
|
RedemptionCodeStatusEnabled = 1 // don't use 0, 0 is the default value!
|
|
|
|
RedemptionCodeStatusDisabled = 2 // also don't use 0
|
|
|
|
RedemptionCodeStatusUsed = 3 // also don't use 0
|
|
|
|
)
|
|
|
|
|
2023-04-22 14:02:59 +00:00
|
|
|
const (
|
2023-10-02 05:06:27 +00:00
|
|
|
ChannelStatusUnknown = 0
|
|
|
|
ChannelStatusEnabled = 1 // don't use 0, 0 is the default value!
|
|
|
|
ChannelStatusManuallyDisabled = 2 // also don't use 0
|
|
|
|
ChannelStatusAutoDisabled = 3
|
2023-04-22 14:02:59 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
const (
|
2023-09-03 04:51:59 +00:00
|
|
|
ChannelTypeUnknown = 0
|
|
|
|
ChannelTypeOpenAI = 1
|
|
|
|
ChannelTypeAPI2D = 2
|
|
|
|
ChannelTypeAzure = 3
|
|
|
|
ChannelTypeCloseAI = 4
|
|
|
|
ChannelTypeOpenAISB = 5
|
|
|
|
ChannelTypeOpenAIMax = 6
|
|
|
|
ChannelTypeOhMyGPT = 7
|
|
|
|
ChannelTypeCustom = 8
|
|
|
|
ChannelTypeAILS = 9
|
|
|
|
ChannelTypeAIProxy = 10
|
|
|
|
ChannelTypePaLM = 11
|
|
|
|
ChannelTypeAPI2GPT = 12
|
|
|
|
ChannelTypeAIGC2D = 13
|
|
|
|
ChannelTypeAnthropic = 14
|
|
|
|
ChannelTypeBaidu = 15
|
|
|
|
ChannelTypeZhipu = 16
|
|
|
|
ChannelTypeAli = 17
|
|
|
|
ChannelTypeXunfei = 18
|
|
|
|
ChannelType360 = 19
|
|
|
|
ChannelTypeOpenRouter = 20
|
|
|
|
ChannelTypeAIProxyLibrary = 21
|
2023-09-03 07:50:49 +00:00
|
|
|
ChannelTypeFastGPT = 22
|
2023-10-03 06:19:03 +00:00
|
|
|
ChannelTypeTencent = 23
|
2023-12-17 04:48:32 +00:00
|
|
|
ChannelTypeGemini = 24
|
2024-02-18 08:17:19 +00:00
|
|
|
ChannelTypeMoonshot = 25
|
2024-03-01 16:55:48 +00:00
|
|
|
ChannelTypeBaichuan = 26
|
2024-03-01 17:24:28 +00:00
|
|
|
ChannelTypeMinimax = 27
|
2023-04-22 14:02:59 +00:00
|
|
|
)
|
2023-04-23 10:24:11 +00:00
|
|
|
|
2023-04-23 11:19:43 +00:00
|
|
|
var ChannelBaseURLs = []string{
|
2024-01-21 15:21:42 +00:00
|
|
|
"", // 0
|
|
|
|
"https://api.openai.com", // 1
|
|
|
|
"https://oa.api2d.net", // 2
|
|
|
|
"", // 3
|
|
|
|
"https://api.closeai-proxy.xyz", // 4
|
|
|
|
"https://api.openai-sb.com", // 5
|
|
|
|
"https://api.openaimax.com", // 6
|
|
|
|
"https://api.ohmygpt.com", // 7
|
|
|
|
"", // 8
|
|
|
|
"https://api.caipacity.com", // 9
|
|
|
|
"https://api.aiproxy.io", // 10
|
|
|
|
"https://generativelanguage.googleapis.com", // 11
|
|
|
|
"https://api.api2gpt.com", // 12
|
|
|
|
"https://api.aigc2d.com", // 13
|
|
|
|
"https://api.anthropic.com", // 14
|
|
|
|
"https://aip.baidubce.com", // 15
|
|
|
|
"https://open.bigmodel.cn", // 16
|
|
|
|
"https://dashscope.aliyuncs.com", // 17
|
|
|
|
"", // 18
|
|
|
|
"https://ai.360.cn", // 19
|
|
|
|
"https://openrouter.ai/api", // 20
|
|
|
|
"https://api.aiproxy.io", // 21
|
|
|
|
"https://fastgpt.run/api/openapi", // 22
|
|
|
|
"https://hunyuan.cloud.tencent.com", // 23
|
|
|
|
"https://generativelanguage.googleapis.com", // 24
|
2024-02-18 08:17:19 +00:00
|
|
|
"https://api.moonshot.cn", // 25
|
2024-03-01 16:55:48 +00:00
|
|
|
"https://api.baichuan-ai.com", // 26
|
2024-03-01 17:24:28 +00:00
|
|
|
"https://api.minimax.chat", // 27
|
2023-04-23 10:24:11 +00:00
|
|
|
}
|
2024-02-17 18:22:50 +00:00
|
|
|
|
|
|
|
const (
|
|
|
|
ConfigKeyPrefix = "cfg_"
|
|
|
|
|
|
|
|
ConfigKeyAPIVersion = ConfigKeyPrefix + "api_version"
|
|
|
|
ConfigKeyLibraryID = ConfigKeyPrefix + "library_id"
|
|
|
|
ConfigKeyPlugin = ConfigKeyPrefix + "plugin"
|
|
|
|
)
|