chore: import clean Agent Desk snapshot (2/7)
This commit is contained in:
59
internal/pkg/enums/agent.go
Normal file
59
internal/pkg/enums/agent.go
Normal file
@@ -0,0 +1,59 @@
|
||||
package enums
|
||||
|
||||
type AgentRunResolutionStatus string
|
||||
|
||||
const (
|
||||
AgentRunResolutionStatusUnknown AgentRunResolutionStatus = "unknown"
|
||||
AgentRunResolutionStatusResolved AgentRunResolutionStatus = "resolved"
|
||||
AgentRunResolutionStatusUnresolved AgentRunResolutionStatus = "unresolved"
|
||||
)
|
||||
|
||||
var AgentRunResolutionStatusValues = []AgentRunResolutionStatus{
|
||||
AgentRunResolutionStatusUnknown,
|
||||
AgentRunResolutionStatusResolved,
|
||||
AgentRunResolutionStatusUnresolved,
|
||||
}
|
||||
|
||||
type AgentRunEvidenceStatus string
|
||||
|
||||
const (
|
||||
AgentRunEvidenceStatusUnknown AgentRunEvidenceStatus = "unknown"
|
||||
AgentRunEvidenceStatusSupported AgentRunEvidenceStatus = "supported"
|
||||
AgentRunEvidenceStatusUnsupported AgentRunEvidenceStatus = "unsupported"
|
||||
)
|
||||
|
||||
var AgentRunEvidenceStatusValues = []AgentRunEvidenceStatus{
|
||||
AgentRunEvidenceStatusUnknown,
|
||||
AgentRunEvidenceStatusSupported,
|
||||
AgentRunEvidenceStatusUnsupported,
|
||||
}
|
||||
|
||||
type ServiceStatus int
|
||||
|
||||
const (
|
||||
ServiceStatusIdle ServiceStatus = 0
|
||||
ServiceStatusBusy ServiceStatus = 1
|
||||
)
|
||||
|
||||
var ServiceStatusValues = []ServiceStatus{
|
||||
ServiceStatusIdle,
|
||||
ServiceStatusBusy,
|
||||
}
|
||||
|
||||
var serviceStatusLabelMap = map[ServiceStatus]string{
|
||||
ServiceStatusIdle: "空闲",
|
||||
ServiceStatusBusy: "忙碌",
|
||||
}
|
||||
|
||||
func IsValidServiceStatus(status ServiceStatus) bool {
|
||||
for _, item := range ServiceStatusValues {
|
||||
if item == status {
|
||||
return true
|
||||
}
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
func GetServiceStatusLabel(status ServiceStatus) string {
|
||||
return serviceStatusLabelMap[status]
|
||||
}
|
||||
33
internal/pkg/enums/ai.go
Normal file
33
internal/pkg/enums/ai.go
Normal file
@@ -0,0 +1,33 @@
|
||||
package enums
|
||||
|
||||
type AIProvider string
|
||||
|
||||
const (
|
||||
AIProviderOpenAI AIProvider = "openai"
|
||||
)
|
||||
|
||||
var aiProviderLabelMap = map[AIProvider]string{
|
||||
AIProviderOpenAI: "OpenAI",
|
||||
}
|
||||
|
||||
func GetAIProviderLabel(provider AIProvider) string {
|
||||
return aiProviderLabelMap[provider]
|
||||
}
|
||||
|
||||
type AIModelType string
|
||||
|
||||
const (
|
||||
AIModelTypeLLM AIModelType = "llm"
|
||||
AIModelTypeEmbedding AIModelType = "embedding"
|
||||
AIModelTypeRerank AIModelType = "rerank"
|
||||
)
|
||||
|
||||
var aiModelTypeLabelMap = map[AIModelType]string{
|
||||
AIModelTypeLLM: "大语言模型",
|
||||
AIModelTypeEmbedding: "向量模型",
|
||||
AIModelTypeRerank: "重排序模型",
|
||||
}
|
||||
|
||||
func GetAIModelTypeLabel(modelType AIModelType) string {
|
||||
return aiModelTypeLabelMap[modelType]
|
||||
}
|
||||
37
internal/pkg/enums/asset.go
Normal file
37
internal/pkg/enums/asset.go
Normal file
@@ -0,0 +1,37 @@
|
||||
package enums
|
||||
|
||||
type AssetStatus int
|
||||
|
||||
const (
|
||||
AssetStatusPending AssetStatus = 1
|
||||
AssetStatusSuccess AssetStatus = 2
|
||||
AssetStatusFailed AssetStatus = 3
|
||||
AssetStatusDeleted AssetStatus = 4
|
||||
)
|
||||
|
||||
var assetStatusLabelMap = map[AssetStatus]string{
|
||||
AssetStatusPending: "处理中",
|
||||
AssetStatusSuccess: "成功",
|
||||
AssetStatusFailed: "失败",
|
||||
AssetStatusDeleted: "已删除",
|
||||
}
|
||||
|
||||
func GetAssetStatusLabel(status AssetStatus) string {
|
||||
return assetStatusLabelMap[status]
|
||||
}
|
||||
|
||||
type AssetProvider string
|
||||
|
||||
const (
|
||||
AssetProviderLocal AssetProvider = "local"
|
||||
AssetProviderOSS AssetProvider = "oss"
|
||||
)
|
||||
|
||||
var assetProviderLabelMap = map[AssetProvider]string{
|
||||
AssetProviderLocal: "本地存储",
|
||||
AssetProviderOSS: "对象存储",
|
||||
}
|
||||
|
||||
func GetAssetProviderLabel(provider AssetProvider) string {
|
||||
return assetProviderLabelMap[provider]
|
||||
}
|
||||
20
internal/pkg/enums/channel_type.go
Normal file
20
internal/pkg/enums/channel_type.go
Normal file
@@ -0,0 +1,20 @@
|
||||
package enums
|
||||
|
||||
type ChannelMessageOutboxStatus string
|
||||
|
||||
const (
|
||||
ChannelMessageOutboxStatusPending ChannelMessageOutboxStatus = "pending"
|
||||
ChannelMessageOutboxStatusSending ChannelMessageOutboxStatus = "sending"
|
||||
ChannelMessageOutboxStatusSent ChannelMessageOutboxStatus = "sent"
|
||||
ChannelMessageOutboxStatusFailed ChannelMessageOutboxStatus = "failed"
|
||||
ChannelMessageOutboxStatusIgnored ChannelMessageOutboxStatus = "ignored"
|
||||
)
|
||||
|
||||
const (
|
||||
ChannelTypeWeb = "web"
|
||||
ChannelTypeTelegram = "telegram"
|
||||
ChannelTypeZaloOA = "zalo_oa"
|
||||
ChannelTypeSlack = "slack"
|
||||
ChannelTypeDiscord = "discord"
|
||||
ChannelTypeEmail = "email"
|
||||
)
|
||||
36
internal/pkg/enums/customer.go
Normal file
36
internal/pkg/enums/customer.go
Normal file
@@ -0,0 +1,36 @@
|
||||
package enums
|
||||
|
||||
const CustomerSourceTypeWebChat = ExternalSourceGuest
|
||||
|
||||
func GetCustomerSourceTypeLabel(sourceType ExternalSource) string {
|
||||
return GetExternalSourceLabel(ExternalSource(sourceType))
|
||||
}
|
||||
|
||||
// 联系方式类型
|
||||
type ContactType string
|
||||
|
||||
const (
|
||||
ContactTypeMobile ContactType = "mobile"
|
||||
ContactTypeEmail ContactType = "email"
|
||||
ContactTypeOther ContactType = "other"
|
||||
)
|
||||
|
||||
var contactTypeLabelMap = map[ContactType]string{
|
||||
ContactTypeMobile: "手机号",
|
||||
ContactTypeEmail: "邮箱",
|
||||
ContactTypeOther: "其他",
|
||||
}
|
||||
|
||||
func GetContactTypeLabel(contactType ContactType) string {
|
||||
return contactTypeLabelMap[contactType]
|
||||
}
|
||||
|
||||
// IsValidContactType 判断字符串是否为合法联系方式类型。
|
||||
func IsValidContactType(v string) bool {
|
||||
switch ContactType(v) {
|
||||
case ContactTypeMobile, ContactTypeEmail, ContactTypeOther:
|
||||
return true
|
||||
default:
|
||||
return false
|
||||
}
|
||||
}
|
||||
84
internal/pkg/enums/enums.go
Normal file
84
internal/pkg/enums/enums.go
Normal file
@@ -0,0 +1,84 @@
|
||||
package enums
|
||||
|
||||
type Status int
|
||||
|
||||
const (
|
||||
StatusOk Status = 0
|
||||
StatusDisabled Status = 1
|
||||
StatusDeleted Status = 2
|
||||
)
|
||||
|
||||
var StatusValues = []Status{StatusOk, StatusDisabled, StatusDeleted}
|
||||
|
||||
var statusLabelMap = map[Status]string{
|
||||
StatusOk: "启用",
|
||||
StatusDisabled: "禁用",
|
||||
StatusDeleted: "已删除",
|
||||
}
|
||||
|
||||
func GetStatusLabel(status Status) string {
|
||||
return statusLabelMap[status]
|
||||
}
|
||||
|
||||
func IsValidStatus(status int) bool {
|
||||
for _, s := range StatusValues {
|
||||
if int(s) == status {
|
||||
return true
|
||||
}
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
type Gender int
|
||||
|
||||
const (
|
||||
GenderUnknown Gender = 0
|
||||
GenderMale Gender = 1
|
||||
GenderFemale Gender = 2
|
||||
)
|
||||
|
||||
var GenderValues = []Gender{GenderUnknown, GenderMale, GenderFemale}
|
||||
|
||||
var genderLabelMap = map[Gender]string{
|
||||
GenderUnknown: "未知",
|
||||
GenderMale: "男",
|
||||
GenderFemale: "女",
|
||||
}
|
||||
|
||||
func GetGenderLabel(gender Gender) string {
|
||||
return genderLabelMap[gender]
|
||||
}
|
||||
|
||||
func IsValidGender(gender int) bool {
|
||||
for _, g := range GenderValues {
|
||||
if int(g) == gender {
|
||||
return true
|
||||
}
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
type ThirdProvider string
|
||||
|
||||
const (
|
||||
ThirdProviderOIDC ThirdProvider = "oidc"
|
||||
)
|
||||
|
||||
var ThirdProviderValues = []ThirdProvider{ThirdProviderOIDC}
|
||||
|
||||
var thirdProviderLabelMap = map[ThirdProvider]string{
|
||||
ThirdProviderOIDC: "OIDC",
|
||||
}
|
||||
|
||||
func GetThirdProviderLabel(provider ThirdProvider) string {
|
||||
return thirdProviderLabelMap[provider]
|
||||
}
|
||||
|
||||
func IsValidThirdProvider(provider string) bool {
|
||||
for _, p := range ThirdProviderValues {
|
||||
if string(p) == provider {
|
||||
return true
|
||||
}
|
||||
}
|
||||
return false
|
||||
}
|
||||
33
internal/pkg/enums/external_identity.go
Normal file
33
internal/pkg/enums/external_identity.go
Normal file
@@ -0,0 +1,33 @@
|
||||
package enums
|
||||
|
||||
// ExternalSource 外部身份来源。
|
||||
//
|
||||
// 与 ExternalID 组合即可唯一标识某渠道下的访客身份。
|
||||
type ExternalSource string
|
||||
|
||||
const (
|
||||
ExternalSourceGuest ExternalSource = "guest" // 访客
|
||||
ExternalSourceUser ExternalSource = "user" // 用户信息
|
||||
ExternalSourceTelegram ExternalSource = "telegram" // Telegram
|
||||
ExternalSourceZaloOA ExternalSource = "zalo_oa" // Zalo OA
|
||||
ExternalSourceSlack ExternalSource = "slack" // Slack
|
||||
ExternalSourceDiscord ExternalSource = "discord" // Discord
|
||||
ExternalSourceEmail ExternalSource = "email" // Email
|
||||
)
|
||||
|
||||
var externalSourceLabelMap = map[ExternalSource]string{
|
||||
ExternalSourceGuest: "访客",
|
||||
ExternalSourceUser: "用户",
|
||||
ExternalSourceTelegram: "Telegram",
|
||||
ExternalSourceZaloOA: "Zalo OA",
|
||||
ExternalSourceSlack: "Slack",
|
||||
ExternalSourceDiscord: "Discord",
|
||||
ExternalSourceEmail: "Email",
|
||||
}
|
||||
|
||||
func GetExternalSourceLabel(v ExternalSource) string {
|
||||
if s, ok := externalSourceLabelMap[v]; ok {
|
||||
return s
|
||||
}
|
||||
return string(v)
|
||||
}
|
||||
274
internal/pkg/enums/im.go
Normal file
274
internal/pkg/enums/im.go
Normal file
@@ -0,0 +1,274 @@
|
||||
package enums
|
||||
|
||||
type IMConversationStatus int
|
||||
|
||||
const (
|
||||
IMConversationStatusAIServing IMConversationStatus = 1
|
||||
IMConversationStatusPending IMConversationStatus = 2
|
||||
IMConversationStatusActive IMConversationStatus = 3
|
||||
IMConversationStatusClosed IMConversationStatus = 4
|
||||
)
|
||||
|
||||
var imConversationStatusLabelMap = map[IMConversationStatus]string{
|
||||
IMConversationStatusAIServing: "AI接待中",
|
||||
IMConversationStatusPending: "待接入",
|
||||
IMConversationStatusActive: "处理中",
|
||||
IMConversationStatusClosed: "已关闭",
|
||||
}
|
||||
|
||||
var IMConversationStatusValues = []IMConversationStatus{
|
||||
IMConversationStatusAIServing,
|
||||
IMConversationStatusPending,
|
||||
IMConversationStatusActive,
|
||||
IMConversationStatusClosed,
|
||||
}
|
||||
|
||||
func GetIMConversationStatusLabel(status IMConversationStatus) string {
|
||||
return imConversationStatusLabelMap[status]
|
||||
}
|
||||
|
||||
type IMConversationServiceMode int
|
||||
|
||||
const (
|
||||
IMConversationServiceModeAIOnly IMConversationServiceMode = 1
|
||||
IMConversationServiceModeHumanOnly IMConversationServiceMode = 2
|
||||
IMConversationServiceModeAIFirst IMConversationServiceMode = 3
|
||||
)
|
||||
|
||||
var IMConversationServiceModeValues = []IMConversationServiceMode{
|
||||
IMConversationServiceModeAIOnly,
|
||||
IMConversationServiceModeHumanOnly,
|
||||
IMConversationServiceModeAIFirst,
|
||||
}
|
||||
|
||||
var imConversationServiceModeLabelMap = map[IMConversationServiceMode]string{
|
||||
IMConversationServiceModeAIOnly: "仅AI",
|
||||
IMConversationServiceModeHumanOnly: "仅人工",
|
||||
IMConversationServiceModeAIFirst: "AI优先",
|
||||
}
|
||||
|
||||
func GetIMConversationServiceModeLabel(mode IMConversationServiceMode) string {
|
||||
return imConversationServiceModeLabelMap[mode]
|
||||
}
|
||||
|
||||
type IMSenderType string
|
||||
|
||||
const (
|
||||
IMSenderTypeAgent IMSenderType = "agent" // 客服
|
||||
IMSenderTypeCustomer IMSenderType = "customer" // 客户
|
||||
IMSenderTypeAI IMSenderType = "ai" // AI
|
||||
IMSenderTypeSystem IMSenderType = "system" // 系统
|
||||
)
|
||||
|
||||
var imSenderTypeLabelMap = map[IMSenderType]string{
|
||||
IMSenderTypeAgent: "客服",
|
||||
IMSenderTypeCustomer: "客户",
|
||||
IMSenderTypeAI: "AI",
|
||||
IMSenderTypeSystem: "系统",
|
||||
}
|
||||
|
||||
func GetIMSenderTypeLabel(senderType IMSenderType) string {
|
||||
return imSenderTypeLabelMap[senderType]
|
||||
}
|
||||
|
||||
type IMParticipantType string
|
||||
|
||||
const (
|
||||
IMParticipantTypeCustomer IMParticipantType = "customer"
|
||||
IMParticipantTypeAgent IMParticipantType = "agent"
|
||||
IMParticipantTypeAI IMParticipantType = "ai"
|
||||
IMParticipantTypeSystem IMParticipantType = "system"
|
||||
)
|
||||
|
||||
var imParticipantTypeLabelMap = map[IMParticipantType]string{
|
||||
IMParticipantTypeCustomer: "客户",
|
||||
IMParticipantTypeAgent: "客服",
|
||||
IMParticipantTypeAI: "AI",
|
||||
IMParticipantTypeSystem: "系统",
|
||||
}
|
||||
|
||||
func GetIMParticipantTypeLabel(participantType IMParticipantType) string {
|
||||
return imParticipantTypeLabelMap[participantType]
|
||||
}
|
||||
|
||||
type IMAssignmentType string
|
||||
|
||||
const (
|
||||
IMAssignmentTypeAssign IMAssignmentType = "assign"
|
||||
IMAssignmentTypeTransfer IMAssignmentType = "transfer"
|
||||
)
|
||||
|
||||
var imAssignmentTypeLabelMap = map[IMAssignmentType]string{
|
||||
IMAssignmentTypeAssign: "分配",
|
||||
IMAssignmentTypeTransfer: "转接",
|
||||
}
|
||||
|
||||
func GetIMAssignmentTypeLabel(assignType IMAssignmentType) string {
|
||||
return imAssignmentTypeLabelMap[assignType]
|
||||
}
|
||||
|
||||
type IMAssignmentStatus int
|
||||
|
||||
const (
|
||||
IMAssignmentStatusActive IMAssignmentStatus = 0
|
||||
IMAssignmentStatusInactive IMAssignmentStatus = 1
|
||||
)
|
||||
|
||||
var imAssignmentStatusLabelMap = map[IMAssignmentStatus]string{
|
||||
IMAssignmentStatusActive: "进行中",
|
||||
IMAssignmentStatusInactive: "已结束",
|
||||
}
|
||||
|
||||
func GetIMAssignmentStatusLabel(status IMAssignmentStatus) string {
|
||||
return imAssignmentStatusLabelMap[status]
|
||||
}
|
||||
|
||||
type IMMessageType string
|
||||
|
||||
const (
|
||||
IMMessageTypeText IMMessageType = "text"
|
||||
IMMessageTypeImage IMMessageType = "image"
|
||||
IMMessageTypeAttachment IMMessageType = "attachment"
|
||||
IMMessageTypeHTML IMMessageType = "html"
|
||||
)
|
||||
|
||||
var imMessageTypeLabelMap = map[IMMessageType]string{
|
||||
IMMessageTypeText: "文本",
|
||||
IMMessageTypeImage: "图片",
|
||||
IMMessageTypeAttachment: "附件",
|
||||
IMMessageTypeHTML: "富文本",
|
||||
}
|
||||
|
||||
func GetIMMessageTypeLabel(messageType IMMessageType) string {
|
||||
return imMessageTypeLabelMap[messageType]
|
||||
}
|
||||
|
||||
type IMMessageStatus int
|
||||
|
||||
const (
|
||||
IMMessageStatusSending IMMessageStatus = 1
|
||||
IMMessageStatusSent IMMessageStatus = 2
|
||||
IMMessageStatusDelivered IMMessageStatus = 3
|
||||
IMMessageStatusRead IMMessageStatus = 4
|
||||
IMMessageStatusFailed IMMessageStatus = 5
|
||||
IMMessageStatusRecalled IMMessageStatus = 6
|
||||
)
|
||||
|
||||
var imMessageStatusLabelMap = map[IMMessageStatus]string{
|
||||
IMMessageStatusSending: "发送中",
|
||||
IMMessageStatusSent: "已发送",
|
||||
IMMessageStatusDelivered: "已送达",
|
||||
IMMessageStatusRead: "已读",
|
||||
IMMessageStatusFailed: "发送失败",
|
||||
IMMessageStatusRecalled: "已撤回",
|
||||
}
|
||||
|
||||
func GetIMMessageStatusLabel(status IMMessageStatus) string {
|
||||
return imMessageStatusLabelMap[status]
|
||||
}
|
||||
|
||||
type IMEventType string
|
||||
|
||||
const (
|
||||
IMEventTypeCreate IMEventType = "create"
|
||||
IMEventTypeAssign IMEventType = "assign"
|
||||
IMEventTypeTransfer IMEventType = "transfer"
|
||||
IMEventTypeClose IMEventType = "close"
|
||||
IMEventTypeMessageSend IMEventType = "message_send"
|
||||
IMEventTypeMessageRecall IMEventType = "message_recall"
|
||||
)
|
||||
|
||||
var imEventTypeLabelMap = map[IMEventType]string{
|
||||
IMEventTypeCreate: "创建会话",
|
||||
IMEventTypeAssign: "分配会话",
|
||||
IMEventTypeTransfer: "转接会话",
|
||||
IMEventTypeClose: "关闭会话",
|
||||
IMEventTypeMessageSend: "发送消息",
|
||||
IMEventTypeMessageRecall: "撤回消息",
|
||||
}
|
||||
|
||||
func GetIMEventTypeLabel(eventType IMEventType) string {
|
||||
return imEventTypeLabelMap[eventType]
|
||||
}
|
||||
|
||||
type AIAgentHandoffMode int
|
||||
|
||||
const (
|
||||
AIAgentHandoffModeWaitPool AIAgentHandoffMode = 1
|
||||
AIAgentHandoffModeDefaultTeamPool AIAgentHandoffMode = 2
|
||||
AIAgentHandoffModeAIHoldAndNotify AIAgentHandoffMode = 3
|
||||
)
|
||||
|
||||
var AIAgentHandoffModeValues = []AIAgentHandoffMode{
|
||||
AIAgentHandoffModeWaitPool,
|
||||
AIAgentHandoffModeDefaultTeamPool,
|
||||
AIAgentHandoffModeAIHoldAndNotify,
|
||||
}
|
||||
|
||||
var aiAgentHandoffModeLabelMap = map[AIAgentHandoffMode]string{
|
||||
AIAgentHandoffModeWaitPool: "进入待接入池",
|
||||
AIAgentHandoffModeDefaultTeamPool: "进入默认客服组待接入池",
|
||||
AIAgentHandoffModeAIHoldAndNotify: "AI继续接待并提醒人工",
|
||||
}
|
||||
|
||||
func GetAIAgentHandoffModeLabel(mode AIAgentHandoffMode) string {
|
||||
return aiAgentHandoffModeLabelMap[mode]
|
||||
}
|
||||
|
||||
type AIAgentFallbackMode int
|
||||
|
||||
const (
|
||||
AIAgentFallbackModeNoAnswer AIAgentFallbackMode = 1
|
||||
AIAgentFallbackModeSuggestRetry AIAgentFallbackMode = 2
|
||||
AIAgentFallbackModeHandoff AIAgentFallbackMode = 3
|
||||
)
|
||||
|
||||
var AIAgentFallbackModeValues = []AIAgentFallbackMode{
|
||||
AIAgentFallbackModeNoAnswer,
|
||||
AIAgentFallbackModeSuggestRetry,
|
||||
AIAgentFallbackModeHandoff,
|
||||
}
|
||||
|
||||
var aiAgentFallbackModeLabelMap = map[AIAgentFallbackMode]string{
|
||||
AIAgentFallbackModeNoAnswer: "直接说明知识不足",
|
||||
AIAgentFallbackModeSuggestRetry: "引导用户补充信息",
|
||||
AIAgentFallbackModeHandoff: "转人工客服",
|
||||
}
|
||||
|
||||
func GetAIAgentFallbackModeLabel(mode AIAgentFallbackMode) string {
|
||||
return aiAgentFallbackModeLabelMap[mode]
|
||||
}
|
||||
|
||||
const (
|
||||
IMRealtimeEventConnected = "connected"
|
||||
IMRealtimeEventPong = "pong"
|
||||
IMRealtimeEventSubscribed = "subscribed"
|
||||
IMRealtimeEventUnsubscribed = "unsubscribed"
|
||||
IMRealtimeEventResyncRequired = "resyncRequired"
|
||||
IMRealtimeEventMessageCreated = "message.created"
|
||||
IMRealtimeEventMessageRecalled = "message.recalled"
|
||||
IMRealtimeEventConversationCreated = "conversation.created"
|
||||
IMRealtimeEventConversationUpdated = "conversation.updated"
|
||||
IMRealtimeEventConversationAssigned = "conversation.assigned"
|
||||
IMRealtimeEventConversationTransferred = "conversation.transferred"
|
||||
IMRealtimeEventConversationClosed = "conversation.closed"
|
||||
IMRealtimeEventConversationRead = "conversation.read"
|
||||
IMRealtimeEventNotificationCreated = "notification.created"
|
||||
IMRealtimeEventCustomerSessionRefresh = "customer_session.refresh"
|
||||
IMRealtimeEventAgentActivity = "agent.activity"
|
||||
IMRealtimeEventOperatorPresence = "operator.presence"
|
||||
)
|
||||
|
||||
const (
|
||||
IMRealtimeClientTypePing = "ping"
|
||||
IMRealtimeClientTypeSubscribe = "subscribe"
|
||||
IMRealtimeClientTypeUnsubscribe = "unsubscribe"
|
||||
IMRealtimeClientTypeAck = "ack"
|
||||
IMRealtimeClientTypePresence = "presence"
|
||||
)
|
||||
|
||||
const (
|
||||
IMRealtimeResyncReasonInvalidPayload = "invalid_payload"
|
||||
IMRealtimeResyncReasonUnsupportedMessageType = "unsupported_message_type"
|
||||
IMRealtimeResyncReasonManual = "manual"
|
||||
)
|
||||
218
internal/pkg/enums/knowledge.go
Normal file
218
internal/pkg/enums/knowledge.go
Normal file
@@ -0,0 +1,218 @@
|
||||
package enums
|
||||
|
||||
type VectorDBType string
|
||||
|
||||
const (
|
||||
VectorDBTypeQdrant VectorDBType = "qdrant"
|
||||
VectorDBTypeLanceDB VectorDBType = "lancedb"
|
||||
)
|
||||
|
||||
var vectorDBTypeLabelMap = map[VectorDBType]string{
|
||||
VectorDBTypeQdrant: "Qdrant",
|
||||
VectorDBTypeLanceDB: "LanceDB",
|
||||
}
|
||||
|
||||
func GetVectorDBTypeLabel(dbType VectorDBType) string {
|
||||
return vectorDBTypeLabelMap[dbType]
|
||||
}
|
||||
|
||||
type KnowledgeDocumentContentType string
|
||||
|
||||
const (
|
||||
KnowledgeDocumentContentTypeHTML KnowledgeDocumentContentType = "html"
|
||||
KnowledgeDocumentContentTypeMarkdown KnowledgeDocumentContentType = "markdown"
|
||||
)
|
||||
|
||||
type KnowledgeBaseType string
|
||||
|
||||
const (
|
||||
KnowledgeBaseTypeDocument KnowledgeBaseType = "document"
|
||||
KnowledgeBaseTypeFAQ KnowledgeBaseType = "faq"
|
||||
)
|
||||
|
||||
var knowledgeBaseTypeLabelMap = map[KnowledgeBaseType]string{
|
||||
KnowledgeBaseTypeDocument: "文档知识库",
|
||||
KnowledgeBaseTypeFAQ: "FAQ知识库",
|
||||
}
|
||||
|
||||
func GetKnowledgeBaseTypeLabel(knowledgeType KnowledgeBaseType) string {
|
||||
return knowledgeBaseTypeLabelMap[knowledgeType]
|
||||
}
|
||||
|
||||
var knowledgeDocumentContentTypeLabelMap = map[KnowledgeDocumentContentType]string{
|
||||
KnowledgeDocumentContentTypeHTML: "HTML",
|
||||
KnowledgeDocumentContentTypeMarkdown: "Markdown",
|
||||
}
|
||||
|
||||
func GetKnowledgeDocumentContentTypeLabel(contentType KnowledgeDocumentContentType) string {
|
||||
return knowledgeDocumentContentTypeLabelMap[contentType]
|
||||
}
|
||||
|
||||
type KnowledgeDocumentIndexStatus string
|
||||
|
||||
const (
|
||||
KnowledgeDocumentIndexStatusPending KnowledgeDocumentIndexStatus = "pending"
|
||||
KnowledgeDocumentIndexStatusIndexed KnowledgeDocumentIndexStatus = "indexed"
|
||||
KnowledgeDocumentIndexStatusFailed KnowledgeDocumentIndexStatus = "failed"
|
||||
)
|
||||
|
||||
var KnowledgeDocumentIndexStatusValues = []KnowledgeDocumentIndexStatus{
|
||||
KnowledgeDocumentIndexStatusPending,
|
||||
KnowledgeDocumentIndexStatusIndexed,
|
||||
KnowledgeDocumentIndexStatusFailed,
|
||||
}
|
||||
|
||||
var knowledgeDocumentIndexStatusLabelMap = map[KnowledgeDocumentIndexStatus]string{
|
||||
KnowledgeDocumentIndexStatusPending: "待索引",
|
||||
KnowledgeDocumentIndexStatusIndexed: "已索引",
|
||||
KnowledgeDocumentIndexStatusFailed: "索引失败",
|
||||
}
|
||||
|
||||
func GetKnowledgeDocumentIndexStatusLabel(status KnowledgeDocumentIndexStatus) string {
|
||||
return knowledgeDocumentIndexStatusLabelMap[status]
|
||||
}
|
||||
|
||||
func IsValidKnowledgeDocumentIndexStatus(status string) bool {
|
||||
for _, item := range KnowledgeDocumentIndexStatusValues {
|
||||
if string(item) == status {
|
||||
return true
|
||||
}
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
type KnowledgeChunkType string
|
||||
|
||||
const (
|
||||
KnowledgeChunkTypeText KnowledgeChunkType = "text"
|
||||
KnowledgeChunkTypeFAQ KnowledgeChunkType = "faq"
|
||||
KnowledgeChunkTypeTable KnowledgeChunkType = "table"
|
||||
KnowledgeChunkTypeCode KnowledgeChunkType = "code"
|
||||
)
|
||||
|
||||
var knowledgeChunkTypeLabelMap = map[KnowledgeChunkType]string{
|
||||
KnowledgeChunkTypeText: "文本",
|
||||
KnowledgeChunkTypeFAQ: "问答",
|
||||
KnowledgeChunkTypeTable: "表格",
|
||||
KnowledgeChunkTypeCode: "代码",
|
||||
}
|
||||
|
||||
func GetKnowledgeChunkTypeLabel(chunkType KnowledgeChunkType) string {
|
||||
return knowledgeChunkTypeLabelMap[chunkType]
|
||||
}
|
||||
|
||||
type KnowledgeChunkProvider string
|
||||
|
||||
const (
|
||||
KnowledgeChunkProviderFixed KnowledgeChunkProvider = "fixed"
|
||||
KnowledgeChunkProviderStructured KnowledgeChunkProvider = "structured"
|
||||
KnowledgeChunkProviderFAQ KnowledgeChunkProvider = "faq"
|
||||
KnowledgeChunkProviderSemantic KnowledgeChunkProvider = "semantic"
|
||||
)
|
||||
|
||||
var knowledgeChunkProviderLabelMap = map[KnowledgeChunkProvider]string{
|
||||
KnowledgeChunkProviderFixed: "固定长度",
|
||||
KnowledgeChunkProviderStructured: "结构化分块",
|
||||
KnowledgeChunkProviderFAQ: "问答式分块",
|
||||
KnowledgeChunkProviderSemantic: "语义分块",
|
||||
}
|
||||
|
||||
func GetKnowledgeChunkProviderLabel(provider KnowledgeChunkProvider) string {
|
||||
return knowledgeChunkProviderLabelMap[provider]
|
||||
}
|
||||
|
||||
type KnowledgeRetrieveChannel string
|
||||
|
||||
const (
|
||||
KnowledgeRetrieveChannelIM KnowledgeRetrieveChannel = "im"
|
||||
KnowledgeRetrieveChannelAgentAssist KnowledgeRetrieveChannel = "agent_assist"
|
||||
KnowledgeRetrieveChannelAPI KnowledgeRetrieveChannel = "api"
|
||||
KnowledgeRetrieveChannelDebug KnowledgeRetrieveChannel = "debug"
|
||||
)
|
||||
|
||||
var knowledgeRetrieveChannelLabelMap = map[KnowledgeRetrieveChannel]string{
|
||||
KnowledgeRetrieveChannelIM: "客服会话",
|
||||
KnowledgeRetrieveChannelAgentAssist: "客服助手",
|
||||
KnowledgeRetrieveChannelAPI: "API接口",
|
||||
KnowledgeRetrieveChannelDebug: "调试",
|
||||
}
|
||||
|
||||
func GetKnowledgeRetrieveChannelLabel(channel KnowledgeRetrieveChannel) string {
|
||||
return knowledgeRetrieveChannelLabelMap[channel]
|
||||
}
|
||||
|
||||
type KnowledgeRetrieveScene string
|
||||
|
||||
const (
|
||||
KnowledgeRetrieveSceneFirstResponse KnowledgeRetrieveScene = "first_response"
|
||||
KnowledgeRetrieveSceneAssist KnowledgeRetrieveScene = "assist"
|
||||
KnowledgeRetrieveSceneQA KnowledgeRetrieveScene = "qa"
|
||||
)
|
||||
|
||||
var knowledgeRetrieveSceneLabelMap = map[KnowledgeRetrieveScene]string{
|
||||
KnowledgeRetrieveSceneFirstResponse: "首次回复",
|
||||
KnowledgeRetrieveSceneAssist: "辅助回复",
|
||||
KnowledgeRetrieveSceneQA: "问答",
|
||||
}
|
||||
|
||||
func GetKnowledgeRetrieveSceneLabel(scene KnowledgeRetrieveScene) string {
|
||||
return knowledgeRetrieveSceneLabelMap[scene]
|
||||
}
|
||||
|
||||
type KnowledgeAnswerStatus int
|
||||
|
||||
const (
|
||||
KnowledgeAnswerStatusNormal KnowledgeAnswerStatus = 1
|
||||
KnowledgeAnswerStatusNoAnswer KnowledgeAnswerStatus = 2
|
||||
KnowledgeAnswerStatusFallback KnowledgeAnswerStatus = 3
|
||||
KnowledgeAnswerStatusBlocked KnowledgeAnswerStatus = 4
|
||||
)
|
||||
|
||||
var knowledgeAnswerStatusLabelMap = map[KnowledgeAnswerStatus]string{
|
||||
KnowledgeAnswerStatusNormal: "正常",
|
||||
KnowledgeAnswerStatusNoAnswer: "无答案",
|
||||
KnowledgeAnswerStatusFallback: "兜底回复",
|
||||
KnowledgeAnswerStatusBlocked: "已屏蔽",
|
||||
}
|
||||
|
||||
func GetKnowledgeAnswerStatusLabel(status KnowledgeAnswerStatus) string {
|
||||
return knowledgeAnswerStatusLabelMap[status]
|
||||
}
|
||||
|
||||
type KnowledgeFeedbackType int
|
||||
|
||||
const (
|
||||
KnowledgeFeedbackTypeLike KnowledgeFeedbackType = 1
|
||||
KnowledgeFeedbackTypeDislike KnowledgeFeedbackType = 2
|
||||
KnowledgeFeedbackTypeNotHelpful KnowledgeFeedbackType = 3
|
||||
KnowledgeFeedbackTypeWrongCitation KnowledgeFeedbackType = 4
|
||||
KnowledgeFeedbackTypeOther KnowledgeFeedbackType = 5
|
||||
)
|
||||
|
||||
var knowledgeFeedbackTypeLabelMap = map[KnowledgeFeedbackType]string{
|
||||
KnowledgeFeedbackTypeLike: "点赞",
|
||||
KnowledgeFeedbackTypeDislike: "点踩",
|
||||
KnowledgeFeedbackTypeNotHelpful: "无帮助",
|
||||
KnowledgeFeedbackTypeWrongCitation: "引用错误",
|
||||
KnowledgeFeedbackTypeOther: "其他",
|
||||
}
|
||||
|
||||
func GetKnowledgeFeedbackTypeLabel(feedbackType KnowledgeFeedbackType) string {
|
||||
return knowledgeFeedbackTypeLabelMap[feedbackType]
|
||||
}
|
||||
|
||||
type KnowledgeAnswerMode int
|
||||
|
||||
const (
|
||||
KnowledgeAnswerModeStrict KnowledgeAnswerMode = 1
|
||||
KnowledgeAnswerModeAssist KnowledgeAnswerMode = 2
|
||||
)
|
||||
|
||||
var knowledgeAnswerModeLabelMap = map[KnowledgeAnswerMode]string{
|
||||
KnowledgeAnswerModeStrict: "严格模式",
|
||||
KnowledgeAnswerModeAssist: "辅助模式",
|
||||
}
|
||||
|
||||
func GetKnowledgeAnswerModeLabel(mode KnowledgeAnswerMode) string {
|
||||
return knowledgeAnswerModeLabelMap[mode]
|
||||
}
|
||||
12
internal/pkg/enums/knowledge_test.go
Normal file
12
internal/pkg/enums/knowledge_test.go
Normal file
@@ -0,0 +1,12 @@
|
||||
package enums
|
||||
|
||||
import "testing"
|
||||
|
||||
func TestVectorDBTypeLabelIncludesLanceDB(t *testing.T) {
|
||||
if VectorDBTypeLanceDB != "lancedb" {
|
||||
t.Fatalf("VectorDBTypeLanceDB = %q, want %q", VectorDBTypeLanceDB, "lancedb")
|
||||
}
|
||||
if got := GetVectorDBTypeLabel(VectorDBTypeLanceDB); got != "LanceDB" {
|
||||
t.Fatalf("GetVectorDBTypeLabel(VectorDBTypeLanceDB) = %q, want %q", got, "LanceDB")
|
||||
}
|
||||
}
|
||||
67
internal/pkg/enums/support.go
Normal file
67
internal/pkg/enums/support.go
Normal file
@@ -0,0 +1,67 @@
|
||||
package enums
|
||||
|
||||
type DocPageStatus string
|
||||
|
||||
const (
|
||||
DocPageStatusDraft DocPageStatus = "draft"
|
||||
DocPageStatusPublished DocPageStatus = "published"
|
||||
DocPageStatusHidden DocPageStatus = "hidden"
|
||||
DocPageStatusDeleted DocPageStatus = "deleted"
|
||||
)
|
||||
|
||||
type PostStatus string
|
||||
|
||||
const (
|
||||
PostStatusPending PostStatus = "pending"
|
||||
PostStatusNormal PostStatus = "normal"
|
||||
PostStatusResolved PostStatus = "resolved"
|
||||
PostStatusClosed PostStatus = "closed"
|
||||
PostStatusHidden PostStatus = "hidden"
|
||||
PostStatusDeleted PostStatus = "deleted"
|
||||
)
|
||||
|
||||
type CommentStatus string
|
||||
|
||||
const (
|
||||
CommentStatusNormal CommentStatus = "normal"
|
||||
CommentStatusHidden CommentStatus = "hidden"
|
||||
CommentStatusDeleted CommentStatus = "deleted"
|
||||
)
|
||||
|
||||
type CommentAuthorType string
|
||||
|
||||
const (
|
||||
CommentAuthorTypeUser CommentAuthorType = "user"
|
||||
CommentAuthorTypeEmployee CommentAuthorType = "employee"
|
||||
)
|
||||
|
||||
type ReactionTarget string
|
||||
|
||||
const (
|
||||
ReactionTargetPost ReactionTarget = "post"
|
||||
ReactionTargetComment ReactionTarget = "comment"
|
||||
)
|
||||
|
||||
type ReactionType string
|
||||
|
||||
const (
|
||||
ReactionTypeLike ReactionType = "like"
|
||||
)
|
||||
|
||||
type UserType string
|
||||
|
||||
const (
|
||||
UserTypeUser UserType = "user"
|
||||
UserTypeEmployee UserType = "employee"
|
||||
)
|
||||
|
||||
var UserTypeValues = []UserType{UserTypeUser, UserTypeEmployee}
|
||||
|
||||
var userTypeLabelMap = map[UserType]string{
|
||||
UserTypeUser: "访客",
|
||||
UserTypeEmployee: "员工",
|
||||
}
|
||||
|
||||
func GetUserTypeLabel(userType UserType) string {
|
||||
return userTypeLabelMap[userType]
|
||||
}
|
||||
55
internal/pkg/enums/ticket.go
Normal file
55
internal/pkg/enums/ticket.go
Normal file
@@ -0,0 +1,55 @@
|
||||
package enums
|
||||
|
||||
type TicketStatus string
|
||||
|
||||
const (
|
||||
TicketStatusPending TicketStatus = "pending"
|
||||
TicketStatusInProgress TicketStatus = "in_progress"
|
||||
TicketStatusDone TicketStatus = "done"
|
||||
)
|
||||
|
||||
var TicketStatusValues = []TicketStatus{
|
||||
TicketStatusPending,
|
||||
TicketStatusInProgress,
|
||||
TicketStatusDone,
|
||||
}
|
||||
|
||||
var ticketStatusLabelMap = map[TicketStatus]string{
|
||||
TicketStatusPending: "待处理",
|
||||
TicketStatusInProgress: "处理中",
|
||||
TicketStatusDone: "已处理",
|
||||
}
|
||||
|
||||
func GetTicketStatusLabel(status TicketStatus) string {
|
||||
return ticketStatusLabelMap[status]
|
||||
}
|
||||
|
||||
func IsValidTicketStatus(status string) bool {
|
||||
for _, item := range TicketStatusValues {
|
||||
if string(item) == status {
|
||||
return true
|
||||
}
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
type TicketSource string
|
||||
|
||||
const (
|
||||
TicketSourceManual TicketSource = "manual"
|
||||
TicketSourceConversation TicketSource = "conversation"
|
||||
)
|
||||
|
||||
var TicketSourceValues = []TicketSource{
|
||||
TicketSourceManual,
|
||||
TicketSourceConversation,
|
||||
}
|
||||
|
||||
func IsValidTicketSource(source string) bool {
|
||||
for _, item := range TicketSourceValues {
|
||||
if string(item) == source {
|
||||
return true
|
||||
}
|
||||
}
|
||||
return false
|
||||
}
|
||||
24
internal/pkg/enums/tool.go
Normal file
24
internal/pkg/enums/tool.go
Normal file
@@ -0,0 +1,24 @@
|
||||
package enums
|
||||
|
||||
type ToolSourceType string
|
||||
|
||||
const (
|
||||
ToolSourceTypeMCP ToolSourceType = "mcp"
|
||||
ToolSourceTypeGraph ToolSourceType = "graph"
|
||||
ToolSourceTypeBuiltin ToolSourceType = "builtin"
|
||||
)
|
||||
|
||||
var ToolSourceTypeValues = []ToolSourceType{
|
||||
ToolSourceTypeMCP,
|
||||
ToolSourceTypeGraph,
|
||||
ToolSourceTypeBuiltin,
|
||||
}
|
||||
|
||||
func IsValidToolSourceType(sourceType ToolSourceType) bool {
|
||||
for _, item := range ToolSourceTypeValues {
|
||||
if item == sourceType {
|
||||
return true
|
||||
}
|
||||
}
|
||||
return false
|
||||
}
|
||||
Reference in New Issue
Block a user