Files
ai-agent/internal/pkg/enums/external_identity.go
T
mlogclub 4ec529e860 feat: add user token secret management for channels
- Implemented user token secret generation and retrieval in channel service.
- Added ResetUserTokenSecret method to reset the user token secret for channels.
- Updated channel configuration parsing to include user token secret.
- Enhanced WebSocket service to utilize user token secret for external info retrieval.
- Modified dashboard channel edit component to support user token secret display and reset functionality.
- Introduced API endpoint for resetting user token secret.
- Updated IM and SDK configurations to include user token.
- Added tests for user token verification logic.
2026-04-28 10:15:15 +08:00

36 lines
943 B
Go

package enums
// ExternalSource 外部身份来源。
//
// 与 ExternalID 组合即可唯一标识某渠道下的访客身份。
type ExternalSource string
const (
ExternalSourceGuest ExternalSource = "guest" // 访客
ExternalSourceWxWorkKF ExternalSource = "wxwork_kf" // 企业微信客服
ExternalSourceUser ExternalSource = "user" // 用户信息
)
var externalSourceLabelMap = map[ExternalSource]string{
ExternalSourceGuest: "访客",
ExternalSourceWxWorkKF: "企业微信客服",
ExternalSourceUser: "用户",
}
func GetExternalSourceLabel(v ExternalSource) string {
if s, ok := externalSourceLabelMap[v]; ok {
return s
}
return string(v)
}
// IsAllowedOpenImExternalSource 开放 IM 入口允许的外部来源(闭集校验)。
func IsAllowedOpenImExternalSource(s ExternalSource) bool {
switch s {
case ExternalSourceGuest, ExternalSourceUser:
return true
default:
return false
}
}